update_repayment_plan="UPDATE baitiao_bill_repayment_plan as a set a.bill_id=(SELECT id from baitiao_bill where baitiao_bill.user_phone='${phone_no}' and baitiao_bill.month=${paymonth}) where a.id=${id}"
select_update_repayment_plan="UPDATE baitiao_bill_repayment_plan as aa set aa.deadline='${line1}' WHERE aa.id=${id}"
# echo ${select_update_repayment_plan}
mysql -N$mysqld xyqb -e"${select_update_repayment_plan}"
#更新笑脸还款计划金额baitiao_fund_repayment_plan
select_fund_repayment_plan1="update baitiao_fund_repayment_plan as a,baitiao_bill_repayment_plan as b set a.principal=b.principal,a.interest=b.interest WHERE a.plan_id=b.id and b.id=${id} and a.fund_order_id=${fund_order_id1}"
# echo ${select_fund_repayment_plan1}
mysql -N$mysqld xyqb -e"${select_update_repayment_plan}"
mysql $mysql3-e"set names utf8; ${spider_center_user_insert}"
fi
#spider_center.user_authorization插入一条授信信息
spider_center_user_id=`mysql -N$mysql3-e"SELECT id from spider_center.user where phone_no=${phone_no};"`
user_authorization_type=`mysql -N$mysql3-e"select auth_type from spider_center.user_authorization where user_id=${spider_center_user_id} and auth_type in (0,3);"`
user_authorization_status=`mysql -N$mysql3-e"select auth_status from spider_center.user_authorization where user_id=${spider_center_user_id};"`
if[[$user_authorization_type==""]];then
user_authorization_insert="INSERT INTO spider_center.user_authorization ( auth_type, last_auth_time, auth_account_name, user_id, auth_status)
VALUES
(3, now(), NULL, ${spider_center_user_id}, 1),
(0, now(), NULL, ${spider_center_user_id}, 1);"
mysql $mysql3-e"set names utf8; ${user_authorization_insert}"
mysql $mysql3-e"set names utf8; ${spider_center_user_insert}"
fi
#spider_center.user_authorization插入一条授信信息
spider_center_user_id=`mysql -N$mysql3-e"SELECT id from spider_center.user where phone_no=${phone_no};"`
user_authorization_type=`mysql -N$mysql3-e"select auth_type from spider_center.user_authorization where user_id=${spider_center_user_id} and auth_type in (0,3);"`
user_authorization_status=`mysql -N$mysql3-e"select auth_status from spider_center.user_authorization where user_id=${spider_center_user_id};"`
if[[$user_authorization_type==""]];then
user_authorization_insert="INSERT INTO spider_center.user_authorization ( auth_type, last_auth_time, auth_account_name, user_id, auth_status)
VALUES
(3, now(), NULL, ${spider_center_user_id}, 1),
(0, now(), NULL, ${spider_center_user_id}, 1);"
mysql $mysql3-e"set names utf8; ${user_authorization_insert}"