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/Coupon/config.ini | 3 +++
Tool/WebCenter/Coupon/CodeMail.json | 3 ++-
Tool/WebCenter/CouponCode/webapp.py | 14 +++++++++++++-
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/Tool/WebCenter/Coupon/CodeMail.json b/Tool/WebCenter/Coupon/CodeMail.json
index 78698d2..0782c79 100644
--- a/Tool/WebCenter/Coupon/CodeMail.json
+++ b/Tool/WebCenter/Coupon/CodeMail.json
@@ -21,6 +21,7 @@
"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"
+ "Prefix":"CuuThien",
+ "MaxUseCount":-1
}
}
\ No newline at end of file
diff --git a/Tool/WebCenter/Coupon/config.ini b/Tool/WebCenter/Coupon/config.ini
index 0dab403..ab3e7d9 100644
--- a/Tool/WebCenter/Coupon/config.ini
+++ b/Tool/WebCenter/Coupon/config.ini
@@ -49,6 +49,9 @@
;卡类型 开头字母做标识如 g1~999代表此卡只能使用一次; z开头代表固定码查看CommonCards;h1~999代表h开头的卡号可重复使用
; 物品格式 [[物品ID1,数量1], [物品ID2,数量2]] 默认绑定不提供配置 限制5个物品
+;类型卡使用次数新规则:废弃原h开头可重复使用逻辑,改为配置 MaxUseCount 指定最大可使用次数,
+;没有配置或配0或配1默认1次,大于1代表具体次数,-1代表不限次数
+;MaxUseCount=10
[g001]
MailSender=系统邮件
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