From 2dfc680268c2f362eea6fc366341cd40c8387a9c Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期一, 11 十一月 2024 14:56:37 +0800 Subject: [PATCH] 5416 【工具】兑换码优化(兑换码邮件内容文件json支持不同的appID独立文件配置;) --- Tool/WebCenter/CouponCode/webapp.py | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-) diff --git a/Tool/WebCenter/CouponCode/webapp.py b/Tool/WebCenter/CouponCode/webapp.py index ae9894f..c827426 100644 --- a/Tool/WebCenter/CouponCode/webapp.py +++ b/Tool/WebCenter/CouponCode/webapp.py @@ -314,17 +314,22 @@ mylog.debug("time pass") return SendGm(ErrCode_Invalid, gmresult, pushurl)[1] + maxUseCount = 0 # -1-鏃犻檺锛�0鎴�1-榛樿1娆★紱 >1-闄愬埗娆℃暟锛� 娌℃湁閰嶇疆鐨勯粯璁�0鍗抽粯璁�1娆� prefix = "" # 鍥哄畾鍓嶇紑 MailJson = GetMailJson(agentName) if couponType in MailJson: mailInfo = MailJson[couponType] prefix = mailInfo.get("Prefix", "") + maxUseCount = CommFunc.ToIntDef(mailInfo.get("MaxUseCount", 0)) elif ConfigIO.HasSection(couponType): if ConfigIO.HasOption(couponType, "Prefix"): prefix = ConfigIO.GetValue(couponType, "Prefix") + maxUseCount = ConfigIO.GetInt(couponType, "MaxUseCount") # h 寮�澶寸殑鍗$被鍨嬪彲閲嶅浣跨敤 - if not codeStr.startswith(prefix + 'h'): + #if not codeStr.startswith(prefix + 'h'): + #淇敼涓烘寜閰嶇疆鏈�澶ф鏁板垽鏂嵆鍙� + if maxUseCount in [0, 1]: #鍐嶆煡涓�娆℃槸鍚︾敤杩囨鎵规鐨勫叾浠栧崱, result, data3 = dbController.find_one(CouponDB.CouponCodeColName + "_" + agentName, \ {"coupontype":data["coupontype"], "accid":accid}) @@ -334,6 +339,13 @@ gmresult['code'] = codeStr mylog.debug("use again") return SendGm(ErrCode_TypeUsed, gmresult, pushurl)[1] + elif maxUseCount > 1: + result, resultList = dbController.find(CouponDB.CouponCodeColName + "_" + agentName, {"coupontype":data["coupontype"], "accid":accid}, {"code":1}) + if not result or len(resultList) >= maxUseCount: + gmresult['coupontype'] = data["coupontype"] + gmresult['code'] = codeStr + mylog.debug("use maxUseCount limit. %s" % maxUseCount) + return SendGm(ErrCode_TypeUsed, gmresult, pushurl)[1] data['status'] = 1 data['accid'] = accid -- Gitblit v1.8.0