Commit 57bb97be authored by qa_quantgroup's avatar qa_quantgroup

update

parent 3f322b96
......@@ -24,57 +24,58 @@ function authorization()
plan_id=`mysql -N $mysqld xyqb -e "select id from baitiao_bill_repayment_plan where order_id='$order_id' limit 1"`
fund_order_id=`mysql -N $mysqld xyqb -e "select id from baitiao_fund_order where order_id='$order_id'"`
term_no=`mysql -N $mysqld xyqb -e "select count(*) from baitiao_bill_repayment_plan where order_id='$order_id'"`
bill_id=`mysql -N $mysqld xyqb -e "select id from baitiao_bill where user_id='$user_id' limit 1"`
insert_sql0="insert into baitiao_fund_repayment_plan("plan_id","fund_order_id","term_no","principal","interest","discount","finance_record_id","status") values ($plan_id,'$fund_order_id',1,'0','0','0',NULL,'0')"
mysql $mysqld ${DBNAME} -e "${insert_sql0}"
echo $insert_sql0
#echo $insert_sql0
insert_sql0="insert into baitiao_fund_repayment_plan("plan_id","fund_order_id","term_no","principal","interest","discount","finance_record_id","status") values ($plan_id+1,'$fund_order_id',2,'0','0','0',NULL,'0')"
mysql $mysqld ${DBNAME} -e "${insert_sql0}"
echo $insert_sql0
#echo $insert_sql0
insert_sql0="insert into baitiao_fund_repayment_plan("plan_id","fund_order_id","term_no","principal","interest","discount","finance_record_id","status") values ($plan_id+2,'$fund_order_id',3,'0','0','0',NULL,'0')"
mysql $mysqld ${DBNAME} -e "${insert_sql0}"
echo $insert_sql0
#echo $insert_sql0
update_sql="UPDATE baitiao_fund_repayment_plan as t1, baitiao_bill_repayment_plan as t2 SET t1.principal = t2.principal,t1.interest=t2.interest,t1.deadline=t2.deadline WHERE t1.plan_id = t2.id and t1.plan_id=$plan_id"
mysql $mysqld ${DBNAME} -e "${update_sql}"
echo $update_sql
#echo $update_sql
update_sql="UPDATE baitiao_fund_repayment_plan as t1, baitiao_bill_repayment_plan as t2 SET t1.principal = t2.principal,t1.interest=t2.interest,t1.deadline=t2.deadline WHERE t1.plan_id = t2.id and t1.plan_id=$plan_id+1"
mysql $mysqld ${DBNAME} -e "${update_sql}"
echo $update_sql
#echo $update_sql
update_sql="UPDATE baitiao_fund_repayment_plan as t1, baitiao_bill_repayment_plan as t2 SET t1.principal = t2.principal,t1.interest=t2.interest,t1.deadline=t2.deadline WHERE t1.plan_id = t2.id and t1.plan_id=$plan_id+2"
mysql $mysqld ${DBNAME} -e "${update_sql}"
echo $update_sql
#echo $update_sql
mon=`date "+%Y%m"`
insert_sql0="insert into baitiao_bill("user_id","user_phone","month","already_repay_amount","bill_repay_status","enable") values ('$user_id','$phone_no','$mon','0','0','1')"
mysql $mysqld ${DBNAME} -e "${insert_sql0}"
echo $insert_sql0
#echo $insert_sql0
mon=`date -d '1 month' '+%Y%m'`
insert_sql0="insert into baitiao_bill("user_id","user_phone","month","already_repay_amount","bill_repay_status","enable") values ('$user_id','$phone_no','$mon','0','0','1')"
mysql $mysqld ${DBNAME} -e "${insert_sql0}"
echo $insert_sql0
#echo $insert_sql0
mon=`date -d "2 month" "+%Y%m"`
insert_sql0="insert into baitiao_bill("user_id","user_phone","month","already_repay_amount","bill_repay_status","enable") values ('$user_id','$phone_no','$mon','0','0','1')"
mysql $mysqld ${DBNAME} -e "${insert_sql0}"
echo $insert_sql0
#echo $insert_sql0
bill_id=`mysql -N $mysqld xyqb -e "select id from baitiao_bill where user_id='$user_id' limit 1"`
echo "bill_id=$bill_id"
#insert_sql0="insert into baitiao_finance_record("third_no","total_amount","local_no","type","remark") values ('$date',10000,NULL,'0',N'笑脸资金方批量放款到量化派')"
#mysql $mysqld ${DBNAME} -e "${insert_sql0}"
update_sql="update baitiao_bill_repayment_plan set bill_id=$bill_id where order_id=$order_id and term_no=1"
mysql $mysqld ${DBNAME} -e "${update_sql}"
echo $update_sql
#echo $update_sql
update_sql="update baitiao_bill_repayment_plan set bill_id=$bill_id+1 where order_id=$order_id and term_no=2"
mysql $mysqld ${DBNAME} -e "${update_sql}"
echo $update_sql
#echo $update_sql
update_sql="update baitiao_bill_repayment_plan set bill_id=$bill_id+2 where order_id=$order_id and term_no=3"
mysql $mysqld ${DBNAME} -e "${update_sql}"
echo $update_sql
#echo $update_sql
update_sql="update baitiao_fund_order set status=3,start_interest_date='$date_now' where order_id='$order_id'"
mysql $mysqld ${DBNAME} -e "${update_sql}"
echo $update_sql
#echo $update_sql
echo "done!!! $date_now"
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment