From d91cb485e7189c046ab1def0baebc117ee16df26 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期五, 17 六月 2022 19:11:01 +0800 Subject: [PATCH] 9584 【越南】【yn_1.0.1】兑换码增加前缀(卡类型配置增加配置项Prefix配置固定前缀) --- Tool/WebCenter/Coupon/CodeMail.json | 11 ++++++++++- Tool/WebCenter/Coupon/webapp.py | 20 +++++++++++++++----- Tool/WebCenter/CouponCode/webapp.py | 13 +++++++++++-- 3 files changed, 36 insertions(+), 8 deletions(-) diff --git a/Tool/WebCenter/Coupon/CodeMail.json b/Tool/WebCenter/Coupon/CodeMail.json index 717f3e8..78698d2 100644 --- a/Tool/WebCenter/Coupon/CodeMail.json +++ b/Tool/WebCenter/Coupon/CodeMail.json @@ -12,6 +12,15 @@ "MailSender": "绯荤粺閭欢", "MailTitle": "<gcode>鍘嗗彶绱杩斿埄娲诲姩", "MailText": "绱Н鍏呭��1000鍏冭繑鍒�,鎰熻阿鎮ㄥ娓告垙鐨勬敮鎸侊紝璇峰強鏃堕鍙栫ぜ鍖呫��", - "Items": [[1015,1],[15177,2],[1128,2]] + "Items": [[1015,1],[15177,2],[1128,2]], + "Prefix":"CuuThien" + }, + + "h001": { + "MailSender": "H峄� th峄憂g th瓢", + "MailTitle": "<gcode>g贸i qu脿 h001", + "MailText": "C岷 啤n b岷 膽茫 h峄� tr峄� c谩c tr貌 ch啤i, xin vui l貌ng nh岷璶 膽瓢峄 g贸i qu脿 h001", + "Items": [[1015,10],[15177,20],[1128,20]], + "Prefix":"CuuThien" } } \ No newline at end of file diff --git a/Tool/WebCenter/Coupon/webapp.py b/Tool/WebCenter/Coupon/webapp.py index 0030943..fbec1d6 100644 --- a/Tool/WebCenter/Coupon/webapp.py +++ b/Tool/WebCenter/Coupon/webapp.py @@ -57,9 +57,12 @@ 2:"CodeRewardSys3", # 鍏戞崲鐮佸凡浣跨敤杩� 3:"CodeRewardSys4", # 鍚岀被鍨嬪厬鎹㈢爜鍙兘浣跨敤涓�娆� } - - - + +# 鍙戞斁濂栧姳閭欢鍐呭json锛寀tf8缂栫爜 +f = open(os.getcwd() + "\\..\\Coupon\\CodeMail.json", "r") +MailJson = eval(f.read()) +f.close() + myapp = Bottle() #鐢宠绀煎寘鍗℃壒娆� @@ -78,7 +81,14 @@ mylog.debug("no couponType") return json.dumps({"error":"param couponType"}, ensure_ascii=False) - if not ConfigIO.HasSection(couponType): + prefix = "" # 鍥哄畾鍓嶇紑 + if couponType in MailJson: + mailInfo = MailJson[couponType] + prefix = mailInfo.get("Prefix", "") + elif ConfigIO.HasSection(couponType): + if ConfigIO.HasOption(couponType, "Prefix"): + prefix = ConfigIO.GetValue(couponType, "Prefix") + else: return json.dumps({"error":"no couponType"}, ensure_ascii=False) minSNo = CommFunc.ToIntDef(dataDict.get("minserverno", 0), 0) # 鑻ュ彧閫変腑涓�涓垯浠h〃鍙湁鍗曟湇浣跨敤 @@ -130,7 +140,7 @@ for i in xrange(amount): tmpCodeDoc = {} # 鍓�3浣嶄负绫诲瀷鏍囪瘑 - tmpCodeDoc['code'] = tmpDict["coupontype"][0] + md5.md5(tmpDict['channel'] + str(tmpDict['createtime']) + str(i) + \ + tmpCodeDoc['code'] = prefix + tmpDict["coupontype"][0] + md5.md5(tmpDict['channel'] + str(tmpDict['createtime']) + str(i) + \ str(random.randint(1000, 2000000))).hexdigest()[2:14] + \ random.choice('1234567890abcdefghijklmnopqrstuvwxyz') +\ random.choice('1234567890abcdefghijklmnopqrstuvwxyz') diff --git a/Tool/WebCenter/CouponCode/webapp.py b/Tool/WebCenter/CouponCode/webapp.py index 2628699..b151357 100644 --- a/Tool/WebCenter/CouponCode/webapp.py +++ b/Tool/WebCenter/CouponCode/webapp.py @@ -272,7 +272,8 @@ #宸蹭娇鐢紝鍚屽崱鍙疯褰曢粯璁ゅ彲鐢紝閬垮厤鏂嚎鍙戦�佸け璐ョ殑鎯呭喌锛堟湭杩斿洖缁撴灉楠岃瘉鎯呭喌涓嬶級 mylog.debug("card used!") return SendGm(ErrCode_Used, gmresult, pushurl) - + + couponType = data["coupontype"] commCheckStatus = CommCheck(dataDict, data["coupontype"]) if commCheckStatus != None: return SendGm(commCheckStatus, gmresult, pushurl) @@ -296,8 +297,16 @@ mylog.debug("time pass") return SendGm(ErrCode_Invalid, gmresult, pushurl) + prefix = "" # 鍥哄畾鍓嶇紑 + if couponType in MailJson: + mailInfo = MailJson[couponType] + prefix = mailInfo.get("Prefix", "") + elif ConfigIO.HasSection(couponType): + if ConfigIO.HasOption(couponType, "Prefix"): + prefix = ConfigIO.GetValue(couponType, "Prefix") + # h 寮�澶寸殑鍗$被鍨嬪彲閲嶅浣跨敤 - if not codeStr.startswith('h'): + if not codeStr.startswith(prefix + 'h'): #鍐嶆煡涓�娆℃槸鍚︾敤杩囨鎵规鐨勫叾浠栧崱, result, data3 = dbController.find_one(CouponDB.CouponCodeColName + "_" + agentName, \ {"coupontype":data["coupontype"], "accid":accid}) -- Gitblit v1.8.0