9584 【越南】【yn_1.0.1】兑换码增加前缀(卡类型配置增加配置项Prefix配置固定前缀)
3个文件已修改
44 ■■■■ 已修改文件
Tool/WebCenter/Coupon/CodeMail.json 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tool/WebCenter/Coupon/webapp.py 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tool/WebCenter/CouponCode/webapp.py 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tool/WebCenter/Coupon/CodeMail.json
@@ -12,6 +12,15 @@
        "MailSender": "系统邮件",
        "MailTitle": "<gcode>历史累计返利活动",
        "MailText": "累积充值1000元返利,感谢您对游戏的支持,请及时领取礼包。",
        "Items": [[1015,1],[15177,2],[1128,2]]
        "Items": [[1015,1],[15177,2],[1128,2]],
        "Prefix":"CuuThien"
    },
    "h001": {
        "MailSender": "Hệ thống thư",
        "MailTitle": "<gcode>gói quà h001",
        "MailText": "Cảm ơn bạn đã hỗ trợ các trò chơi, xin vui lòng nhận được gói quà h001",
        "Items": [[1015,10],[15177,20],[1128,20]],
        "Prefix":"CuuThien"
    }
}
Tool/WebCenter/Coupon/webapp.py
@@ -57,9 +57,12 @@
               2:"CodeRewardSys3", #  兑换码已使用过
               3:"CodeRewardSys4",  # 同类型兑换码只能使用一次
         }
# 发放奖励邮件内容json,utf8编码
f = open(os.getcwd() + "\\..\\Coupon\\CodeMail.json", "r")
MailJson = eval(f.read())
f.close()
myapp = Bottle()
#申请礼包卡批次
@@ -78,7 +81,14 @@
        mylog.debug("no couponType")
        return json.dumps({"error":"param couponType"}, ensure_ascii=False)
    
    if not ConfigIO.HasSection(couponType):
    prefix = "" # 固定前缀
    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 +140,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') 
Tool/WebCenter/CouponCode/webapp.py
@@ -272,7 +272,8 @@
        #已使用,同卡号记录默认可用,避免断线发送失败的情况(未返回结果验证情况下)
        mylog.debug("card used!")
        return SendGm(ErrCode_Used, gmresult, pushurl)
    couponType = data["coupontype"]
    commCheckStatus = CommCheck(dataDict, data["coupontype"])
    if commCheckStatus != None:
        return SendGm(commCheckStatus, gmresult, pushurl)
@@ -296,8 +297,16 @@
        mylog.debug("time pass")
        return SendGm(ErrCode_Invalid, gmresult, pushurl)
    
    prefix = "" # 固定前缀
    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")
    # h 开头的卡类型可重复使用
    if not codeStr.startswith('h'):
    if not codeStr.startswith(prefix + 'h'):
        #再查一次是否用过此批次的其他卡, 
        result, data3 = dbController.find_one(CouponDB.CouponCodeColName + "_" + agentName, \
                                              {"coupontype":data["coupontype"], "accid":accid})