9823 9265【主干】【小7】【骨折】跨服云购修改
| | |
| | | list ServerIDRangeList; //活动的账号服务器ID范围列表 [[serverIDA, serverIDB], ...]
|
| | | char StartDate; //开启日期
|
| | | char EndDate; //结束日期
|
| | | list StartTimeList; //开启时间列表, 支持多个时段
|
| | | list EndTimeList; //结束时间列表, 支持多个时段
|
| | | list RoundMaxList; //开启轮次列表
|
| | | WORD LVLimit; //限制等级
|
| | | list TemplateIDList; //模板ID列表
|
| | | };
|
| | |
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagGCLuckyCloudBuyRoundTime(Structure):
|
| | | StartTime = "" #(char StartTime[5])// 开始时间 H:M
|
| | | EndtTime = "" #(char EndtTime[5])// 结束时间 H:M
|
| | | RoundMax = 0 #(BYTE RoundMax)// 本时段最大轮次
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | self.StartTime,_pos = CommFunc.ReadString(_lpData, _pos,5)
|
| | | self.EndtTime,_pos = CommFunc.ReadString(_lpData, _pos,5)
|
| | | self.RoundMax,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.StartTime = ""
|
| | | self.EndtTime = ""
|
| | | self.RoundMax = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += 5
|
| | | length += 5
|
| | | length += 1
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, 5, self.StartTime)
|
| | | data = CommFunc.WriteString(data, 5, self.EndtTime)
|
| | | data = CommFunc.WriteBYTE(data, self.RoundMax)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | StartTime:%s,
|
| | | EndtTime:%s,
|
| | | RoundMax:%d
|
| | | '''\
|
| | | %(
|
| | | self.StartTime,
|
| | | self.EndtTime,
|
| | | self.RoundMax
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagGCLuckyCloudBuyRoundInfo(Structure):
|
| | | Head = tagHead()
|
| | | ZoneID = 0 #(BYTE ZoneID)// 所属分区ID
|
| | | StartDate = "" #(char StartDate[10])// 开始日期 y-m-d
|
| | | EndtDate = "" #(char EndtDate[10])// 结束日期 y-m-d
|
| | | RoundTimeCount = 0 #(BYTE RoundTimeCount)
|
| | | RoundTimeList = list() #(vector<tagGCLuckyCloudBuyRoundTime> RoundTimeList)//轮次时间段
|
| | | RoundID = 0 #(DWORD RoundID)// 轮次唯一ID标识,当收到的轮次ID变更时,前端需清空购买号码记录缓存
|
| | | RoundNum = 0 #(BYTE RoundNum)// 今日第几轮
|
| | | RoundNum = 0 #(BYTE RoundNum)// 当前时段第几轮
|
| | | SuperItemID = 0 #(DWORD SuperItemID)// 大奖物品ID
|
| | | SuperItemCount = 0 #(BYTE SuperItemCount)// 大奖物品个数
|
| | | SuperItemMoneyType = 0 #(BYTE SuperItemMoneyType)// 大奖价值货币类型
|
| | |
| | | self.ZoneID,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.StartDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
|
| | | self.EndtDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
|
| | | self.RoundTimeCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.RoundTimeCount):
|
| | | temRoundTimeList = tagGCLuckyCloudBuyRoundTime()
|
| | | _pos = temRoundTimeList.ReadData(_lpData, _pos)
|
| | | self.RoundTimeList.append(temRoundTimeList)
|
| | | self.RoundID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.RoundNum,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.SuperItemID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | |
| | | self.ZoneID = 0
|
| | | self.StartDate = ""
|
| | | self.EndtDate = ""
|
| | | self.RoundTimeCount = 0
|
| | | self.RoundTimeList = list()
|
| | | self.RoundID = 0
|
| | | self.RoundNum = 0
|
| | | self.SuperItemID = 0
|
| | |
| | | length += 1
|
| | | length += 10
|
| | | length += 10
|
| | | length += 1
|
| | | for i in range(self.RoundTimeCount):
|
| | | length += self.RoundTimeList[i].GetLength()
|
| | | length += 4
|
| | | length += 1
|
| | | length += 4
|
| | |
| | | data = CommFunc.WriteBYTE(data, self.ZoneID)
|
| | | data = CommFunc.WriteString(data, 10, self.StartDate)
|
| | | data = CommFunc.WriteString(data, 10, self.EndtDate)
|
| | | data = CommFunc.WriteBYTE(data, self.RoundTimeCount)
|
| | | for i in range(self.RoundTimeCount):
|
| | | data = CommFunc.WriteString(data, self.RoundTimeList[i].GetLength(), self.RoundTimeList[i].GetBuffer())
|
| | | data = CommFunc.WriteDWORD(data, self.RoundID)
|
| | | data = CommFunc.WriteBYTE(data, self.RoundNum)
|
| | | data = CommFunc.WriteDWORD(data, self.SuperItemID)
|
| | |
| | | ZoneID:%d,
|
| | | StartDate:%s,
|
| | | EndtDate:%s,
|
| | | RoundTimeCount:%d,
|
| | | RoundTimeList:%s,
|
| | | RoundID:%d,
|
| | | RoundNum:%d,
|
| | | SuperItemID:%d,
|
| | |
| | | self.ZoneID,
|
| | | self.StartDate,
|
| | | self.EndtDate,
|
| | | self.RoundTimeCount,
|
| | | "...",
|
| | | self.RoundID,
|
| | | self.RoundNum,
|
| | | self.SuperItemID,
|
| | |
| | | for cfgID, actInfoDict in curActInfoDict.items():
|
| | | if not actInfoDict[ShareDefine.ActKey_State]:
|
| | | continue
|
| | | CrossLuckyCloudBuy.DoStartNewRoundLuckyCloudBuy(cfgID, 1)
|
| | | CrossLuckyCloudBuy.DoStartNewRoundLuckyCloudBuy(cfgID, True)
|
| | |
|
| | | # 添加云购记录
|
| | | elif value1 == 1:
|
| | |
| | | curDateTime = datetime.datetime.strptime("%d-%d-%d %d:%d:00" % (curDateTime.year, curDateTime.month, curDateTime.day,
|
| | | curDateTime.hour, curDateTime.minute), ChConfig.TYPE_Time_Format)
|
| | | actChangeList = []
|
| | | actStateChangeList = []
|
| | | sysnCrossActInfoDict = {}
|
| | | for actName in ShareDefine.CrossActNameList:
|
| | | if actName not in actTimeInfoDict or actName not in crossActInfoDict or actName not in actCfgIDInfoDict:
|
| | |
| | | continue
|
| | | ipyData, startList, endList, notifyDict = timeInfoDict[cfgID]
|
| | |
|
| | | isEnd = True
|
| | | state = 0 # 默认关闭
|
| | | cfgID = ipyData.GetCfgID()
|
| | | groupName = ipyData.GetActGroupName()
|
| | |
| | | if startDateTime <= curDateTime < endDateTime:
|
| | | state = dIndex + 1 # 也是代表第几个时间段
|
| | | break
|
| | | if endList:
|
| | | isEnd = (curDateTime >= endList[-1])
|
| | |
|
| | | serverIDRangeList = actInfoDict.get(ShareDefine.ActKey_ServerIDRangeList)
|
| | | # 全服广播提示信息
|
| | |
| | | if not isReload and dbState == state and dbActID == actID and not forceReset:
|
| | | #已经是这个状态了
|
| | | continue
|
| | | GameWorld.Log("跨服运营活动状态: actName=%s,cfgID=%s,groupName=%s,zoneID=%s,dbState=%s -> state=%s, dbActID=%s -> actID=%s,forceReset=%s" |
| | | % (actName, cfgID, groupName, zoneID, dbState, state, dbActID, actID, forceReset))
|
| | | GameWorld.Log("跨服运营活动状态: actName=%s,cfgID=%s,groupName=%s,zoneID=%s,dbState=%s -> state=%s,isEnd=%s, dbActID=%s -> actID=%s,forceReset=%s" |
| | | % (actName, cfgID, groupName, zoneID, dbState, state, isEnd, dbActID, actID, forceReset))
|
| | |
|
| | | # 更新状态
|
| | | actInfoDict[ShareDefine.ActKey_State] = state
|
| | |
| | | else:
|
| | | actChangeList.append([actName, ipyData, state, cfgID, groupName, zoneID, dbActID, actID, forceReset, dbTemplateID])
|
| | |
|
| | | # 活动ID变更强制视为状态变更,防止维护前后状态一样,但其实活动ID已经不同的情况会导致无法触发状态变更
|
| | | actIDChange = True
|
| | | actStateChangeList.append([actName, ipyData, dbState, state, cfgID, groupName, zoneID, actIDChange, dbTemplateID])
|
| | | |
| | | elif dbState != state:
|
| | | actIDChange = False
|
| | | GameWorld.Log(" 活动状态变更: actName=%s,cfgID=%s,groupName=%s,zoneID=%s,dbState=%s -> state=%s,actIDChange=%s,dbTemplateID=%s" |
| | | % (actName, cfgID, groupName, zoneID, dbState, state, actIDChange, dbTemplateID))
|
| | | actStateChangeList.append([actName, ipyData, dbState, state, cfgID, groupName, zoneID, actIDChange, dbTemplateID])
|
| | | |
| | | # 非活动中的处理完关闭后,最后删除
|
| | | if not state:
|
| | | if not state and isEnd:
|
| | | del crossActInfoDict[actName][cfgID]
|
| | | if not crossActInfoDict[actName]:
|
| | | del crossActInfoDict[actName]
|
| | | #GameWorld.Log(" 移除结束的活动: actName=%s,cfgID=%s,crossActInfoDict=%s" % (actName, cfgID, crossActInfoDict))
|
| | | GameWorld.Log(" 移除结束的活动: actName=%s,cfgID=%s,crossActInfoDict=%s" % (actName, cfgID, crossActInfoDict))
|
| | |
|
| | | # 同步子服务器
|
| | | if sysnCrossActInfoDict:
|
| | |
| | | GameWorld.Log(" 活动ID变更: actName=%s,cfgID=%s,groupName=%s,zoneID=%s,dbActID=%s -> actID=%s,forceReset=%s,dbTemplateID=%s"
|
| | | % (actName, cfgID, groupName, zoneID, dbActID, actID, forceReset, dbTemplateID))
|
| | |
|
| | | if actName == ShareDefine.CrossActName_LuckyCloudBuy:
|
| | | import CrossLuckyCloudBuy
|
| | | CrossLuckyCloudBuy.OnLuckyCloudBuyReset(ipyData, state)
|
| | | elif actName == ShareDefine.CrossActName_AllRecharge:
|
| | | if actName == ShareDefine.CrossActName_AllRecharge:
|
| | | import CrossActAllRecharge
|
| | | CrossActAllRecharge.OnActIDChange(ipyData, state)
|
| | |
|
| | | for changeInfo in actStateChangeList:
|
| | | actName, ipyData, dbState, state, cfgID, groupName, zoneID, actIDChange, dbTemplateID = changeInfo
|
| | | GameWorld.Log(" 活动状态变更: actName=%s,cfgID=%s,groupName=%s,zoneID=%s,dbState=%s -> state=%s,actIDChange=%s,dbTemplateID=%s" |
| | | % (actName, cfgID, groupName, zoneID, dbState, state, actIDChange, dbTemplateID))
|
| | | |
| | | if actName == ShareDefine.CrossActName_LuckyCloudBuy:
|
| | | import CrossLuckyCloudBuy
|
| | | CrossLuckyCloudBuy.OnLuckyCloudBuyStateChange(ipyData, actIDChange, state)
|
| | | |
| | | return
|
| | |
|
| | | def Sync_CrossActInfoToClientServer(serverGroupID=0):
|
| | |
| | | % (lotteryRec.lotteryNum, crossServerTime, GameWorld.ChangeTimeNumToStr(crossServerTime),
|
| | | lotteryRec.lotteryTime, GameWorld.ChangeTimeNumToStr(lotteryRec.lotteryTime), passTime, MaxTime))
|
| | |
|
| | | if not GameWorld.IsCrossServer():
|
| | | return
|
| | | |
| | | maxBuyCount = IpyGameDataPY.GetFuncCfg("LuckyCloudBuySet", 2)
|
| | | doLotteryBuyCountPer = IpyGameDataPY.GetFuncCfg("LuckyCloudBuySet", 3)
|
| | | doLotteryBuyCount = int(math.ceil(maxBuyCount * doLotteryBuyCountPer / 100.0))
|
| | | |
| | | zoneLotteryInfo = {}
|
| | | for zoneID, lotteryRecList in PyGameData.g_luckyCloudBuyLotteryDict.items():
|
| | | if not lotteryRecList:
|
| | | continue
|
| | | lastLotteryRec = lotteryRecList[-1] # 取最后一个为最新一期
|
| | | cfgID = lastLotteryRec.cfgID
|
| | | if lastLotteryRec.lotteryNum:
|
| | | GameWorld.Log("OnDay已开奖进入新一天第一轮! cfgID=%s,zoneID=%s" % (cfgID, zoneID))
|
| | | DoStartNewRoundLuckyCloudBuy(cfgID, 1)
|
| | | continue
|
| | | buyRecList = PyGameData.g_luckyCloudBuyNumDict.get(zoneID, [])
|
| | | buyCount = len(buyRecList)
|
| | | if len(buyRecList) >= doLotteryBuyCount:
|
| | | GameWorld.Log("OnDay未开奖但购买份数超过开奖保底份数! cfgID=%s,zoneID=%s,buyCount=%s >= %s" % (cfgID, zoneID, buyCount, doLotteryBuyCount))
|
| | | DoLuckyCloudBuyLottery(lastLotteryRec, True, "OnDay")
|
| | | continue
|
| | | |
| | | GameWorld.Log("已购买份数不足开奖保底份数,重置为新一天的第一轮! cfgID=%s,zoneID=%s,buyCount=%s < %s" % (cfgID, zoneID, buyCount, doLotteryBuyCount))
|
| | | lastLotteryRec.roundNum = 1
|
| | | dataDict = {"Type":"ResetRound"}
|
| | | dataDict.update(lastLotteryRec.GetString())
|
| | | DataRecordPack.SendEventPack("LuckyCloudBuyLottery", dataDict)
|
| | | zoneLotteryInfo[zoneID] = [lastLotteryRec.GetString()]
|
| | | |
| | | # 广播子服轮次信息变更
|
| | | if zoneLotteryInfo:
|
| | | dataMsg = {"syncType":"Update", "zoneLotteryInfo":zoneLotteryInfo}
|
| | | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_LuckyCloudBuyLottery, dataMsg)
|
| | | return
|
| | |
|
| | | def DoLuckyCloudBuyLottery(lotteryRec, resetRound=False, sign=""):
|
| | |
| | | dataMsg = {"syncType":"Update", "zoneLotteryInfo":zoneLotteryInfo}
|
| | | CrossRealmMsg.SendMsgToClientServer(ShareDefine.CrossServerMsg_LuckyCloudBuyLottery, dataMsg)
|
| | |
|
| | | actInfoDict = CrossActionControl.GetCrossActInfoByCfgID(ShareDefine.CrossActName_LuckyCloudBuy, cfgID)
|
| | | if not actInfoDict or not actInfoDict[ShareDefine.ActKey_State]:
|
| | | GameWorld.Log(" 不在活动中了,不开下一轮! cfgID=%s" % cfgID)
|
| | | return
|
| | | |
| | | if roundNum >= IpyGameDataPY.GetFuncCfg("LuckyCloudBuySet", 1):
|
| | | GameWorld.Log(" 当日已达每日云购轮数上限,不开下一轮! roundNum=%s" % roundNum)
|
| | | return
|
| | | |
| | | nextRoundNum = 1 if resetRound else (roundNum + 1)
|
| | | GameWorld.Log("幸运云购开启下一轮! cfgID=%s,zoneID=%s,roundNum=%s,resetRound=%s,nextRoundNum=%s" |
| | | % (cfgID, zoneID, roundNum, resetRound, nextRoundNum))
|
| | | # 开始下一轮
|
| | | return DoStartNewRoundLuckyCloudBuy(cfgID, nextRoundNum)
|
| | | return DoStartNewRoundLuckyCloudBuy(cfgID, resetRound, roundNum)
|
| | |
|
| | | def GetMailBuyNums(buyNumList):
|
| | | buyNumList.sort()
|
| | |
| | |
|
| | | return buyNums
|
| | |
|
| | | def OnLuckyCloudBuyReset(ipyData, state):
|
| | | ## 云购重置
|
| | | def OnLuckyCloudBuyStateChange(ipyData, actIDChange, state):
|
| | | ## 云购状态变更
|
| | | |
| | | cfgID = ipyData.GetCfgID()
|
| | | zoneID = ipyData.GetZoneID()
|
| | |
|
| | | startNewLottery = False
|
| | | lotteryRecList = PyGameData.g_luckyCloudBuyLotteryDict.get(zoneID, [])
|
| | | lastLotteryRec = None if not lotteryRecList else lotteryRecList[-1]
|
| | | # 最后一场未开奖
|
| | | if lastLotteryRec and not lastLotteryRec.lotteryNum:
|
| | | buyRecList = PyGameData.g_luckyCloudBuyNumDict.get(zoneID, [])
|
| | | if buyRecList:
|
| | |
| | | if popLotteryRec:
|
| | | GameWorld.Log("移除无效轮次信息 %s" % popLotteryRec.GetString())
|
| | |
|
| | | # 变更为活动中且未开启新轮次
|
| | | if state and not startNewLottery:
|
| | | GameWorld.Log("幸运云购重置,当前没有未开奖的轮次,直接开启新一轮! cfgID=%s,zoneID=%s" % (cfgID, zoneID))
|
| | | DoStartNewRoundLuckyCloudBuy(cfgID, 1)
|
| | | GameWorld.Log("幸运云购重置,当前没有未开奖的轮次,直接开启新一轮! cfgID=%s,zoneID=%s,state=%s" % (cfgID, zoneID, state))
|
| | | DoStartNewRoundLuckyCloudBuy(cfgID, True)
|
| | |
|
| | | return
|
| | |
|
| | | def DoStartNewRoundLuckyCloudBuy(cfgID, roundNum):
|
| | | def DoStartNewRoundLuckyCloudBuy(cfgID, resetRound, roundNum=0):
|
| | | # 开启新一轮云购
|
| | |
|
| | | actInfoDict = CrossActionControl.GetCrossActInfoByCfgID(ShareDefine.CrossActName_LuckyCloudBuy, cfgID)
|
| | | if not actInfoDict or not actInfoDict[ShareDefine.ActKey_State]:
|
| | | GameWorld.ErrLog("幸运云购非活动中,无法开启! cfgID=%s, roundNum=%s" % (cfgID, roundNum))
|
| | | GameWorld.ErrLog("幸运云购非活动中,无法开启新轮次! cfgID=%s, roundNum=%s" % (cfgID, roundNum))
|
| | | return
|
| | | state = actInfoDict[ShareDefine.ActKey_State]
|
| | |
|
| | | actIpyData = IpyGameDataPY.GetIpyGameData("CrossActLuckyCloudBuy", cfgID)
|
| | | if not actIpyData:
|
| | | return
|
| | | zoneID = actIpyData.GetZoneID()
|
| | | serverIDRangeList = actIpyData.GetServerIDRangeList()
|
| | | roundMaxList = actIpyData.GetRoundMaxList()
|
| | | templateIDList = actIpyData.GetTemplateIDList()
|
| | | if not templateIDList:
|
| | | if not roundMaxList or not templateIDList:
|
| | | return
|
| | |
|
| | | dayIndex = actInfoDict.get(ShareDefine.ActKey_DayIndex, 0)
|
| | | templateID = templateIDList[dayIndex] if len(templateIDList) > dayIndex else templateIDList[-1]
|
| | | sIndex = state - 1
|
| | | roundMax = roundMaxList[sIndex] if len(roundMaxList) > sIndex else roundMaxList[-1]
|
| | | if not resetRound and roundMax and roundNum >= roundMax:
|
| | | GameWorld.Log(" 已达云购轮数上限,不开下一轮! cfgID=%s,state=%s,roundNum=%s" % (cfgID, state, roundNum))
|
| | | return
|
| | | |
| | | templateID = templateIDList[sIndex] if len(templateIDList) > sIndex else templateIDList[-1]
|
| | | templateIpyData = IpyGameDataPY.GetIpyGameData("CrossActLuckyCloudBuyTemplate", templateID)
|
| | | if not templateIpyData:
|
| | | return
|
| | |
|
| | | if resetRound:
|
| | | nextRoundNum = 1
|
| | | else:
|
| | | nextRoundNum = roundNum + 1
|
| | | |
| | | superItemWeightInfo = templateIpyData.GetSuperItemWeightInfo()
|
| | | superItemInfo = GameWorld.GetResultByWeightList(superItemWeightInfo)
|
| | | if not superItemInfo or len(superItemInfo) < 3:
|
| | | GameWorld.ErrLog("幸运云购生成大奖失败! zoneID=%s,roundNum=%s,superItemInfo=%s" % (zoneID, roundNum, superItemInfo))
|
| | | GameWorld.ErrLog("幸运云购生成大奖失败! cfgID=%s,zoneID=%s,nextRoundNum=%s,superItemInfo=%s" % (cfgID, zoneID, nextRoundNum, superItemInfo))
|
| | | return
|
| | |
|
| | | lotteryRec = LuckyCloudBuyLottery()
|
| | | lotteryRec.idTime = int(time.time())
|
| | | lotteryRec.cfgID = cfgID
|
| | | lotteryRec.zoneID = zoneID
|
| | | lotteryRec.roundNum = roundNum
|
| | | lotteryRec.roundNum = nextRoundNum
|
| | |
|
| | | lotteryRec.serverIDRangeList = serverIDRangeList
|
| | | lotteryRec.superItemInfo = superItemInfo
|
| | |
| | | lotteryRecList = PyGameData.g_luckyCloudBuyLotteryDict[zoneID]
|
| | | lotteryRecList.append(lotteryRec)
|
| | |
|
| | | PyGameData.g_luckyCloudBuyNumDict[zoneID] = [] # 新一轮情况购买记录
|
| | | PyGameData.g_luckyCloudBuyNumDict[zoneID] = [] # 新一轮清空购买记录
|
| | |
|
| | | dataDict = {"Type":"NewRound"}
|
| | | dataDict.update(lotteryRec.GetString())
|
| | | DataRecordPack.SendEventPack("LuckyCloudBuyLottery", dataDict)
|
| | | GameWorld.Log("幸运云购开启新轮次! cfgID=%s,zoneID=%s,state=%s,nextRoundNum=%s,superItemInfo=%s" % (cfgID, zoneID, state, nextRoundNum, superItemInfo))
|
| | |
|
| | | # 广播子服开奖信息
|
| | | zoneLotteryInfo = {zoneID:[lotteryRec.GetString()]}
|
| | |
| | | actInfo = CrossActionControl.GetCrossActInfoByServerGroupID(ShareDefine.CrossActName_LuckyCloudBuy, serverGroupID)
|
| | | if not actInfo:
|
| | | return
|
| | | state = actInfo.get(ShareDefine.ActKey_State)
|
| | | #state = actInfo.get(ShareDefine.ActKey_State)
|
| | | ipyDataInfo = actInfo.get(ShareDefine.ActKey_IpyDataInfo)
|
| | | if not state or not ipyDataInfo:
|
| | | if not ipyDataInfo:
|
| | | return
|
| | | zoneID = ipyDataInfo.get("ZoneID")
|
| | | if not zoneID:
|
| | |
| | | if not lotteryRec:
|
| | | return
|
| | |
|
| | | roundTimeList = []
|
| | | StartTimeList = ipyDataInfo.get("StartTimeList")
|
| | | EndTimeList = ipyDataInfo.get("EndTimeList")
|
| | | RoundMaxList = ipyDataInfo.get("RoundMaxList")
|
| | | for i, startTime in enumerate(StartTimeList):
|
| | | roundTime = ChPyNetSendPack.tagGCLuckyCloudBuyRoundTime()
|
| | | roundTime.StartTime = startTime
|
| | | roundTime.EndtTime = EndTimeList[i] if len(EndTimeList) > i else ""
|
| | | roundTime.RoundMax = RoundMaxList[i] if len(RoundMaxList) > i else 0
|
| | | roundTimeList.append(roundTime)
|
| | | |
| | | superItemInfo = lotteryRec.superItemInfo + [0, 0, 0, 0, 0]
|
| | | superItemID, superItemCount, _, moneyType, moneyValue = superItemInfo[:5]
|
| | | clientPack = ChPyNetSendPack.tagGCLuckyCloudBuyRoundInfo()
|
| | |
| | | clientPack.StartDate = ipyDataInfo.get("StartDate", "")
|
| | | clientPack.EndtDate = ipyDataInfo.get("EndDate", "")
|
| | | clientPack.LVLimit = ipyDataInfo.get("LVLimit", 0)
|
| | | clientPack.RoundTimeList = roundTimeList
|
| | | clientPack.RoundTimeCount = len(clientPack.RoundTimeList)
|
| | | clientPack.RoundID = lotteryRec.idTime
|
| | | clientPack.RoundNum = lotteryRec.roundNum
|
| | | clientPack.SuperItemID = superItemID
|
| | |
| | | ("list", "ServerIDRangeList", 0),
|
| | | ("char", "StartDate", 0),
|
| | | ("char", "EndDate", 0),
|
| | | ("list", "StartTimeList", 0),
|
| | | ("list", "EndTimeList", 0),
|
| | | ("list", "RoundMaxList", 0),
|
| | | ("WORD", "LVLimit", 0),
|
| | | ("list", "TemplateIDList", 0),
|
| | | ),
|
| | |
| | | self.ServerIDRangeList = []
|
| | | self.StartDate = ""
|
| | | self.EndDate = ""
|
| | | self.StartTimeList = []
|
| | | self.EndTimeList = []
|
| | | self.RoundMaxList = []
|
| | | self.LVLimit = 0
|
| | | self.TemplateIDList = [] |
| | | return |
| | |
| | | def GetServerIDRangeList(self): return self.ServerIDRangeList # 活动的账号服务器ID范围列表 [[serverIDA, serverIDB], ...]
|
| | | def GetStartDate(self): return self.StartDate # 开启日期
|
| | | def GetEndDate(self): return self.EndDate # 结束日期
|
| | | def GetStartTimeList(self): return self.StartTimeList # 开启时间列表, 支持多个时段
|
| | | def GetEndTimeList(self): return self.EndTimeList # 结束时间列表, 支持多个时段
|
| | | def GetRoundMaxList(self): return self.RoundMaxList # 开启轮次列表
|
| | | def GetLVLimit(self): return self.LVLimit # 限制等级
|
| | | def GetTemplateIDList(self): return self.TemplateIDList # 模板ID列表 |
| | | |
| | |
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagGCLuckyCloudBuyRoundTime(Structure):
|
| | | StartTime = "" #(char StartTime[5])// 开始时间 H:M
|
| | | EndtTime = "" #(char EndtTime[5])// 结束时间 H:M
|
| | | RoundMax = 0 #(BYTE RoundMax)// 本时段最大轮次
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | self.StartTime,_pos = CommFunc.ReadString(_lpData, _pos,5)
|
| | | self.EndtTime,_pos = CommFunc.ReadString(_lpData, _pos,5)
|
| | | self.RoundMax,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.StartTime = ""
|
| | | self.EndtTime = ""
|
| | | self.RoundMax = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += 5
|
| | | length += 5
|
| | | length += 1
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, 5, self.StartTime)
|
| | | data = CommFunc.WriteString(data, 5, self.EndtTime)
|
| | | data = CommFunc.WriteBYTE(data, self.RoundMax)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | StartTime:%s,
|
| | | EndtTime:%s,
|
| | | RoundMax:%d
|
| | | '''\
|
| | | %(
|
| | | self.StartTime,
|
| | | self.EndtTime,
|
| | | self.RoundMax
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagGCLuckyCloudBuyRoundInfo(Structure):
|
| | | Head = tagHead()
|
| | | ZoneID = 0 #(BYTE ZoneID)// 所属分区ID
|
| | | StartDate = "" #(char StartDate[10])// 开始日期 y-m-d
|
| | | EndtDate = "" #(char EndtDate[10])// 结束日期 y-m-d
|
| | | RoundTimeCount = 0 #(BYTE RoundTimeCount)
|
| | | RoundTimeList = list() #(vector<tagGCLuckyCloudBuyRoundTime> RoundTimeList)//轮次时间段
|
| | | RoundID = 0 #(DWORD RoundID)// 轮次唯一ID标识,当收到的轮次ID变更时,前端需清空购买号码记录缓存
|
| | | RoundNum = 0 #(BYTE RoundNum)// 今日第几轮
|
| | | RoundNum = 0 #(BYTE RoundNum)// 当前时段第几轮
|
| | | SuperItemID = 0 #(DWORD SuperItemID)// 大奖物品ID
|
| | | SuperItemCount = 0 #(BYTE SuperItemCount)// 大奖物品个数
|
| | | SuperItemMoneyType = 0 #(BYTE SuperItemMoneyType)// 大奖价值货币类型
|
| | |
| | | self.ZoneID,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.StartDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
|
| | | self.EndtDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
|
| | | self.RoundTimeCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.RoundTimeCount):
|
| | | temRoundTimeList = tagGCLuckyCloudBuyRoundTime()
|
| | | _pos = temRoundTimeList.ReadData(_lpData, _pos)
|
| | | self.RoundTimeList.append(temRoundTimeList)
|
| | | self.RoundID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.RoundNum,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.SuperItemID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | |
| | | self.ZoneID = 0
|
| | | self.StartDate = ""
|
| | | self.EndtDate = ""
|
| | | self.RoundTimeCount = 0
|
| | | self.RoundTimeList = list()
|
| | | self.RoundID = 0
|
| | | self.RoundNum = 0
|
| | | self.SuperItemID = 0
|
| | |
| | | length += 1
|
| | | length += 10
|
| | | length += 10
|
| | | length += 1
|
| | | for i in range(self.RoundTimeCount):
|
| | | length += self.RoundTimeList[i].GetLength()
|
| | | length += 4
|
| | | length += 1
|
| | | length += 4
|
| | |
| | | data = CommFunc.WriteBYTE(data, self.ZoneID)
|
| | | data = CommFunc.WriteString(data, 10, self.StartDate)
|
| | | data = CommFunc.WriteString(data, 10, self.EndtDate)
|
| | | data = CommFunc.WriteBYTE(data, self.RoundTimeCount)
|
| | | for i in range(self.RoundTimeCount):
|
| | | data = CommFunc.WriteString(data, self.RoundTimeList[i].GetLength(), self.RoundTimeList[i].GetBuffer())
|
| | | data = CommFunc.WriteDWORD(data, self.RoundID)
|
| | | data = CommFunc.WriteBYTE(data, self.RoundNum)
|
| | | data = CommFunc.WriteDWORD(data, self.SuperItemID)
|
| | |
| | | ZoneID:%d,
|
| | | StartDate:%s,
|
| | | EndtDate:%s,
|
| | | RoundTimeCount:%d,
|
| | | RoundTimeList:%s,
|
| | | RoundID:%d,
|
| | | RoundNum:%d,
|
| | | SuperItemID:%d,
|
| | |
| | | self.ZoneID,
|
| | | self.StartDate,
|
| | | self.EndtDate,
|
| | | self.RoundTimeCount,
|
| | | "...",
|
| | | self.RoundID,
|
| | | self.RoundNum,
|
| | | self.SuperItemID,
|