#!/bin/bash
ip=$1
phone_no=$2
port=$3
#"请输入用户手机号:" phone_no
do
        len=`echo $phone_no|awk '{print length($0)}'`
        if [ $len -ne 11 ]
        then
                echo "请输入11位手机号!"
        else
                break
        fi
done

echo "————start————"
mysql -h"$ip" -P"$port" -u"qa" -p"qatest" <<EOF
use xyqb; 
update xyqb.repayment_plan
set repayment_status=3
where loan_application_history_id=(select id from xyqb.loan_application_history where business_type=0 and user_id=(select id from xyqb_user.user where phone_no =$phone_no) and is_active=1) and repayment_status=0 limit 1;
EOF

echo "done!!!"
