| | |
| | | # GM端口
|
| | | PushPort = ConfigIO.GetValue("Coupon", "PushPort")
|
| | | PushKey = ConfigIO.GetValue("Coupon", "PushKey")
|
| | | CommonCards = eval(ConfigIO.GetValue("Coupon", "CommonCards"))
|
| | | |
| | | |
| | |
|
| | | Def_CardMsg = {
|
| | | 0:"CodeRewardSys2", # 兑换码无效
|
| | | 1: "CodeRewardSys1", # 兑换卡奖励已发至邮件
|
| | | 2:"CodeRewardSys3", # 兑换码已使用过
|
| | | 3:"CodeRewardSys4", # 同类型兑换码只能使用一次
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | # 发放奖励邮件内容json,utf8编码
|
| | | f = open(os.getcwd() + "\\..\\Coupon\\CodeMail.json", "r")
|
| | | MailJson = eval(f.read())
|
| | | f.close()
|
| | | |
| | | myapp = Bottle()
|
| | |
|
| | | #申请礼包卡批次
|
| | |
| | | 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) # 若只选中一个则代表只有单服使用
|
| | |
| | | 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')
|
| | |
| | | if not result:
|
| | | return json.dumps({"error":"insert card"}, ensure_ascii=False)
|
| | |
|
| | | mylog.debug("插入成功%s"%tmpCodeList)
|
| | | mylog.debug("插入成功%s条订单"%len(tmpCodeList))
|
| | |
|
| | | return json.dumps({orderID:codeList}, ensure_ascii=False)
|
| | |
|