Commit 1f7c4bf0 authored by 智勇's avatar 智勇

update

parent 57bb97be
...@@ -25,59 +25,65 @@ function authorization() ...@@ -25,59 +25,65 @@ function authorization()
fund_order_id=`mysql -N $mysqld xyqb -e "select id from baitiao_fund_order where order_id='$order_id'"` 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'"` term_no=`mysql -N $mysqld xyqb -e "select count(*) from baitiao_bill_repayment_plan where order_id='$order_id'"`
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')" baitiao_fund_repayment_plan=`mysql -N $mysqld xyqb -e "select id from baitiao_fund_repayment_plan where plan_id='$plan_id'"`
mysql $mysqld ${DBNAME} -e "${insert_sql0}" if [[ -n "baitiao_fund_repayment_plan" ]]; then
#echo $insert_sql0 echo "finish~"
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')" exit
mysql $mysqld ${DBNAME} -e "${insert_sql0}" else
#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,'$fund_order_id',1,'0','0','0',NULL,'0')"
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}"
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
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
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" 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}" 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" 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}" 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" 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}" mysql $mysqld ${DBNAME} -e "${update_sql}"
#echo $update_sql #echo $update_sql
mon=`date "+%Y%m"` 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')" 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}" mysql $mysqld ${DBNAME} -e "${insert_sql0}"
#echo $insert_sql0 #echo $insert_sql0
mon=`date -d '1 month' '+%Y%m'` 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')" 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}" mysql $mysqld ${DBNAME} -e "${insert_sql0}"
#echo $insert_sql0 #echo $insert_sql0
mon=`date -d "2 month" "+%Y%m"` 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')" 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}" 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"` bill_id=`mysql -N $mysqld xyqb -e "select id from baitiao_bill where user_id='$user_id' limit 1"`
echo "bill_id=$bill_id" 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'笑脸资金方批量放款到量化派')" #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}" #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" 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}" 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" 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}" 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" 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}" 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'" 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}" mysql $mysqld ${DBNAME} -e "${update_sql}"
#echo $update_sql #echo $update_sql
echo "done!!! $date_now" echo "done!!! $date_now"
fi
fi 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