#!/bin/bash
ip=$1
phone_no=$2
seq=$3
#seq "请输入消费流水号(随意修改以下值几个数字值即可XYBT2015122219571073084102263893):" 

mysql -h"$ip" -p"3306" -u"qa" -p"qatest" <<EOF 
use xyqb;
update xyqb.loan_application_history 
set progress=39
where user_id=(
select id from xyqb.user where phone_no='$phone_no'
);

update xyqb.baitiao_account 
set status=1
where user_id=(
select id from xyqb.user where phone_no='$phone_no'
); 


insert into  xyqb.baitiao_consume_history
(user_id,order_id,remaining_amount,consume_type,consume_seq)
values 
((select id from xyqb.user where phone_no='$phone_no'),-1,
(select credit_amount from baitiao_account 
where  user_id=(select id from xyqb.user where phone_no='$phone_no')),0,'$seq');

update xyqb.baitiao_account
set pay_pwd='7da26eb97215a944743cc22d49e39f0d', pay_pwd_salt='NkUzMjY3QjIzQTEzMjdBNDQzM0M2MTIz'
where user_id=(
select id from xyqb.user where phone_no='$phone_no');

EOF
