hxp
2025-01-09 c5731326acc36a3cfc6870ddb51ce2cc86e2cdc5
Tool/WebCenter/Coupon/webapp.py
@@ -57,9 +57,23 @@
               2:"CodeRewardSys3", #  兑换码已使用过
               3:"CodeRewardSys4",  # 同类型兑换码只能使用一次
         }
# 发放奖励邮件内容json,utf8编码
g_mailJsonDict = {} # {channel:MailJson, ...}
# 发放奖励邮件内容json,utf8编码
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)   # 若只选中一个则代表只有单服使用
@@ -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,10 +389,4 @@
    mylog.debug("插入成功%s条订单"%len(tmpCodeList))
   
    return json.dumps({orderID:codeList}, ensure_ascii=False)
# 查询审核时间
@myapp.route('/auditdate.php')
def QueryAuditdate():
    return "2021-06-22 11:30:00"