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


echo "开始授信:$phone_no ~"
mysql -h"$ip" -P"$port" -u"qa" -p"qatest" <<EOF
use spider_center;
insert into spider_center.user_authorization (auth_type,user_id)  
select 0, u.id from spider_center.user u 
where u.phone_no = '$phone_no';
insert into spider_center.user_authorization (auth_type,user_id)  
select 3, u.id from spider_center.user u 
where u.phone_no = '$phone_no';  

EOF
echo  "结束成功:$phone_no ~"

