Commit 62ba00dc authored by tywldx's avatar tywldx
parents bf567f12 1f7c4bf0
...@@ -23,6 +23,8 @@ if [ "$delete_business_data" = "true" ];then ...@@ -23,6 +23,8 @@ if [ "$delete_business_data" = "true" ];then
echo "CREATE DATABASE IF NOT EXISTS \`${database_name}\` DEFAULT CHARSET utf8 COLLATE utf8_general_ci;" | mysql -h $mysql_host -uqa -pqatest echo "CREATE DATABASE IF NOT EXISTS \`${database_name}\` DEFAULT CHARSET utf8 COLLATE utf8_general_ci;" | mysql -h $mysql_host -uqa -pqatest
fi fi
echo `pwd`
for entry in ./* for entry in ./*
do do
echo "mysql -h $mysql_host -u qa -pqatest $database_name < $entry" echo "mysql -h $mysql_host -u qa -pqatest $database_name < $entry"
......
#!/bin/bash
rpm -ivh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-remi
yum -y install nodejs npm --enablerepo=epel
...@@ -32,10 +32,6 @@ function authorization() ...@@ -32,10 +32,6 @@ function authorization()
mysql $mysqld ${DBNAME} -e "${insert_sql3}" mysql $mysqld ${DBNAME} -e "${insert_sql3}"
echo "done!!! $date" echo "done!!! $date"
fi fi
} }
authorization $ip $phone_no authorization $ip $phone_no
#!/bin/bash
ip=$1
phone_no=$2
PORT="3306"
USERNAME="qa"
PASSWORD="qatest"
DBNAME="xyqb"
TABLENAME="user"
mysqld="-h${ip} -P${PORT} -u${USERNAME} -p${PASSWORD}"
date_now=`date "+%Y-%m-%d %H:%M:%S"`
function authorization()
{
len=`echo $phone_no|awk '{print length($0)}'`
if [ $len -ne 11 ];then
echo "请输入11位手机号!"
else
#查询userID
select_sql="select id from ${TABLENAME} where phone_no=${phone_no}"
user_id=`mysql -N $mysqld xyqb_user -e "${select_sql}"`
echo "user_id=$user_id"
order_id=`mysql -N $mysqld xyqb -e "select id from baitiao_order where user_id='$user_id' order by id desc limit 1"`
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'"`
baitiao_fund_repayment_plan=`mysql -N $mysqld xyqb -e "select id from baitiao_fund_repayment_plan where plan_id='$plan_id'"`
if [[ -n "baitiao_fund_repayment_plan" ]]; then
echo "finish~"
exit
else
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
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"
mysql $mysqld ${DBNAME} -e "${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
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
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
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
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
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
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
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
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 "done!!! $date_now"
fi
fi
}
authorization $ip $phone_no
...@@ -13,8 +13,7 @@ date=`date "+%Y-%m-%d %H:%M:%S"` ...@@ -13,8 +13,7 @@ date=`date "+%Y-%m-%d %H:%M:%S"`
function authorization() function authorization()
{ {
len=`echo $phone_no|awk '{print length($0)}'` len=`echo $phone_no|awk '{print length($0)}'`
if [ $len -ne 11 ] if [ $len -ne 11 ];then
then
echo "请输入11位手机号!" echo "请输入11位手机号!"
else else
#查询userID #查询userID
......
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