From 76eff823484e36411c74b9ed97fb3b898397f921 Mon Sep 17 00:00:00 2001 From: hch <305670599@qq.com> Date: 星期四, 10 九月 2020 22:35:10 +0800 Subject: [PATCH] 0312 支持卡类型h开头的可重复领取 --- Tool/WebCenter/Coupon/config.ini | 2 Tool/WebCenter/CouponCode/webapp.py | 62 +++++++++++++++++++++++++++---- 2 files changed, 55 insertions(+), 9 deletions(-) diff --git a/Tool/WebCenter/Coupon/config.ini b/Tool/WebCenter/Coupon/config.ini index c3ee9c4..93a4a56 100644 --- a/Tool/WebCenter/Coupon/config.ini +++ b/Tool/WebCenter/Coupon/config.ini @@ -43,7 +43,7 @@ ;礼包卡以邮件形式发放15天的领取期限 -;卡类型 开头字母做标识如 g1~999代表此卡只能使用一次; z开头代表固定码查看CommonCards +;卡类型 开头字母做标识如 g1~999代表此卡只能使用一次; z开头代表固定码查看CommonCards;h1~999代表h开头的卡号可重复使用 ; 物品格式 [[物品ID1,数量1], [物品ID2,数量2]] 默认绑定不提供配置 限制5个物品 diff --git a/Tool/WebCenter/CouponCode/webapp.py b/Tool/WebCenter/CouponCode/webapp.py index fcb4389..6902198 100644 --- a/Tool/WebCenter/CouponCode/webapp.py +++ b/Tool/WebCenter/CouponCode/webapp.py @@ -130,13 +130,8 @@ if not codeStr: return + #鍙槸鐢ㄦ潵鎷兼帴璐﹀彿 spID = dataDict.get("spid", "") - if not spID: - tdict = {"jisugame":"jisu", 'spxjgame':'sipu', 'mrgame':'maoer', - "jisugameios":"jisu", 'spyxxjios':'sipu', 'mrgameios':'maoer'} - - # 娌′紶鐨勮瘽榛樿鍜宎ppid涓�鏍� - spID = tdict.get(agentName, agentName) accid = dataDict.get("accid", "") if not accid: @@ -210,8 +205,59 @@ SendDataCollectorBillInfo(wxdata, pushurl, operateID) return - - #-----------鎵归噺鍏戞崲鐮佸鐞�---------------------- + #-----------鎵归噺鍏戞崲鐮佸鐞嗭紝鍚岀被鍨嬪彲閲嶅棰嗗彇---------------------- + if codeStr.startswith('h'): + result, data = dbController.find_one(CouponDB.CouponCodeColName + "_" + agentName, {"code":codeStr, "channel":agentName}) + + if not data: + #鏃犳鍗� + gmresult['status'] = 0 + mylog.debug("no card") + return SendGm(gmresult, pushurl) + if int(data['status']) == 1: + #宸蹭娇鐢紝鍚屽崱鍙疯褰曢粯璁ゅ彲鐢紝閬垮厤鏂嚎鍙戦�佸け璐ョ殑鎯呭喌锛堟湭杩斿洖缁撴灉楠岃瘉鎯呭喌涓嬶級 + gmresult['status'] = 2 + mylog.debug("card used!") + return SendGm(gmresult, pushurl) + + result, data2 = dbController.find_one(CouponDB.CouponBatchColName, {"couponid":data["couponid"]}) + if not data2: + #姝ゆ壒娆″崱宸插垹闄� + gmresult['status'] = 0 + mylog.debug("no couponid") + return SendGm(gmresult, pushurl) + if int(data2['status']) == 1: + #鏆傚仠浣跨敤璇ユ壒娆″崱 + gmresult['status'] = 0 + mylog.debug("couponid frozed") + return SendGm(gmresult, pushurl) + if (data2["minserverno"] != 0 and data2["maxserverno"] != 0): + if int(data2["minserverno"]) > sid or int(data2["maxserverno"]) < sid: + #涓嶅湪鎸囧畾鍖� + gmresult['status'] = 0 + mylog.debug("no sid") + return SendGm(gmresult, pushurl) + if data2["expiretime"] != "" and datetime.datetime.today() > GetDateTimeByStr(data2["expiretime"]): + #宸茶繃鏈� + gmresult['status'] = 0 + mylog.debug("time pass") + return SendGm(gmresult, pushurl) + + #鍙噸澶嶉鍙栧垯涓嶉獙璇佸悓鎵规鍗� + data['status'] = 1 + data['accid'] = accid + data['usetime'] = str(datetime.datetime.today()) + + dbController.update(CouponDB.CouponCodeColName + "_" + agentName, {"code":codeStr, "channel":agentName}, data) + # 0 涓嶅彲鐢紝1.鍙敤鍙戞斁濂栧姳 锛�2.宸蹭娇鐢� 3.鍚岀被鍨嬪崱涓嶈兘浣跨敤涓ゆ + gmresult['status'] = 1 + gmresult['code'] = codeStr + gmresult['coupontype'] = data["coupontype"] + + mylog.debug("card ok!") + return SendGm(gmresult, pushurl) + + #-----------鎵归噺鍏戞崲鐮佸鐞嗭紝鍚岀被鍨嬪彧棰嗗彇涓�娆�---------------------- result, data = dbController.find_one(CouponDB.CouponCodeColName + "_" + agentName, {"code":codeStr, "channel":agentName}) if not data: -- Gitblit v1.8.0