function mock()
{
        mkdir -p /home/quant_group/gu-bei/config
        if [[ -a /home/quant_group/gu-bei/config/application.properties ]]; then
                sed -i "/yeepay.v2.xyqb.merchant/d" /home/quant_group/gu-bei/config/application.properties
                sed -i "/yeepay.v2.xyqb.privateKey/d" /home/quant_group/gu-bei/config/application.properties
                sed -i "/yeepay.v2.xyqb.yeepay.publicKey/d" /home/quant_group/gu-bei/config/application.properties
                sed -i "/yeepay.v2.apihost/d" /home/quant_group/gu-bei/config/application.properties
        fi
        echo "yeepay.v2.xyqb.merchant=10000449633" >> /home/quant_group/gu-bei/config/application.properties
        echo "yeepay.v2.xyqb.privateKey=MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBANSBQSc0Hlr+mS7uoIjYS71X2DJ6ZrCcbB1uICqty9QY6W16nZ8tLN/d9k2Z+e2rGG8s7PskpU2T+WuJeDSXs/vpPllG8/tSRVaWcr9EzPaSti3ltSUH0QOLSypZEjTT/slscExj4PMOmQXUXP3gewjNWz1cYRI7dGnKPm+ZFah/AgMBAAECgYB8AcFngz6DkzcI8C+2K6JnJ6/+JPdv8JgWxID45tqfNrphLMB2dwJM0VY+CrCSRNnJZsoT9FqSXtuaKWqAJlbchhPZjupA9RkWFzlGpCQ63/CC71RYYY03eCnc7AIpn52whkjfWG/yf57jKzEwUT+U034uvXdaA+lVvJ0xqpj3gQJBAOmLODjecn450TJbNQaop+7Q5Hz2TUIxbYakzPpcLGv1QYgHa657r7PJ23ZltDBGldMaNTZfqJrtDcq0rTA4lBECQQDo8CcdUhMZ3JbR2UZN0CG8ljMbNWgNWBa37ebE3ZG5yYldc7zY9US/+/7lhxNDqG0saTvM9pJwEc3ccVMvksOPAkEAqq7V+zIQKVJmItBn06MFgNNoei+kTUFEk8f0CvG8gXYwW5NYzp+UzOg1HbW82B9uNmeMBl4pInknwEMF5B0lkQJAdRxQPgCGk+kAdo6LNxHd9Ed7eEF4h8Ty3xQfgnh3DHYTtsU6e8WMBA24kENB3zEtejeKFjkdVHTPD/Z1wSRDZwJAAvNuq0YuRDsESOAerkBZKonA5CD0M4vHTRqihHrjBohv6yxBU8P7gALrX7qmoaZ3aLmN8wHdOAGTR6LZjQdkoQ==" >> /home/quant_group/gu-bei/config/application.properties
        echo "yeepay.v2.xyqb.yeepay.publicKey=MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDUgUEnNB5a/pku7qCI2Eu9V9gyemawnGwdbiAqrcvUGOltep2fLSzf3fZNmfntqxhvLOz7JKVNk/lriXg0l7P76T5ZRvP7UkVWlnK/RMz2krYt5bUlB9EDi0sqWRI00/7JbHBMY+DzDpkF1Fz94HsIzVs9XGESO3Rpyj5vmRWofwIDAQAB" >> /home/quant_group/gu-bei/config/application.properties
        echo "yeepay.v2.apihost=http://192.168.4.241:10086/tzt-api/api/" >> /home/quant_group/gu-bei/config/application.properties
}

function unmock()
{
	if [[ -a /home/quant_group/gu-bei/config/application.properties ]]; then
                sed -i "/yeepay.v2.xyqb.merchant/d" /home/quant_group/gu-bei/config/application.properties
                sed -i "/yeepay.v2.xyqb.privateKey/d" /home/quant_group/gu-bei/config/application.properties
                sed -i "/yeepay.v2.xyqb.yeepay.publicKey/d" /home/quant_group/gu-bei/config/application.properties
                sed -i "/yeepay.v2.apihost/d" /home/quant_group/gu-bei/config/application.properties
	fi
}

if [[ $1 = "yes" ]]; then
	mock
else
	unmock
fi
sh /home/qa-deploy-utils/qa_shell_script/2_get_code_by_name.sh gu-bei
if [ $? = 0 ]; then
	echo "2_get_code_by_name ok"
else
	echo "2_get_code_by_name fail"
	exit -1
fi
sh /home/qa-deploy-utils/qa_shell_script/3_link_config_file_by_name.sh gu-bei
if [ $? = 0 ]; then
	echo "3_link_config_file_by_name ok"
else
	echo "3_link_config_file_by_name fail"
	exit -1
fi
sh /home/qa-deploy-utils/qa_shell_script/4_build_by_name.sh gu-bei
if [ $? = 0 ]; then
	echo "4_build_by_name ok"
else
	echo "4_build_by_name fail"
	exit -1
fi
/home/qa-deploy-utils/qa_shell_script/5_restart_by_name.sh gu-bei
if [ $? = 0 ]; then
	echo "5_restart_by_name ok"
else
	echo "5_restart_by_name fail"
	exit -1
fi
