hch
2020-09-10 76eff823484e36411c74b9ed97fb3b898397f921
0312 支持卡类型h开头的可重复领取
2个文件已修改
62 ■■■■ 已修改文件
Tool/WebCenter/Coupon/config.ini 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tool/WebCenter/CouponCode/webapp.py 60 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Tool/WebCenter/Coupon/config.ini
@@ -43,7 +43,7 @@
;礼包卡以邮件形式发放15天的领取期限
;卡类型 开头字母做标识如 g1~999代表此卡只能使用一次; z开头代表固定码查看CommonCards
;卡类型 开头字母做标识如 g1~999代表此卡只能使用一次; z开头代表固定码查看CommonCards;h1~999代表h开头的卡号可重复使用
; 物品格式 [[物品ID1,数量1], [物品ID2,数量2]] 默认绑定不提供配置 限制5个物品
Tool/WebCenter/CouponCode/webapp.py
@@ -130,13 +130,8 @@
    if not codeStr:
        return
    
    #只是用来拼接账号
    spID = dataDict.get("spid", "")
    if not spID:
        tdict = {"jisugame":"jisu", 'spxjgame':'sipu', 'mrgame':'maoer',
                 "jisugameios":"jisu", 'spyxxjios':'sipu', 'mrgameios':'maoer'}
        # 没传的话默认和appid一样
        spID = tdict.get(agentName, agentName)
        
    accid = dataDict.get("accid", "")
    if not accid:
@@ -210,8 +205,59 @@
            SendDataCollectorBillInfo(wxdata, pushurl, operateID)
        return 
    
    #-----------批量兑换码处理,同类型可重复领取----------------------
    if codeStr.startswith('h'):
        result, data = dbController.find_one(CouponDB.CouponCodeColName + "_" + agentName, {"code":codeStr, "channel":agentName})
    
    #-----------批量兑换码处理----------------------
        if not data:
            #无此卡
            gmresult['status'] = 0
            mylog.debug("no card")
            return SendGm(gmresult, pushurl)
        if int(data['status']) == 1:
            #已使用,同卡号记录默认可用,避免断线发送失败的情况(未返回结果验证情况下)
            gmresult['status'] = 2
            mylog.debug("card used!")
            return SendGm(gmresult, pushurl)
        result, data2 = dbController.find_one(CouponDB.CouponBatchColName, {"couponid":data["couponid"]})
        if not data2:
            #此批次卡已删除
            gmresult['status'] = 0
            mylog.debug("no couponid")
            return SendGm(gmresult, pushurl)
        if int(data2['status']) == 1:
            #暂停使用该批次卡
            gmresult['status'] = 0
            mylog.debug("couponid frozed")
            return SendGm(gmresult, pushurl)
        if (data2["minserverno"] != 0 and data2["maxserverno"] != 0):
            if int(data2["minserverno"]) > sid or int(data2["maxserverno"]) < sid:
                #不在指定区
                gmresult['status'] = 0
                mylog.debug("no sid")
                return SendGm(gmresult, pushurl)
        if data2["expiretime"] != "" and datetime.datetime.today() > GetDateTimeByStr(data2["expiretime"]):
            #已过期
            gmresult['status'] = 0
            mylog.debug("time pass")
            return SendGm(gmresult, pushurl)
        #可重复领取则不验证同批次卡
        data['status'] = 1
        data['accid'] = accid
        data['usetime'] = str(datetime.datetime.today())
        dbController.update(CouponDB.CouponCodeColName + "_" + agentName, {"code":codeStr, "channel":agentName}, data)
        # 0 不可用,1.可用发放奖励 ,2.已使用 3.同类型卡不能使用两次
        gmresult['status'] = 1
        gmresult['code'] = codeStr
        gmresult['coupontype'] = data["coupontype"]
        mylog.debug("card ok!")
        return SendGm(gmresult, pushurl)
    #-----------批量兑换码处理,同类型只领取一次----------------------
    result, data = dbController.find_one(CouponDB.CouponCodeColName + "_" + agentName, {"code":codeStr, "channel":agentName})
    if not data: