From d9551e6c5009ceea34dd1983981c3fd1fc1cee45 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期六, 28 九月 2024 15:36:39 +0800 Subject: [PATCH] 5416 【工具】兑换码优化(兑换码邮件内容文件json支持不同的appID独立文件配置;) --- Tool/WebCenter/CouponCode/webapp.py | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Tool/WebCenter/CouponCode/webapp.py b/Tool/WebCenter/CouponCode/webapp.py index 7ebc83e..ae9894f 100644 --- a/Tool/WebCenter/CouponCode/webapp.py +++ b/Tool/WebCenter/CouponCode/webapp.py @@ -49,10 +49,20 @@ PushTimeout = ConfigIO.GetInt("Coupon", "PushTimeout", 5) CommonCards = eval(ConfigIO.GetValue("Coupon", "CommonCards")) +g_mailJsonDict = {} # {channel:MailJson, ...} # 鍙戞斁濂栧姳閭欢鍐呭json锛寀tf8缂栫爜 -f = open(os.getcwd() + "\\..\\Coupon\\CodeMail.json", "r") -MailJson = eval(f.read()) -f.close() +def GetMailJson(channel): + global g_mailJsonDict + if channel in g_mailJsonDict: + return g_mailJsonDict[channel] + jsonPath = os.getcwd() + ("\\..\\Coupon\\CodeMail_%s.json" % channel) + if not os.path.isfile(jsonPath): + jsonPath = os.getcwd() + "\\..\\Coupon\\CodeMail.json" + f = open(jsonPath, "r") + MailJson = eval(f.read()) + f.close() + g_mailJsonDict[channel] = MailJson + return MailJson # 绀煎寘浣跨敤杩斿洖缁撴灉鐮佸畾涔� ErrCode_OK = 0 # 鎴愬姛锛岄潪0鐨勭爜鍧囦唬琛ㄩ敊璇� @@ -305,6 +315,7 @@ return SendGm(ErrCode_Invalid, gmresult, pushurl)[1] prefix = "" # 鍥哄畾鍓嶇紑 + MailJson = GetMailJson(agentName) if couponType in MailJson: mailInfo = MailJson[couponType] prefix = mailInfo.get("Prefix", "") @@ -340,6 +351,7 @@ def CommCheck(dataDict, coupontype): ## 閫氱敤甯歌妫�鏌� + MailJson = GetMailJson(dataDict.get("channel", "")) if coupontype in MailJson: mailInfo = MailJson[coupontype] lvLimit = mailInfo.get("LV", 0) @@ -390,6 +402,7 @@ return errcode, CouponCodeResponse(errcode) coupontype = gmresult["coupontype"] + MailJson = GetMailJson(gmresult["channel"]) if coupontype in MailJson: mailInfo = MailJson[coupontype] mailTitle = mailInfo.get("MailTitle", "MailTitle") -- Gitblit v1.8.0