#!/bin/bash
base_path=/home/sub_config_file_dont_rm
function tranceConfig()
{
	type_=$1
	source_str=$2
	target_str=$3
	ip_host=$4
	file_name=$5
	echo "
	source_str: $source_str
	target_str: $target_str
	ip_host: $ip_host
	file_name: $file_name
	"
	if [ "$type_" = "java" ]
	then
		sed -i "N;s#$source_str#$target_str#g"  $base_path/$ip_host/java/$file_name
		sed -i "N;s#$source_str#$target_str#g"  $base_path/$ip_host/public/java/$file_name

	elif [ "$type_" = "ui" ]
	then
		sed -i "N;s#$source_str#$target_str#g"  $base_path/$ip_host/ui/$file_name
		sed -i "N;s#$source_str#$target_str#g"  $base_path/$ip_host/public/ui/$file_name
	elif [ "$type_" = "python" ]
	then
		sed -i "N;s#$source_str#$target_str#g"  $base_path/$ip_host/python/$file_name

	elif [ "$type_" = "node" ]
	then
		sed -i "N;s#$source_str#$target_str#g"  $base_path/$ip_host/node/$file_name

        elif [ "$type_" = "nginx" ]
        then    
                sed -i "N;s#$source_str#$target_str#g"  $base_path/$ip_host/nginx_conf.d/$file_name
        fi
}

#4.12
#tranceConfig ui "7047" "12047"  "192.168.4.12" "merchant-op-ui.js"
#tranceConfig java "spider-center.host=http:\/\/192.168.4.12:7021\/" "spider-center.host=http:\/\/spider-center-12.ss.xyqb.loan\/" "192.168.4.12" "spider-center.properties" 
#tranceConfig ui "7041" "7054" "192.168.4.12" "activity-ui.js"
tranceConfig java "baitiao_redpacket_notify_url=http:\/\/192.168.4.12:7031\/redpacket\/distribute\/" "baitiao_redpacket_notify_url=http:\/\/192.168.4.12:7031" "192.168.4.12" "baitiao.properties" 
tranceConfig java "wx89894cd83d117b26" "wxdf0392b9a648b646" "192.168.4.12" "xyqb-user2.properties"
tranceConfig java "11fb7f6a8b8edf2776a72c2f5624229c" "0849d140bbb50de8fceae2c4694e2e3f" "192.168.4.12" "xyqb-user2.properties"
tranceConfig ui "wx89894cd83d117b26" "wxdf0392b9a648b646" "192.168.4.12" "xyqb-user-ui.js"
tranceConfig ui "11fb7f6a8b8edf2776a72c2f5624229c" "0849d140bbb50de8fceae2c4694e2e3f" "192.168.4.12" "xyqb-user-ui.js"
tranceConfig ui "wechattest.xyqb.com" "wechattest2.xyqb.com" "192.168.4.12" "xyqb-user-ui.js"
tranceConfig java "kamen.customerid=test" "kamen.phone.customerid=803571" "192.168.4.12" "xyqb-mall.properties"
tranceConfig java "kamen.secretkey=12345678901234567890" "kamen.secretkey=281383FDF56E65D3FDA88343113B3631" "192.168.4.12" "xyqb-mall.properties"
tranceConfig java "kamen.customerid=test" "kamen.phone.customerid=803571" "192.168.4.12" "xyqb-mall.properties"
tranceConfig java "kamen.phone.url=http://192.168.4.241" "kamen.phone.url=http://ccapi.soouu.cn" "192.168.4.12" "xyqb-mall.properties"

# tranceConfig node "host: \'http:\/\/192.168.4.12:7013" "host: \'http:\/\/192.168.4.12:7042" "192.168.4.12" "AppBackend.js"
# tranceConfig node "host.*7042" "host: 'http:\/\/192.168.4.12:7013" "192.168.4.12" "AppBackend.js"

#tranceConfig java "wx.api_host=https:\/\/api.mch.weixin.qq.com\/" "wx.api_host=http:\/\/192.168.4.241\/" "192.168.4.12" "gu-bei.properties"

#4.13
#tranceConfig java "pay.debug=0" "pay.debug=1" "192.168.4.13" "xyqb-mall.properties"
tranceConfig java "red.packet.id=10000115" "red.packet.id=56" "192.168.4.13" "xyqb-mall.properties"
tranceConfig java "7002" "7050" "192.168.4.13" "baitiao.properties"
#tranceConfig java "lkb.model.url=http:\/\/192.168.4.202\/Model\/openapi" "lkb.model.url=http:\/\/192.168.4.13:8090\/Model\/openapi" "192.168.4.13" "baitiao.properties" 
#tranceConfig java "xyqb.model.url=http:\/\/192.168.4.202\/Model\/openapi" "xyqb.model.url=http:\/\/192.168.4.13:8090\/Model\/openapi" "192.168.4.13" "baitiao.properties" 
tranceConfig java "wx89894cd83d117b26" "wx5b2e77c58fdcf1a5" "192.168.4.13" "xyqb-user2.properties"
tranceConfig java "11fb7f6a8b8edf2776a72c2f5624229c" "feb3c0705c1200f3759052310bde3369" "192.168.4.13" "xyqb-user2.properties"
tranceConfig ui "wx89894cd83d117b26" "wx5b2e77c58fdcf1a5" "192.168.4.13" "xyqb-user-ui.js"
tranceConfig ui "11fb7f6a8b8edf2776a72c2f5624229c" "feb3c0705c1200f3759052310bde3369" "192.168.4.13" "xyqb-user-ui.js"
tranceConfig ui "wechattest.xyqb.com" "wechattest1.xyqb.com" "192.168.4.13" "xyqb-user-ui.js"

#4.14
#tranceConfig java 'cardniu.client.url=http://kn.feidee.net/loanmanage/loan/partner/k_n_user_quota_client.do' 'cardniu.client.url=http://192.168.4.248/mockjs/31/loanmanage/loan/partner/k_n_user_quota_client.do' "192.168.4.14" "xyqb.properties"
#tranceConfig java "cardniu.url=http://kn.feidee.net/loanmanage/loan/partner/k_n_user_quota.do" "cardniu.url=http://192.168.4.248/mockjs/31/loanmanage/loan/partner/k_n_user_quota.do" "192.168.4.14" "xyqb.properties"
#tranceConfig java "xyqb.is.debug=0" "xyqb.is.debug=1" "192.168.4.14" "xyqb.properties"
#tranceConfig nginx "\/home\/quant_group\/paycenter-ui\/dist" "\/home\/quant_group\/new-paycenter-ui\/dist" "192.168.4.14" "paycenter-ui.conf"
#tranceConfig java "192.168.4.14:3306" "192.168.4.20:3306" "192.168.4.14" "*"
#tranceConfig java "192.168.4.14:7007" "139.198.2.95:1407" "192.168.4.14" "gu-bei.properties"
#tranceConfig python "192.168.4.14" "192.168.4.20" "192.168.4.14" "qin-qiong.*"
#tranceConfig java "pay.debug=0" "pay.debug=1" "192.168.4.14" "xyqb-mall.properties"
tranceConfig java "www.q-gp.com:1462" "192.168.4.14:7062" "192.168.4.14" "xyqb-user2.properties"
tranceConfig java "www.q-gp.com:2181" "192.168.4.14:2181" "192.168.4.14" "xyqb-user2.properties"

#4.15
#tranceConfig java "192.168.4.15:7007" "139.198.2.95:1507" "192.168.4.15" "gu-bei.properties"
#这个配置是微信支付的时候，需要修改成线上的沙箱环境
#tranceConfig java "wechat.appid=wxcdf6077af8127559" "wechat.appid=wx0a7c0bce0c3ac523" "192.168.4.15" "xyqb-user2.properties"
#tranceConfig java "wechat.secret=16eaec16084d0d9c52d4114f359cc72c" "wechat.secret=10131fe347f88e0affabe45b7ee4ca6c" "192.168.4.15" "xyqb-user2.properties"
#tranceConfig java "wx.sandbox.key=e1dd0780c93aae56c2d786184421cfc8" "wx.sandbox.key=10131fe347f88e0affabe45b7ee4ca6c" "192.168.4.15" "gu-bei.properties"
#tranceConfig java "wx7bf214ccdcbd2e16" "wx0a7c0bce0c3ac523" "192.168.4.15" "gu-bei.properties"
#tranceConfig java "paycenter.host.url=http:\/\/192.168.4.15:7007" "paycenter.host.url=http:\/\/wechattest1.xyqb.com" "192.168.4.15" "gu-bei.properties"
#tranceConfig java "139.198.2.95:1507" "wechattest1.xyqb.com" "192.168.4.15" "gu-bei.properties"
#tranceConfig java "loanorder" "loanstatus" "192.168.4.15" "xyqb.properties"
#tranceConfig java "xyqb-ui.url=http://192.168.4.15:7001" "xyqb-ui.url=http://192.168.4.15:7057" "192.168.4.15" "xyqb.properties"
#tranceConfig java "mall-ui.url=http://192.168.4.15:7058" "mall-ui.url=http://wechattest1.xyqb.com" "192.168.4.15" "xyqb.properties"

#4.16

#4.17
#tranceConfig java "192.168.4.3" "192.168.4.17" "192.168.4.17" "*"
tranceConfig java "ygziguan.api.url=http://139.198.0.253/receiver/grequest" "ygziguan.api.url=http://192.168.4.241/receiver/grequest" "192.168.4.17" "fund-manage.properties"
#4.18

#4.22
#tranceConfig node "112233445512345.ittun.com" "activity-op-22.ss.xyqb.loan" "192.168.4.22" "activity-op.js"
#tranceConfig java "xyqb.is.debug=1" "xyqb.is.debug=0" "192.168.4.22" "baitiao.properties"
#tranceConfig java "7002" "7050" "192.168.4.22" "baitiao.properties"
#tranceConfig node "7002" "7050" "192.168.4.22" "AppBackend.js"
tranceConfig ui "192.168.4.22:7040" "139.198.2.95:2240" "192.168.4.22" "activity-ui.js"
tranceConfig ui "192.168.4.22:7003/api/coupon/activity/wechat/rent_house/bargain" "wechattest1.xyqb.com/wechat/active_redirect" "192.168.4.22" "activity-ui.js"
tranceConfig java "http://192.168.4.22:7040/to-share" "http://139.198.2.95:7040/to-share" "192.168.4.22" "xyqb.properties"
tranceConfig ui "wechattest.xyqb.com" "wechattest1.xyqb.com" "192.168.4.22" "xyqb-user-ui.js"
tranceConfig java "xyqb-user-ui-22.ss.xyqb.loan" "139.198.2.95:2243" "192.168.4.22" "xyqb-user2.properties"

#4.23
#tranceConfig node "db: {\n        host: '192.168.4.23'" "db: {\n        host: '192.168.4.8'" "192.168.4.23" "*"
#tranceConfig java "192.168.4.23:3306" "192.168.4.8:3306" "192.168.4.23" "*"
#tranceConfig node "dbIp: '192.168.4.23'" "dbIp: '192.168.4.8'" "192.168.4.23" "*"
#tranceConfig python "ip=192.168.4.23" "ip=192.168.4.8"  "192.168.4.23" "qin-qiong*"
#tranceConfig java "192.168.4.23:3306" "192.168.4.8:3306" "192.168.4.23" "redpacket.properties"
#tranceConfig java "qatest" "Uiwb@o^fR&nHOa5t" "192.168.4.23" "redpacket.properties"
#tranceConfig java "redpacket.data.mysql.user=qa" "redpacket.data.mysql.user=xyqb_query" "192.168.4.23" "redpacket.properties"
tranceConfig node "192.168.4.50:9050" "192.168.4.23:7060" "192.168.4.23" "op-api.js"
tranceConfig java "xyqb.is.debug=0" "xyqb.is.debug=1" "192.168.4.23" "baitiao.properties"
#tranceConfig java "pay.debug=0" "pay.debug=1" "192.168.4.23" "xyqb-mall.properties"

#4.24
#tranceConfig java "sms.is.debug=1" "sms.is.debug=0" "192.168.4.24" "di-ting.properties"
#tranceConfig java "xyqb.is.debug=1" "xyqb.is.debug=0" "192.168.4.24" "xyqb.properties"
tranceConfig node "112233445512345.ittun.com" "activity-op-24.ss.xyqb.loan" "192.168.4.24" "activity-op.js"
#tranceConfig java "192.168.4.24:7058" "wechattest2.xyqb.com" "192.168.4.24" "xyqb.properties"
#微信环境修改，请勿删除，可以注释
tranceConfig java "wx89894cd83d117b26" "wxc94ca68b353e90d0" "192.168.4.24" "xyqb-user2.properties"
tranceConfig java "11fb7f6a8b8edf2776a72c2f5624229c" "e30380e9ade07f361e51a643f94d8817" "192.168.4.24" "xyqb-user2.properties"
tranceConfig ui "wx89894cd83d117b26" "wxc94ca68b353e90d0" "192.168.4.24" "xyqb-user-ui.js"
tranceConfig ui "11fb7f6a8b8edf2776a72c2f5624229c" "e30380e9ade07f361e51a643f94d8817" "192.168.4.24" "xyqb-user-ui.js"
tranceConfig ui "wx89894cd83d117b26" "wxc94ca68b353e90d0" "192.168.4.24" "activity-ui.js"


#4.26
tranceConfig java "ygziguan.api.url=http://139.198.0.253/receiver/grequest" "ygziguan.api.url=http://192.168.4.241/receiver/grequest" "192.168.4.26" "fund-manage.properties"

#4.28

tranceConfig java "wx.api_host=https:\/\/api.mch.weixin.qq.com\/" "wx.api_host=http:\/\/192.168.4.241\/" "192.168.4.28" "gu-bei.properties"

#4.72
#tranceConfig java "sms.is.debug=1" "sms.is.debug=0" "192.168.4.24" "di-ting.properties"
#tranceConfig java "xyqb.is.debug=1" "xyqb.is.debug=0" "192.168.4.24" "xyqb.properties"
#tranceConfig node "host.*7042" "host: 'http:\/\/192.168.4.72:7013" "192.168.4.72" "AppBackend.js"
#tranceConfig node ":7013/app/login" ":7042/app/login2" "192.168.4.72" "AppBackend.js"
#tranceConfig node ":7013" ":7042" "192.168.4.72" "AppBackend.js"
#tranceConfig java "wx.api_host=https:\/\/api.mch.weixin.qq.com\/" "wx.api_host=http:\/\/192.168.4.241\/" "192.168.4.72" "gu-bei.properties"

#4.151
tranceConfig java "xyqb.is.debug=0" "xyqb.is.debug=1" "192.168.4.151" "xyqb.properties"
tranceConfig java "liebao.aes.key=0123456789abcdef" "liebao.aes.key=e2XNtnB8QEEuvhEW" "192.168.4.151" "cash-loan-flow.properties"
tranceConfig java "liebao.md5.key=0123456" "liebao.md5.key=8KRrA2U" "192.168.4.151" "cash-loan-flow.properties"
#tranceConfig java "pay.debug=0" "pay.debug=1" "192.168.4.151" "xyqb-mall.properties"
tranceConfig java "xyqb-ui.url=http:\/\/192.168.4.151:7001" "xyqb-ui.url=http:\/\/139.198.2.95:15101" "192.168.4.151" "cash-loan-flow.properties"
#tranceConfig java "permit.new.user = 1" "permit.new.user = 0" "192.168.4.151" "cash-loan-flow.properties"


#4.152
tranceConfig node "d45o0qd" "5exp2xo" "192.168.4.152" "op-api.js"
#tranceConfig java "qgbc-ui.url=http:\/\/192.168.4.152:7002" "qgbc-ui.url=http:\/\/192.168.4.152:7050" "192.168.4.152" "xyqb.properties" 
#tranceConfig java "7025" "7003" "192.168.4.152" "baitiao.properties"
#tranceConfig ui "wechattest.xyqb.com" "wechattest1.xyqb.com" "192.168.4.22" "xyqb-user-ui.js"
tranceConfig ui "192.168.4.152:7019" "171910sn46.iask.in" "192.168.4.152" "bt-ui.js"
tranceConfig java "139.198.2.95:2231" "192.168.4.22:7031" "192.168.4.22" "xyqb.properties"

#4.156
tranceConfig java  "http:\/\/192.168.4.241\/" "http:\/\/221.207.229.3:17500\/wlpf\/HttpServer\/XFXD_INPUT_SVR\/" "192.168.4.156"  "baitiao-zhitou.properties"
#tranceConfig java  "http:\/\/192.168.4.156:7017\/eureka\/" "http:\/\/192.168.4.152:7017\/eureka\/" "192.168.4.156"  "baitiao.properties"
#tranceConfig java "eureka.client.serviceUrl.defaultZone=http://192.168.4.156:7017/eureka/" "eureka.client.serviceUrl.defaultZone=http://192.168.4.17:7017/eureka/" "192.168.4.156" "baitiao-zhitou.properties"
#微信环境修改，请勿删除，可以注释
tranceConfig java "wx89894cd83d117b26" "wx5b2e77c58fdcf1a5" "192.168.4.22" "xyqb-user2.properties"
tranceConfig java "11fb7f6a8b8edf2776a72c2f5624229c" "feb3c0705c1200f3759052310bde3369" "192.168.4.22" "xyqb-user2.properties" 
tranceConfig ui "wx89894cd83d117b26" "wx5b2e77c58fdcf1a5" "192.168.4.22" "xyqb-user-ui.js"
tranceConfig ui "11fb7f6a8b8edf2776a72c2f5624229c" "feb3c0705c1200f3759052310bde3369" "192.168.4.22" "xyqb-user-ui.js"
#end

