#!/bin/bash
ip=$1
phone_no=$2
port=$3
date=`date "+%Y-%m-%d %H:%M:%S"`
mysqld="-h$ip -P$port -uqa -pqatest"
len=`echo $phone_no|awk '{print length($0)}'`
if [ $len -ne 11 ];then
	echo "请输入11位手机号!"
	exit -1
fi
mysql $mysqld -e "select version();" &>/dev/null
if [ $? -ne 0 ];then
	echo "$ip Mysql is not running! $date"
	exit -1
fi

mysql -h"$ip" -P"$port" -u"qa" -p"qatest" <<EOF
update xyqb.loan_application_history
set xyqb.loan_application_history.progress=40 
where business_type=0 and user_id=(select id from xyqb_user.user where phone_no =$phone_no) and is_active=1;
EOF
echo "done!!! $date"

