Commit 62ba00dc authored by tywldx's avatar tywldx
parents bf567f12 1f7c4bf0
......@@ -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
fi
echo `pwd`
for entry in ./*
do
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
......@@ -12,7 +12,7 @@ if [ $len -ne 11 ];then
fi
if [ -z $fund_id ];then
fund_id=140
fund_id=140
fi
date=`date "+%Y-%m-%d %H:%M:%S"`
......
......@@ -13,29 +13,25 @@ date=`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 ${TABLENAME1} where phone_no=${phone_no}"
user_id=`mysql -N $mysqld ${DBNAME} -e "${select_sql}"`
echo "user_id=$user_id"
#插入授信数据0和3
insert_sql0="insert into ${TABLENAME} ("user_id","auth_type","auth_status") values ('$user_id','0',1)"
insert_sql3="insert into ${TABLENAME} ("user_id","auth_type","auth_status") values ('$user_id','3',1)"
#echo "$insert_sql0"
#echo "$insert_sql3"
mysql $mysqld ${DBNAME} -e "${insert_sql0}"
mysql $mysqld ${DBNAME} -e "${insert_sql3}"
echo "done!!! $date"
fi
if [ $len -ne 11 ]
then
echo "请输入11位手机号!"
else
#查询userID
select_sql="select id from ${TABLENAME1} where phone_no=${phone_no}"
user_id=`mysql -N $mysqld ${DBNAME} -e "${select_sql}"`
echo "user_id=$user_id"
#插入授信数据0和3
insert_sql0="insert into ${TABLENAME} ("user_id","auth_type","auth_status") values ('$user_id','0',1)"
insert_sql3="insert into ${TABLENAME} ("user_id","auth_type","auth_status") values ('$user_id','3',1)"
#echo "$insert_sql0"
#echo "$insert_sql3"
mysql $mysqld ${DBNAME} -e "${insert_sql0}"
mysql $mysqld ${DBNAME} -e "${insert_sql3}"
echo "done!!! $date"
fi
}
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
......@@ -12,9 +12,9 @@ mysqld="-h${ip} -P${PORT} -u${USERNAME} -p${PASSWORD}"
function doMysql()
{
#更新loan_application_history表中的is_active=0
update_sql="update ${TABLENAME} set activity_starttime=\"$start_time\", activity_endtime=\"$end_time\" where id=${act_id}"
echo ` mysql $mysqld ${DBNAME} -e "${update_sql}"`
#更新loan_application_history表中的is_active=0
update_sql="update ${TABLENAME} set activity_starttime=\"$start_time\", activity_endtime=\"$end_time\" where id=${act_id}"
echo ` mysql $mysqld ${DBNAME} -e "${update_sql}"`
}
......
......@@ -14,21 +14,21 @@ date=`date "+%Y-%m-%d %H:%M:%S"`
function closeloan()
{
len=`echo $phone_no|awk '{print length($0)}'`
if [ $len -ne 11 ]
then
echo "请输入11位手机号!"
else
#查询userID
select_sql="select id from ${TABLENAME1} where phone_no=${phone_no}"
user_id=`mysql -N $mysqld ${DBNAME1} -e "${select_sql}"`
echo "user_id=$user_id"
if [ $len -ne 11 ]
then
echo "请输入11位手机号!"
else
#查询userID
select_sql="select id from ${TABLENAME1} where phone_no=${phone_no}"
user_id=`mysql -N $mysqld ${DBNAME1} -e "${select_sql}"`
echo "user_id=$user_id"
#更新loan_application_history表中的is_active=0
update_sql="update ${TABLENAME} set is_active=0 where user_id=${user_id} and is_active=1 and business_type=0"
mysql $mysqld ${DBNAME} -e "${update_sql}"
echo "done!!! $date"
break
fi
#更新loan_application_history表中的is_active=0
update_sql="update ${TABLENAME} set is_active=0 where user_id=${user_id} and is_active=1 and business_type=0"
mysql $mysqld ${DBNAME} -e "${update_sql}"
echo "done!!! $date"
break
fi
}
......
......@@ -24,10 +24,10 @@ fi
function deleteAlldata()
{
len=`echo $phone_no|awk '{print length($0)}'`
if [ $len -ne 11 ]
then
echo "请输入11位手机号!"
else
if [ $len -ne 11 ]
then
echo "请输入11位手机号!"
else
#各数据库中获取id值
xyqb_user_id=`mysql -N $mysqld ${DBNAME} -e "select id from ${TABLENAME} where phone_no=${phone_no}"`
if [ -z $xyqb_user_id ];then
......@@ -133,4 +133,4 @@ function deleteAlldata()
fi
}
deleteAlldata $ip $phone_no
deleteAlldata $ip $phone_no
......@@ -9,7 +9,7 @@ if [ $len -ne 11 ];then
fi
if [ -z $account ];then
account=100
account=100
fi
date=`date "+%Y-%m-%d %H:%M:%S"`
unique_business_id=CASH_LOAN`date +%s%N`
......
......@@ -13,22 +13,21 @@ date=`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 ${TABLENAME1} where phone_no=${phone_no}"
user_id=`mysql -N $mysqld ${DBNAME} -e "${select_sql}"`
echo "user_id=$user_id"
if [ $len -ne 11 ];then
echo "请输入11位手机号!"
else
#查询userID
select_sql="select id from ${TABLENAME1} where phone_no=${phone_no}"
user_id=`mysql -N $mysqld ${DBNAME} -e "${select_sql}"`
echo "user_id=$user_id"
insert_sql0="insert into ${TABLENAME} ("user_id","name","phone_no","relation") values ('$user_id',N'哈哈',13312341234,'0')"
insert_sql1="insert into ${TABLENAME} ("user_id","name","phone_no","relation") values ('$user_id',N'嘿嘿',13356785678,'1')"
insert_sql0="insert into ${TABLENAME} ("user_id","name","phone_no","relation") values ('$user_id',N'哈哈',13312341234,'0')"
insert_sql1="insert into ${TABLENAME} ("user_id","name","phone_no","relation") values ('$user_id',N'嘿嘿',13356785678,'1')"
mysql $mysqld ${DBNAME} -e "${insert_sql0}"
mysql $mysqld ${DBNAME} -e "${insert_sql1}"
echo "done!!! $date"
fi
mysql $mysqld ${DBNAME} -e "${insert_sql0}"
mysql $mysqld ${DBNAME} -e "${insert_sql1}"
echo "done!!! $date"
fi
}
authorization $ip $phone_no
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