From e74b2fdd8a052d7c40adfeab9b881d7cb2cc8369 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 18 十二月 2024 15:41:47 +0800
Subject: [PATCH] 10297 【越南】【英语】【砍树】【tqxbqy】轮回殿-服务端(增加GM命令: Lunhui)

---
 Tool/WebCenter/Coupon/webapp.py |   33 ++++++++++++++++++++++++++++-----
 1 files changed, 28 insertions(+), 5 deletions(-)

diff --git a/Tool/WebCenter/Coupon/webapp.py b/Tool/WebCenter/Coupon/webapp.py
index ac1a331..d9e0f25 100644
--- a/Tool/WebCenter/Coupon/webapp.py
+++ b/Tool/WebCenter/Coupon/webapp.py
@@ -57,9 +57,23 @@
                2:"CodeRewardSys3", #  鍏戞崲鐮佸凡浣跨敤杩�
                3:"CodeRewardSys4",  # 鍚岀被鍨嬪厬鎹㈢爜鍙兘浣跨敤涓�娆�
          }
-                
-                
-                
+
+# 鍙戞斁濂栧姳閭欢鍐呭json锛寀tf8缂栫爜
+g_mailJsonDict = {} # {channel:MailJson, ...}
+# 鍙戞斁濂栧姳閭欢鍐呭json锛寀tf8缂栫爜
+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
+
 myapp = Bottle()
 
 #鐢宠绀煎寘鍗℃壒娆�
@@ -78,7 +92,15 @@
         mylog.debug("no couponType")
         return json.dumps({"error":"param couponType"}, ensure_ascii=False)
     
-    if not ConfigIO.HasSection(couponType):
+    prefix = "" # 鍥哄畾鍓嶇紑
+    MailJson = GetMailJson(appid)
+    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 +152,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') 
@@ -367,3 +389,4 @@
     mylog.debug("鎻掑叆鎴愬姛%s鏉¤鍗�"%len(tmpCodeList))
    
     return json.dumps({orderID:codeList}, ensure_ascii=False)
+

--
Gitblit v1.8.0