#!/bin/bash
set -e
ip=$1
phone_no=$2
coupon_type=$3 # 1-友宝满减券;2-商城满减券;3-商城折扣券;4-商城实物折扣券;5-商城实物满减券;6-商城充值折扣券;7-现金贷还款折扣券;8-现金贷还款抵扣券;9-现金贷还款免息券;10-白条购物满减券;11-【深圳通】满减券;12-【环球黑卡】满减券；13-【环球黑卡】免息券；14-【e袋洗】免息券；15-【e袋洗】满减券；16-【武汉一卡通】免息券;17-【武汉一卡通】满减券；18-【深圳通】免息券；19-【友宝】免息券；20-【新氧】免息券；21-【新氧】满减券；22-【全部外部渠道】满减券；23-【全部外部渠道】免息券；24-商城免息券

HOSTNAME="$ip"   #数据库信息
PORT="3306"
USERNAME="qa"
PASSWORD="qatest"

DBNAME="redpacket"    #数据库名称
TABLENAME="tb-coupon"

date="`date +%Y%m%d%H%M%S`"
date_now=`date +"%Y-%m-%d %T"`
echo $date_now

len=`echo $phone_no|awk '{print length($0)}'`
if [ $len -ne 11 ];then
        echo "请输入11位手机号!"
        exit -1
fi


case "$coupon_type" in
1)
coupon_1="INSERT INTO redpacket.tb_coupon ( unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid)
VALUES (concat('MALL20170626111210457af1ec45g',$date), '$phone_no', '10000572', '友宝优惠券', '9', '{\"firstChannel\":\"2\"}', '1', '{\"full\":200,\"cut\":5}', NOW(),'2028-09-24 23:59:00', '0', '2', NOW(), NULL, NOW(), '2', '26364792')"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_1}"
return=$?
if [ "$return" = "0" ];then
	echo "友宝满减券新增成功！！！"
else
	echo "友宝满减券新增失败！！！"
fi
;;

2)
coupon_2="INSERT INTO redpacket.tb_coupon (unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid) 
VALUES ( concat('MALL20171109161159417a4d41cg1',$date), '$phone_no', '10000669', '商城购物满减券', '6', '{\"firstChannel\":1,\"channelId\":[]}', '1', '{\"full\":\"100\",\"cut\":\"5\"}', NOW(), '2028-09-24 23:59:00','0', '2', NOW(), NULL, NOW(), NULL, '1000033')"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_2}" 
return=$?
if [ "$return" = "0" ];then
	echo "商城购物满减券增加成功！！！"
else
	echo "商城购物满减券增加失败！！！"
fi
;;

 3)
coupon_3="INSERT INTO redpacket.tb_coupon (unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid) 
VALUES ( concat('MALL20171109161216046a1f635gd',$date), '$phone_no', '10000670', '商城购物折扣券', '6', '{\"firstChannel\":1,\"channelId\":[]}', '2', '{\"discount\":\"5\"}', NOW(),'2028-09-24 23:59:00', '0', '2', NOW(), NULL, NOW(), NULL, '1000033')"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_3}" 
return=$?
if [ "$return" = "0" ];then
	echo "商城购物折扣券增加成功！！！"
else
	echo "商城购物折扣券增加失败！！！"
fi
;;

4)
coupon_4="INSERT INTO redpacket.tb_coupon (unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid) 
VALUES ( concat('MALL20171109161216046a1f635gd',$date), '$phone_no', '10000679', '商城购物实物折扣券', '6', '{\"firstChannel\":3,\"channelId\":[]}', '2', '{\"discount\":8}', NOW(), '2028-09-24 23:59:00', '0', '2', NOW(), NULL, NOW(), NULL, '1000033')"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_4}" 
return=$?
if [ "$return" = "0" ];then
	echo "商城购物实物折扣券增加成功！！！"
else
	echo "商城购物实物折扣券增加失败！！！"
fi
;;

5)
coupon_5="INSERT INTO redpacket.tb_coupon ( unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid) 
VALUES ( concat('MALL2017110917061815515d71558',$date), '$phone_no', '10000678', '商城购物实物满减券', '6', '{\"firstChannel\":3,\"channelId\":[]}', '1', '{\"full\":100,\"cut\":5}',NOW(),'2028-09-24 23:59:00', '0', '2', NOW(), NULL, NOW(), NULL, '1000033');"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_5}" 
return=$?
if [ "$return" = "0" ];then
	echo "商城购物实物满减券增加成功！！！"
else
	echo "商城购物实物满减券增加失败！！！"
fi
;;

6)
coupon_6="INSERT INTO redpacket.tb_coupon (unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid) 
VALUES ( concat('MALL201711091706293642335f562',$date), '$phone_no', '10000677', '商城购物充值折扣券', '6', '{\"firstChannel\":2,\"channelId\":[]}', '2', '{\"discount\":8}', NOW(),'2028-09-24 23:59:00', '0', '2', NOW(), NULL, NOW(), NULL, '1000033')"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_6}" 
return=$?
if [ "$return" = "0" ];then
	echo "商城购物充值折扣券增加成功！！！"
else
	echo "商城购物充值折扣券增加失败！！！"
fi
;;

7)
coupon_7="INSERT INTO redpacket.tb_coupon (unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid) 
VALUES ( concat('CASH_LOAN2017102419394902108ea8623',$date), '$phone_no', '10000649', '现金贷还款折扣券', '8', '{\"loanTerm\":[1,2,3]}', '2', '{\"discount\":8.8}', NOW(),'2028-09-24 23:59:00','0', '2', NOW(), NULL, NOW(), NULL, '5')"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_7}" 
return=$?
if [ "$return" = "0" ];then
	echo "现金贷还款折扣券增加成功！！！"
else
	echo "现金贷还款折扣券增加失败！！！"
fi
;;

8)
coupon_8="INSERT INTO redpacket.tb_coupon ( unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid) 
VALUES ( concat('CASH_LOAN20171109161259004ad216ge3',$date), '$phone_no', '10000672', '现金贷抵扣券', '8', '{\"loanTerm\":[1,2]}', '3', '{\"rebate\":\"100\"}', NOW(),'2028-09-24 23:59:00', '0', '2', NOW(), NULL, NOW(), NULL, '1000033')"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_8}" 
return=$?
if [ "$return" = "0" ];then
	echo "现金贷抵扣券增加成功！！！"
else
	echo "现金贷抵扣券增加失败!!!"
fi
;;

9)
coupon_9="INSERT INTO redpacket.tb_coupon ( unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid) 
VALUES (concat('CASH_LOAN2017110916134482203d783ga',$date), '$phone_no', '10000673', '现金贷还款免息券', '8', '{\"loanTerm\":[1,2]}', '4', '{}', NOW(), '2028-09-24 23:59:00', '0', '2', NOW(), NULL, NOW(), NULL, '1000033')"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_9}" 
return=$?
if [ "$return" = "0" ];then
	echo "现金贷还款免息券增加成功！！！"
else
	echo "现金贷还款免息券增加失败"
fi
;;

10)
coupon_10="INSERT INTO redpacket.tb_coupon ( unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid) 
VALUES (concat('OUT_BAITIAO201711091613599425d5e345g',$date), '$phone_no', '10000674', '白条购物券满减券', '9', '{\"firstChannel\":1}', '1', '{\"full\":\"100\",\"cut\":\"50\"}', NOW(),'2028-09-24 23:59:00', '0', '2', NOW(), NULL, NOW(), NULL, '1000033')"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_10}" 
return=$?
if [ "$return" = "0" ];then
	echo "白条购物券满减券增加成功！！！"
else
	echo "白条购物券满减券增加失败！！！"
fi
;;

11)
coupon_11="INSERT INTO redpacket.tb_coupon ( unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid) 
VALUES ( concat('OUT_BAITIAO201711091614166796e01b39g',$date), '$phone_no', '10000675', '深圳通白条购物券满减券', '9', '{\"firstChannel\":2}', '1', '{\"full\":\"100\",\"cut\":\"5\"}',NOW(), '2028-09-24 23:59:00', '0', '2', NOW(), NULL, NOW(), NULL, '1000033')"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_11}" 
return=$?
if [ "$return" = "0" ];then
	echo "深圳通白条购物券满减券增加成功！！！"
else
	echo "深圳通白条购物券满减券增加失败！！1"
fi
;;

12)coupon_12="INSERT INTO redpacket.tb_coupon (unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid)
VALUES
	(concat('OUT_BAITIAO2017120115315499231decb56',$date), '$phone_no', 10000625, '白条外部满减券【环球黑卡】', 9, '{\"firstChannel\":6}', 1, '{\"full\":\"300\",\"cut\":\"10\"}', NOW(), '2028-01-20 00:00:00', 0, 2, NOW(), NULL, NOW(), NULL, 1002150);"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_12}"
return=$?
if [ "$return" = "0" ];then
        echo "白条外部满减券【环球黑卡】新增成功！！！"
else
        echo "白条外部满减券【环球黑卡】新增失败！！！"
fi
;;

13)
coupon_13="INSERT INTO redpacket.tb_coupon (unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid)
VALUES
	(concat('OUT_BAITIAO20171201151342841868ebe8',$date), '$phone_no', 10000626, '白条外部免息券【环球黑卡】', 9, '{\"firstChannel\":6}', 5, '{\"discount\":80,\"priceRange\":\"10-5000\",\"terms\":{\"1\":[1],\"3\":[1,2,3],\"6\":[1,2,3,4,5,6]}}', NOW(), '2029-11-01 23:59:00', 0, 2,  NOW(), NULL, NOW(), NULL, 1002150);
"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_13}"
return=$?
if [ "$return" = "0" ];then
        echo "白条外部免息券【环球黑卡】新增成功！！！"
else
        echo "白条外部免息券【环球黑卡】新增失败！！！"
fi
;;

14)
coupon_14="INSERT INTO redpacket.tb_coupon (unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid)
VALUES
	(concat('OUT_BAITIAO201712011540111686168c8d4',$date), '$phone_no', 10000628, '外部白条免息券【e袋洗】', 9, '{\"firstChannel\":7}', 5, '{\"discount\":50,\"priceRange\":\"10-5000\",\"terms\":{\"1\":[1],\"3\":[1,2,3],\"6\":[1,2,3,4,5,6]}}', NOW(), '2019-11-01 23:59:00', 0, 2, NOW(), NULL, NOW(), NULL, 1002150);"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_14}"
return=$?
if [ "$return" = "0" ];then
        echo "外部白条免息券【e袋洗】新增成功！！！"
else
        echo "外部白条免息券【e袋洗】新增失败！！！"
fi
;;

15)
coupon_15="INSERT INTO redpacket.tb_coupon (unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid)
VALUES
	(concat('OUT_BAITIAO20171201154018003c5cdb50c',$date), '$phone_no', 10000627, '外部白条满减券【e袋洗】', 9, '{\"firstChannel\":7}', 1, '{\"full\":\"20\",\"cut\":\"10\"}', NOW(), '2029-11-01 23:59:00', 0, 2, NOW(), NULL, NOW(), NULL, 1002150);"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_15}"
return=$?
if [ "$return" = "0" ];then
        echo "外部白条满减券【e袋洗】新增成功！！！"
else
        echo "外部白条满减券【e袋洗】新增失败！！！"
fi
;;

16)
coupon_16="INSERT INTO redpacket.tb_coupon (unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid)
VALUES
	(concat('OUT_BAITIAO2017120115404289280bc0f11',$date), '$phone_no', 10000622, '外部白条免息券【武汉一卡通】', 9, '{\"firstChannel\":4}', 5, '{\"discount\":3,\"priceRange\":\"10-1000\",\"terms\":{\"1\":[1],\"3\":[1,2,3],\"6\":[1,2,3,4,5,6]}}', NOW(), '2019-11-01 23:59:00', 0, 2, NOW(), NULL, NOW(), NULL, 1002150);"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_16}"
return=$?
if [ "$return" = "0" ];then
        echo "外部白条免息券【武汉一卡通】新增成功！！！"
else
        echo "外部白条免息券【武汉一卡通】新增失败！！！"
fi
;;

17)
coupon_17="INSERT INTO redpacket.tb_coupon (unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid)
VALUES
	(concat('OUT_BAITIAO2017120115404810701a78979',$date), '$phone_no', 10000621, '外部白条满减券【武汉一卡通】', 9, '{\"firstChannel\":4}', 1, '{\"full\":500,\"cut\":50}', NOW(), '2019-11-01 23:59:00', 0, 2, NOW(), NULL, NOW(), NULL, 1002150);

"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_17}"
return=$?
if [ "$return" = "0" ];then
        echo "外部白条满减券【武汉一卡通】新增成功！！！"
else
        echo "外部白条满减券【武汉一卡通】新增失败！！！"
fi
;;

18)
coupon_18="INSERT INTO redpacket.tb_coupon (unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid)
VALUES
	(concat('OUT_BAITIAO20171201154341628a620cb4',$date), '$phone_no', 10000632, '白条外部免息券【深圳通】', 9, '{\"firstChannel\":3}', 5, '{\"discount\":50,\"priceRange\":\"10-5000\",\"terms\":{\"1\":[1],\"3\":[1,2,3],\"6\":[1,2,3,4,5,6]}}', NOW(), '2019-11-01 23:59:00', 0, 3, NOW(), NULL, NOW(), NULL, 1002150);"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_18}"
return=$?
if [ "$return" = "0" ];then  
        echo "白条外部免息券【深圳通】新增成功！！！"
else
        echo "白条外部免息券【深圳通】新增失败！！！"
fi
;;

19)
coupon_19="INSERT INTO redpacket.tb_coupon (unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid)
VALUES
	(concat('OUT_BAITIAO20171201154334993355afb19',$date), '$phone_no', 10000631, '白条外部免息券【友宝】', 9, '{\"firstChannel\":2}', 5, '{\"discount\":20,\"priceRange\":\"10-1000\",\"terms\":{\"1\":[1],\"3\":[1,2,3],\"6\":[1,2,3,4,5,6]}}', NOW(), '2019-11-01 23:59:00', 0, 2, NOW(), NULL, NOW(), NULL, 1002150);"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_19}"
return=$?
if [ "$return" = "0" ];then
        echo "白条外部免息券【友宝】新增成功！！！"
else
        echo "白条外部免息券【友宝】新增失败！！！"
fi
;;

20)
coupon_20="INSERT INTO redpacket.tb_coupon (unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid)
VALUES
	(concat('OUT_BAITIAO2017120115402614693f5f8ab',$date), '$phone_no', 10000624, '白条外部免息券【新氧】', 9, '{\"firstChannel\":5}', 5, '{\"discount\":10,\"priceRange\":\"10-1000\",\"terms\":{\"1\":[1],\"3\":[1,2,3],\"6\":[1,2,3,4,5,6]}}', NOW(), '2028-01-06 00:00:00', 0, 2, NOW(), NULL, NOW(), NULL, 1002150);"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_20}"
return=$?
if [ "$return" = "0" ];then
        echo "白条外部免息券【新氧】新增成功！！！"
else
        echo "白条外部免息券【新氧】新增失败！！！"
fi
;;

21)
coupon_21="INSERT INTO redpacket.tb_coupon (unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid)
VALUES
	(concat('OUT_BAITIAO20171201154036703398cb9fe',$date), '$phone_no', 10000623, '外部白条满减券【新氧】', 9, '{\"firstChannel\":5}', 1, '{\"full\":\"100\",\"cut\":\"10\"}', NOW(), '2026-01-06 00:00:00', 0, 2, NOW(), NULL, NOW(), NULL, 1002150);"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_21}"
return=$?
if [ "$return" = "0" ];then
        echo "外部白条满减券【新氧】新增成功！！！"
else
        echo "外部白条满减券【新氧】新增失败！！！"
fi
;;

22)
coupon_22="INSERT INTO redpacket.tb_coupon (unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid)
VALUES
	(concat('OUT_BAITIAO201712011537207501ce2f54f',$date), '$phone_no', 10000630, '白条外部满减券【全部渠道】', 9, '{\"firstChannel\":1}', 1, '{\"full\":\"500\",\"cut\":\"30\"}', NOW(), '2019-11-01 23:59:00', 0, 2, NOW(), NULL, NOW(), NULL, 1002150);
"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_22}"
return=$?
if [ "$return" = "0" ];then
        echo "白条外部满减券【全部渠道】新增成功！！！"
else
        echo "白条外部满减券【全部渠道】新增失败！！！"
fi
;;

23)
coupon_23="INSERT INTO redpacket.tb_coupon (unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid)
VALUES
	(concat('OUT_BAITIAO20171201153729670ae48cb40',$date), '$phone_no', 10000629, '白条外部免息券【全部渠道】', 9, '{\"firstChannel\":1}', 5, '{\"discount\":50,\"priceRange\":\"10-5000\",\"terms\":{\"1\":[1],\"3\":[1,2,3],\"6\":[1,2,3,4,5,6]}}', NOW(), '2019-11-01 23:59:00', 0, 3, NOW(), NULL, NOW(), NULL, 1002150);"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_23}"
return=$?
if [ "$return" = "0" ];then
        echo "白条外部免息券【全部渠道】新增成功！！！"
else
        echo "白条外部免息券【全部渠道】新增失败！！！"
fi
;;

24)
coupon_24="INSERT INTO redpacket.tb_coupon (unique_business_id, phone, group_id, name, category, category_info, category_type, category_type_info, valid_start_date, valid_end_date, sms_reminder_on_invalid, status, created_at, used_at, updated_at, mark, uid)
VALUES
	(concat('BAITIAO201712271407402808bbcb4e2',$date), '$phone_no', 10000686, '商城免息券', 10, '{}', 5, '{\"discount\":50,\"type\":1,\"terms\":{\"3\":[1,2,3]}}', now(), '2028-01-20 23:59:59', 0, 2, now(), NULL, now(), NULL, 1002316);"
mysql -h${HOSTNAME} -p${PORT} -u${USERNAME} -p${PASSWORD}  ${DBNAME} -e"set names utf8; ${coupon_24}"
 return=$?
 if [ "$return" = "0" ];then
         echo "商城免息券新增成功！！！"
 else
         echo "商城免息券新增失败！！！"
 fi
 ;;

*)
echo "优惠券类型请输入1~24"
;;
esac
