| | |
| | | ('Gold', ctypes.c_ulong),
|
| | | ('GoldPaper', ctypes.c_ulong),
|
| | | ('Silver', ctypes.c_ulong),
|
| | | ('ServerID', ctypes.c_ulong),
|
| | | ('ADOResult', ctypes.c_ulong),
|
| | | ]
|
| | |
|
| | |
| | | self.Gold = 0
|
| | | self.GoldPaper = 0
|
| | | self.Silver = 0
|
| | | self.ServerID = 0
|
| | |
|
| | | def readData(self, buf, pos = 0, length = 0):
|
| | | if not pos <= length:
|
| | |
| | | self.Gold, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.GoldPaper, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.Silver, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.ServerID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | return self.getLength()
|
| | |
|
| | | def getBuffer(self):
|
| | |
| | | buf = CommFunc.WriteDWORD(buf, self.Gold)
|
| | | buf = CommFunc.WriteDWORD(buf, self.GoldPaper)
|
| | | buf = CommFunc.WriteDWORD(buf, self.Silver)
|
| | | buf = CommFunc.WriteDWORD(buf, self.ServerID)
|
| | | return buf
|
| | |
|
| | | def getLength(self):
|
| | |
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += self.TextLen
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | |
| | | rec[u'Gold'] = self.Gold
|
| | | rec[u'GoldPaper'] = self.GoldPaper
|
| | | rec[u'Silver'] = self.Silver
|
| | | rec[u'ServerID'] = self.ServerID
|
| | | return rec
|
| | |
|
| | | def readRecord(self, rec):
|
| | |
| | | self.Gold = rec.get(u'Gold', 0)
|
| | | self.GoldPaper = rec.get(u'GoldPaper', 0)
|
| | | self.Silver = rec.get(u'Silver', 0)
|
| | | self.ServerID = rec.get(u'ServerID', 0)
|
| | |
|
| | | #Can not implement adoLoadStr method:No key defined!
|
| | | #Can not implement adoInsertStr method:No key defined!
|
| | |
| | | Gold = %s,
|
| | | GoldPaper = %s,
|
| | | Silver = %s,
|
| | | ServerID = %s,
|
| | | ADOResult = %s,
|
| | | '''%(
|
| | | self.GUID,
|
| | |
| | | self.Gold,
|
| | | self.GoldPaper,
|
| | | self.Silver,
|
| | | self.ServerID,
|
| | | self.ADOResult,
|
| | | )
|
| | | return output
|
| | |
|
| | | def dumpString(self):
|
| | | output = '''%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s'''%(
|
| | | output = '''%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s'''%(
|
| | | self.GUID,
|
| | | self.CreateTime,
|
| | | self.LimitTime,
|
| | |
| | | self.Gold,
|
| | | self.GoldPaper,
|
| | | self.Silver,
|
| | | self.ServerID,
|
| | | )
|
| | | return output
|
| | |
|
| | |
| | | self.LimitTime = Str
|
| | | else:
|
| | | self.LimitTime = Str[:30]
|
| | | |
| | |
|
| | |
|
| | |
|
| | | #è¡¥å¿ç©å个人é¢å表 #tagDBPersonalCompensation
|
| | |
| | | else:
|
| | | self.GUID = Str[:40]
|
| | |
|
| | | |
| | | #ç©å®¶æ°æ®æ¥çç¼å表#tagPlayerViewCache
|
| | | class tagPlayerViewCache(Structure):
|
| | | _pack_ = 1
|
| | |
| | | self.PlusData,
|
| | | )
|
| | | return output
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
| | | self.Name = Str[:33]
|
| | |
|
| | |
|
| | | # è·¨æç«æåºPKæè¡æ¦ #tagDBCrossPKBillboard
|
| | | class tagDBCrossPKBillboard(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ('ZoneID', ctypes.c_ubyte),
|
| | | ('SeasonID', ctypes.c_ubyte),
|
| | | ('PlayerID', ctypes.c_ulong),
|
| | | ('PlayerName', ctypes.c_char * 33),
|
| | | ('Job', ctypes.c_ubyte),
|
| | | ('FightPower', ctypes.c_ulong),
|
| | | ('RealmLV', ctypes.c_ushort),
|
| | | ('PKScore', ctypes.c_ulong),
|
| | | ('DanLV', ctypes.c_ubyte),
|
| | | ('Time', ctypes.c_ulong),
|
| | | ('ADOResult', ctypes.c_ulong),
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | Structure.__init__(self)
|
| | | self.clear()
|
| | |
|
| | |
|
| | | def clear(self):
|
| | | memset(addressof(self), 0, self.getLength())
|
| | |
|
| | |
|
| | | def readData(self, buf, pos = 0, length = 0):
|
| | | if not pos <= length:
|
| | | msg = error.formatMsg('error', error.ERROR_NO_150, '(pos = %s)> (length = %s)'%(pos, length))
|
| | | mylog.error(msg)
|
| | | return -1
|
| | | if len(buf) < pos + self.getLength():
|
| | | msg = error.formatMsg('error', error.ERROR_NO_151, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength()))
|
| | | mylog.error(msg)
|
| | | return -1
|
| | | self.clear()
|
| | | memmove(addressof(self), buf[pos:], self.getLength())
|
| | | return self.getLength()
|
| | |
|
| | |
|
| | | def getBuffer(self):
|
| | | buf = create_string_buffer(self.getLength())
|
| | | memmove(addressof(buf), addressof(self), self.getLength())
|
| | | return string_at(addressof(buf), self.getLength())
|
| | |
|
| | | def getLength(self):
|
| | | return sizeof(tagDBCrossPKBillboard)
|
| | |
|
| | | def getRecord(self):
|
| | | '''ç»ç»åå¨è®°å½'''
|
| | | rec = {}
|
| | | rec[u'ZoneID'] = self.ZoneID
|
| | | rec[u'SeasonID'] = self.SeasonID
|
| | | rec[u'PlayerID'] = self.PlayerID
|
| | | rec[u'PlayerName'] = fix_incomingText(self.PlayerName)
|
| | | rec[u'Job'] = self.Job
|
| | | rec[u'FightPower'] = self.FightPower
|
| | | rec[u'RealmLV'] = self.RealmLV
|
| | | rec[u'PKScore'] = self.PKScore
|
| | | rec[u'DanLV'] = self.DanLV
|
| | | rec[u'Time'] = self.Time
|
| | | return rec
|
| | |
|
| | | def readRecord(self, rec):
|
| | | '''ç±äºMongoDBè¯»åºæ¥æ¯unicode,ææå符串éè¦è¿è¡è½¬æ¢'''
|
| | | self.ZoneID = rec.get(u'ZoneID', 0)
|
| | | self.SeasonID = rec.get(u'SeasonID', 0)
|
| | | self.PlayerID = rec.get(u'PlayerID', 0)
|
| | | self.PlayerName = fix_outgoingText(rec.get(u'PlayerName', u''))
|
| | | self.Job = rec.get(u'Job', 0)
|
| | | self.FightPower = rec.get(u'FightPower', 0)
|
| | | self.RealmLV = rec.get(u'RealmLV', 0)
|
| | | self.PKScore = rec.get(u'PKScore', 0)
|
| | | self.DanLV = rec.get(u'DanLV', 0)
|
| | | self.Time = rec.get(u'Time', 0)
|
| | |
|
| | | #Can not implement adoLoadStr method:No key defined!
|
| | | #Can not implement adoInsertStr method:No key defined!
|
| | | #Can not implement adoUpdateStr method:No key defined!
|
| | | #Can not implement adoUpdateStr method:No key defined!
|
| | | #Can not implement adoCheckUpdateStr method:No key defined!
|
| | | #Can not implement adoCheckUpdateExStr method:No key defined!
|
| | |
|
| | | def getAdoRecords(self, resultCollection):
|
| | | '''æ¥è¯¢ç»ææå
æäºè¿å¶æµ'''
|
| | | result = ''
|
| | | result = CommFunc.WriteDWORD(result, resultCollection.count())
|
| | | for rec in resultCollection:
|
| | | self.readRecord(rec)
|
| | | result += self.getBuffer()
|
| | | return result
|
| | |
|
| | | #Can not implement adoQueryIndexStr method:No key defined!
|
| | |
|
| | | def adoQueryCustom(self, collection, queryDict):
|
| | | '''èªå®ä¹æ¥è¯¢'''
|
| | | resultCollection = collection.find(queryDict)
|
| | |
|
| | | return self.getAdoRecords(resultCollection)
|
| | |
|
| | |
|
| | | def adoQueryAll(self, collection):
|
| | | '''æ¥è¯¢ææ''' |
| | | resultCollection = collection.find()
|
| | | |
| | | return self.getAdoRecords(resultCollection)
|
| | |
|
| | | #Can not implement adoDeleteByIndexStr method:No key defined!
|
| | | def outputString(self):
|
| | | output = '''// è·¨æç«æåºPKæè¡æ¦ #tagDBCrossPKBillboard:
|
| | | ZoneID = %s,
|
| | | SeasonID = %s,
|
| | | PlayerID = %s,
|
| | | PlayerName = %s,
|
| | | Job = %s,
|
| | | FightPower = %s,
|
| | | RealmLV = %s,
|
| | | PKScore = %s,
|
| | | DanLV = %s,
|
| | | Time = %s,
|
| | | ADOResult = %s,
|
| | | '''%(
|
| | | self.ZoneID,
|
| | | self.SeasonID,
|
| | | self.PlayerID,
|
| | | self.PlayerName,
|
| | | self.Job,
|
| | | self.FightPower,
|
| | | self.RealmLV,
|
| | | self.PKScore,
|
| | | self.DanLV,
|
| | | self.Time,
|
| | | self.ADOResult,
|
| | | )
|
| | | return output
|
| | |
|
| | | def dumpString(self):
|
| | | output = '''%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s'''%(
|
| | | self.ZoneID,
|
| | | self.SeasonID,
|
| | | self.PlayerID,
|
| | | self.PlayerName,
|
| | | self.Job,
|
| | | self.FightPower,
|
| | | self.RealmLV,
|
| | | self.PKScore,
|
| | | self.DanLV,
|
| | | self.Time,
|
| | | )
|
| | | return output
|
| | |
|
| | | #Charæ°ç»ç±»åSetæ¥å£,使ç¨è¯¥æ¥å£å¯¹æ¤ç±»åæ°æ®èµå¼ï¼é²æ¢èµå¼çæ°æ®è¿é¿æ¥é
|
| | | def SetPlayerName(self,Str):
|
| | | if len(Str)<=33:
|
| | | self.PlayerName = Str
|
| | | else:
|
| | | self.PlayerName = Str[:33]
|
| | | |
| | |
|
| | | # è·¨æç«æåºæªéç¥ç©å®¶çæ¯èµç»æè¡¨ #tagDBCrossPKUnNotifyOverInfo
|
| | | class tagDBCrossPKUnNotifyOverInfo(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ('ZoneID', ctypes.c_ubyte),
|
| | | ('SeasonID', ctypes.c_ubyte),
|
| | | ('RoomID', ctypes.c_ushort),
|
| | | ('TimeStr', ctypes.c_char * 19),
|
| | | ('OverType', ctypes.c_ubyte),
|
| | | ('PlayerID', ctypes.c_ulong),
|
| | | ('WinnerID', ctypes.c_ulong),
|
| | | ('RoundWinnerLen', ctypes.c_ubyte),
|
| | | ('RoundWinnerInfo', ctypes.c_char_p),
|
| | | ('PKScore', ctypes.c_ulong),
|
| | | ('DanLV', ctypes.c_ubyte),
|
| | | ('CWinCount', ctypes.c_ushort),
|
| | | ('AddScore', ctypes.c_ushort),
|
| | | ('TagPlayerID', ctypes.c_ulong),
|
| | | ('TagPlayerName', ctypes.c_char * 33),
|
| | | ('ADOResult', ctypes.c_ulong),
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | Structure.__init__(self)
|
| | | self.clear()
|
| | |
|
| | | def clear(self):
|
| | | self.ZoneID = 0
|
| | | self.SeasonID = 0
|
| | | self.RoomID = 0
|
| | | self.TimeStr = ''
|
| | | self.OverType = 0
|
| | | self.PlayerID = 0
|
| | | self.WinnerID = 0
|
| | | self.RoundWinnerLen = 0
|
| | | self.RoundWinnerInfo = ''
|
| | | self.PKScore = 0
|
| | | self.DanLV = 0
|
| | | self.CWinCount = 0
|
| | | self.AddScore = 0
|
| | | self.TagPlayerID = 0
|
| | | self.TagPlayerName = ''
|
| | |
|
| | | def readData(self, buf, pos = 0, length = 0):
|
| | | if not pos <= length:
|
| | | msg = error.formatMsg('error', error.ERROR_NO_148, '(pos = %s) > (length = %s)'%(pos, length))
|
| | | mylog.error(msg)
|
| | | return -1
|
| | | if len(buf) < pos + self.getLength():
|
| | | msg = error.formatMsg('error', error.ERROR_NO_149, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength()))
|
| | | mylog.error(msg)
|
| | | self.clear()
|
| | | self.ZoneID, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.SeasonID, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.RoomID, pos = CommFunc.ReadWORD(buf, pos)
|
| | | self.TimeStr, pos = CommFunc.ReadString(buf, pos, 19)
|
| | | self.OverType, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.PlayerID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.WinnerID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.RoundWinnerLen, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | tmp, pos = CommFunc.ReadString(buf, pos, self.RoundWinnerLen)
|
| | | self.RoundWinnerInfo = ctypes.c_char_p(tmp)
|
| | | self.PKScore, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.DanLV, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.CWinCount, pos = CommFunc.ReadWORD(buf, pos)
|
| | | self.AddScore, pos = CommFunc.ReadWORD(buf, pos)
|
| | | self.TagPlayerID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.TagPlayerName, pos = CommFunc.ReadString(buf, pos, 33)
|
| | | return self.getLength()
|
| | |
|
| | | def getBuffer(self):
|
| | | buf = ''
|
| | | buf = CommFunc.WriteBYTE(buf, self.ZoneID)
|
| | | buf = CommFunc.WriteBYTE(buf, self.SeasonID)
|
| | | buf = CommFunc.WriteWORD(buf, self.RoomID)
|
| | | buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 19, self.TimeStr)
|
| | | buf = CommFunc.WriteBYTE(buf, self.OverType)
|
| | | buf = CommFunc.WriteDWORD(buf, self.PlayerID)
|
| | | buf = CommFunc.WriteDWORD(buf, self.WinnerID)
|
| | | buf = CommFunc.WriteBYTE(buf, self.RoundWinnerLen)
|
| | | buf = CommFunc.WriteString(buf, self.RoundWinnerLen, self.RoundWinnerInfo)
|
| | | buf = CommFunc.WriteDWORD(buf, self.PKScore)
|
| | | buf = CommFunc.WriteBYTE(buf, self.DanLV)
|
| | | buf = CommFunc.WriteWORD(buf, self.CWinCount)
|
| | | buf = CommFunc.WriteWORD(buf, self.AddScore)
|
| | | buf = CommFunc.WriteDWORD(buf, self.TagPlayerID)
|
| | | buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 33, self.TagPlayerName)
|
| | | return buf
|
| | |
|
| | | def getLength(self):
|
| | | length = 0
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | length += sizeof(ctypes.c_char) * 19
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += self.RoundWinnerLen
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_char) * 33
|
| | | return length
|
| | |
|
| | | def getRecord(self):
|
| | | '''ç»ç»åå¨è®°å½'''
|
| | | rec = {}
|
| | | rec[u'ZoneID'] = self.ZoneID
|
| | | rec[u'SeasonID'] = self.SeasonID
|
| | | rec[u'RoomID'] = self.RoomID
|
| | | rec[u'TimeStr'] = fix_incomingText(self.TimeStr)
|
| | | rec[u'OverType'] = self.OverType
|
| | | rec[u'PlayerID'] = self.PlayerID
|
| | | rec[u'WinnerID'] = self.WinnerID
|
| | | rec[u'RoundWinnerLen'] = self.RoundWinnerLen
|
| | | rec[u'RoundWinnerInfo'] = fix_incomingText(self.RoundWinnerInfo)
|
| | | rec[u'PKScore'] = self.PKScore
|
| | | rec[u'DanLV'] = self.DanLV
|
| | | rec[u'CWinCount'] = self.CWinCount
|
| | | rec[u'AddScore'] = self.AddScore
|
| | | rec[u'TagPlayerID'] = self.TagPlayerID
|
| | | rec[u'TagPlayerName'] = fix_incomingText(self.TagPlayerName)
|
| | | return rec
|
| | |
|
| | | def readRecord(self, rec):
|
| | | '''ç±äºMongoDBè¯»åºæ¥æ¯unicode,ææå符串éè¦è¿è¡è½¬æ¢'''
|
| | | self.ZoneID = rec.get(u'ZoneID', 0)
|
| | | self.SeasonID = rec.get(u'SeasonID', 0)
|
| | | self.RoomID = rec.get(u'RoomID', 0)
|
| | | self.TimeStr = fix_outgoingText(rec.get(u'TimeStr', u''))
|
| | | self.OverType = rec.get(u'OverType', 0)
|
| | | self.PlayerID = rec.get(u'PlayerID', 0)
|
| | | self.WinnerID = rec.get(u'WinnerID', 0)
|
| | | self.RoundWinnerLen = rec.get(u'RoundWinnerLen', 0)
|
| | | self.RoundWinnerInfo = fix_outgoingText(rec.get(u'RoundWinnerInfo', u''))
|
| | | self.PKScore = rec.get(u'PKScore', 0)
|
| | | self.DanLV = rec.get(u'DanLV', 0)
|
| | | self.CWinCount = rec.get(u'CWinCount', 0)
|
| | | self.AddScore = rec.get(u'AddScore', 0)
|
| | | self.TagPlayerID = rec.get(u'TagPlayerID', 0)
|
| | | self.TagPlayerName = fix_outgoingText(rec.get(u'TagPlayerName', u''))
|
| | |
|
| | | #Can not implement adoLoadStr method:No key defined!
|
| | | #Can not implement adoInsertStr method:No key defined!
|
| | | #Can not implement adoUpdateStr method:No key defined!
|
| | | #Can not implement adoUpdateStr method:No key defined!
|
| | | #Can not implement adoCheckUpdateStr method:No key defined!
|
| | | #Can not implement adoCheckUpdateExStr method:No key defined!
|
| | |
|
| | | def getAdoRecords(self, resultCollection):
|
| | | '''æ¥è¯¢ç»ææå
æäºè¿å¶æµ'''
|
| | | result = ''
|
| | | result = CommFunc.WriteDWORD(result, resultCollection.count())
|
| | | for rec in resultCollection:
|
| | | self.readRecord(rec)
|
| | | result += self.getBuffer()
|
| | | return result
|
| | |
|
| | | #Can not implement adoQueryIndexStr method:No key defined!
|
| | |
|
| | | def adoQueryCustom(self, collection, queryDict):
|
| | | '''èªå®ä¹æ¥è¯¢'''
|
| | | resultCollection = collection.find(queryDict)
|
| | |
|
| | | return self.getAdoRecords(resultCollection)
|
| | |
|
| | |
|
| | | def adoQueryAll(self, collection):
|
| | | '''æ¥è¯¢ææ''' |
| | | resultCollection = collection.find()
|
| | | |
| | | return self.getAdoRecords(resultCollection)
|
| | |
|
| | | #Can not implement adoDeleteByIndexStr method:No key defined!
|
| | | def outputString(self):
|
| | | output = '''// è·¨æç«æåºæªéç¥ç©å®¶çæ¯èµç»æè¡¨ #tagDBCrossPKUnNotifyOverInfo:
|
| | | ZoneID = %s,
|
| | | SeasonID = %s,
|
| | | RoomID = %s,
|
| | | TimeStr = %s,
|
| | | OverType = %s,
|
| | | PlayerID = %s,
|
| | | WinnerID = %s,
|
| | | RoundWinnerLen = %s,
|
| | | RoundWinnerInfo = %s,
|
| | | PKScore = %s,
|
| | | DanLV = %s,
|
| | | CWinCount = %s,
|
| | | AddScore = %s,
|
| | | TagPlayerID = %s,
|
| | | TagPlayerName = %s,
|
| | | ADOResult = %s,
|
| | | '''%(
|
| | | self.ZoneID,
|
| | | self.SeasonID,
|
| | | self.RoomID,
|
| | | self.TimeStr,
|
| | | self.OverType,
|
| | | self.PlayerID,
|
| | | self.WinnerID,
|
| | | self.RoundWinnerLen,
|
| | | self.RoundWinnerInfo,
|
| | | self.PKScore,
|
| | | self.DanLV,
|
| | | self.CWinCount,
|
| | | self.AddScore,
|
| | | self.TagPlayerID,
|
| | | self.TagPlayerName,
|
| | | self.ADOResult,
|
| | | )
|
| | | return output
|
| | |
|
| | | def dumpString(self):
|
| | | output = '''%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s'''%(
|
| | | self.ZoneID,
|
| | | self.SeasonID,
|
| | | self.RoomID,
|
| | | self.TimeStr,
|
| | | self.OverType,
|
| | | self.PlayerID,
|
| | | self.WinnerID,
|
| | | self.RoundWinnerLen,
|
| | | self.RoundWinnerInfo,
|
| | | self.PKScore,
|
| | | self.DanLV,
|
| | | self.CWinCount,
|
| | | self.AddScore,
|
| | | self.TagPlayerID,
|
| | | self.TagPlayerName,
|
| | | )
|
| | | return output
|
| | |
|
| | | #Charæ°ç»ç±»åSetæ¥å£,使ç¨è¯¥æ¥å£å¯¹æ¤ç±»åæ°æ®èµå¼ï¼é²æ¢èµå¼çæ°æ®è¿é¿æ¥é
|
| | | def SetTimeStr(self,Str):
|
| | | if len(Str)<=19:
|
| | | self.TimeStr = Str
|
| | | else:
|
| | | self.TimeStr = Str[:19]
|
| | | |
| | | def SetTagPlayerName(self,Str):
|
| | | if len(Str)<=33:
|
| | | self.TagPlayerName = Str
|
| | | else:
|
| | | self.TagPlayerName = Str[:33]
|
| | | |
| | |
|
| | | # æåç©å表 #tagDBAuctionItem
|
| | | class tagDBAuctionItem(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ('ItemGUID', ctypes.c_char * 40),
|
| | | ('PlayerID', ctypes.c_ulong),
|
| | | ('FamilyID', ctypes.c_ulong),
|
| | | ('ItemID', ctypes.c_ulong),
|
| | | ('Count', ctypes.c_ushort),
|
| | | ('AuctionType', ctypes.c_ubyte),
|
| | | ('AddTime', ctypes.c_char * 19),
|
| | | ('BiddingTime', ctypes.c_char * 19),
|
| | | ('BidderID', ctypes.c_ulong),
|
| | | ('BidderName', ctypes.c_char * 33),
|
| | | ('BidderPrice', ctypes.c_ulong),
|
| | | ('ItemType', ctypes.c_ubyte),
|
| | | ('ItemJobLimit', ctypes.c_ubyte),
|
| | | ('ItemClassLV', ctypes.c_ubyte),
|
| | | ('UserDataLen', ctypes.c_ushort),
|
| | | ('UserData', ctypes.c_char_p),
|
| | | ('FamilyPlayerIDLen', ctypes.c_ushort),
|
| | | ('FamilyPlayerIDInfo', ctypes.c_char_p),
|
| | | ('BidderIDLen', ctypes.c_ubyte),
|
| | | ('BidderIDInfo', ctypes.c_char_p),
|
| | | ('ADOResult', ctypes.c_ulong),
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | Structure.__init__(self)
|
| | | self.clear()
|
| | |
|
| | | def clear(self):
|
| | | self.ItemGUID = ''
|
| | | self.PlayerID = 0
|
| | | self.FamilyID = 0
|
| | | self.ItemID = 0
|
| | | self.Count = 0
|
| | | self.AuctionType = 0
|
| | | self.AddTime = ''
|
| | | self.BiddingTime = ''
|
| | | self.BidderID = 0
|
| | | self.BidderName = ''
|
| | | self.BidderPrice = 0
|
| | | self.ItemType = 0
|
| | | self.ItemJobLimit = 0
|
| | | self.ItemClassLV = 0
|
| | | self.UserDataLen = 0
|
| | | self.UserData = ''
|
| | | self.FamilyPlayerIDLen = 0
|
| | | self.FamilyPlayerIDInfo = ''
|
| | | self.BidderIDLen = 0
|
| | | self.BidderIDInfo = ''
|
| | |
|
| | | def readData(self, buf, pos = 0, length = 0):
|
| | | if not pos <= length:
|
| | | msg = error.formatMsg('error', error.ERROR_NO_148, '(pos = %s) > (length = %s)'%(pos, length))
|
| | | mylog.error(msg)
|
| | | return -1
|
| | | if len(buf) < pos + self.getLength():
|
| | | msg = error.formatMsg('error', error.ERROR_NO_149, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength()))
|
| | | mylog.error(msg)
|
| | | self.clear()
|
| | | self.ItemGUID, pos = CommFunc.ReadString(buf, pos, 40)
|
| | | self.PlayerID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.FamilyID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.ItemID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.Count, pos = CommFunc.ReadWORD(buf, pos)
|
| | | self.AuctionType, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.AddTime, pos = CommFunc.ReadString(buf, pos, 19)
|
| | | self.BiddingTime, pos = CommFunc.ReadString(buf, pos, 19)
|
| | | self.BidderID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.BidderName, pos = CommFunc.ReadString(buf, pos, 33)
|
| | | self.BidderPrice, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.ItemType, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.ItemJobLimit, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.ItemClassLV, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.UserDataLen, pos = CommFunc.ReadWORD(buf, pos)
|
| | | tmp, pos = CommFunc.ReadString(buf, pos, self.UserDataLen)
|
| | | self.UserData = ctypes.c_char_p(tmp)
|
| | | self.FamilyPlayerIDLen, pos = CommFunc.ReadWORD(buf, pos)
|
| | | tmp, pos = CommFunc.ReadString(buf, pos, self.FamilyPlayerIDLen)
|
| | | self.FamilyPlayerIDInfo = ctypes.c_char_p(tmp)
|
| | | self.BidderIDLen, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | tmp, pos = CommFunc.ReadString(buf, pos, self.BidderIDLen)
|
| | | self.BidderIDInfo = ctypes.c_char_p(tmp)
|
| | | return self.getLength()
|
| | |
|
| | | def getBuffer(self):
|
| | | buf = ''
|
| | | buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 40, self.ItemGUID)
|
| | | buf = CommFunc.WriteDWORD(buf, self.PlayerID)
|
| | | buf = CommFunc.WriteDWORD(buf, self.FamilyID)
|
| | | buf = CommFunc.WriteDWORD(buf, self.ItemID)
|
| | | buf = CommFunc.WriteWORD(buf, self.Count)
|
| | | buf = CommFunc.WriteBYTE(buf, self.AuctionType)
|
| | | buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 19, self.AddTime)
|
| | | buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 19, self.BiddingTime)
|
| | | buf = CommFunc.WriteDWORD(buf, self.BidderID)
|
| | | buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 33, self.BidderName)
|
| | | buf = CommFunc.WriteDWORD(buf, self.BidderPrice)
|
| | | buf = CommFunc.WriteBYTE(buf, self.ItemType)
|
| | | buf = CommFunc.WriteBYTE(buf, self.ItemJobLimit)
|
| | | buf = CommFunc.WriteBYTE(buf, self.ItemClassLV)
|
| | | buf = CommFunc.WriteWORD(buf, self.UserDataLen)
|
| | | buf = CommFunc.WriteString(buf, self.UserDataLen, self.UserData)
|
| | | buf = CommFunc.WriteWORD(buf, self.FamilyPlayerIDLen)
|
| | | buf = CommFunc.WriteString(buf, self.FamilyPlayerIDLen, self.FamilyPlayerIDInfo)
|
| | | buf = CommFunc.WriteBYTE(buf, self.BidderIDLen)
|
| | | buf = CommFunc.WriteString(buf, self.BidderIDLen, self.BidderIDInfo)
|
| | | return buf
|
| | |
|
| | | def getLength(self):
|
| | | length = 0
|
| | | length += sizeof(ctypes.c_char) * 40
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += sizeof(ctypes.c_char) * 19
|
| | | length += sizeof(ctypes.c_char) * 19
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_char) * 33
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | length += self.UserDataLen
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | length += self.FamilyPlayerIDLen
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += self.BidderIDLen
|
| | | return length
|
| | |
|
| | | def getRecord(self):
|
| | | '''ç»ç»åå¨è®°å½'''
|
| | | rec = {}
|
| | | rec[u'ItemGUID'] = fix_incomingText(self.ItemGUID)
|
| | | rec[u'PlayerID'] = self.PlayerID
|
| | | rec[u'FamilyID'] = self.FamilyID
|
| | | rec[u'ItemID'] = self.ItemID
|
| | | rec[u'Count'] = self.Count
|
| | | rec[u'AuctionType'] = self.AuctionType
|
| | | rec[u'AddTime'] = fix_incomingText(self.AddTime)
|
| | | rec[u'BiddingTime'] = fix_incomingText(self.BiddingTime)
|
| | | rec[u'BidderID'] = self.BidderID
|
| | | rec[u'BidderName'] = fix_incomingText(self.BidderName)
|
| | | rec[u'BidderPrice'] = self.BidderPrice
|
| | | rec[u'ItemType'] = self.ItemType
|
| | | rec[u'ItemJobLimit'] = self.ItemJobLimit
|
| | | rec[u'ItemClassLV'] = self.ItemClassLV
|
| | | rec[u'UserDataLen'] = self.UserDataLen
|
| | | rec[u'UserData'] = fix_incomingText(self.UserData)
|
| | | rec[u'FamilyPlayerIDLen'] = self.FamilyPlayerIDLen
|
| | | rec[u'FamilyPlayerIDInfo'] = fix_incomingText(self.FamilyPlayerIDInfo)
|
| | | rec[u'BidderIDLen'] = self.BidderIDLen
|
| | | rec[u'BidderIDInfo'] = fix_incomingText(self.BidderIDInfo)
|
| | | return rec
|
| | |
|
| | | def readRecord(self, rec):
|
| | | '''ç±äºMongoDBè¯»åºæ¥æ¯unicode,ææå符串éè¦è¿è¡è½¬æ¢'''
|
| | | self.ItemGUID = fix_outgoingText(rec.get(u'ItemGUID', u''))
|
| | | self.PlayerID = rec.get(u'PlayerID', 0)
|
| | | self.FamilyID = rec.get(u'FamilyID', 0)
|
| | | self.ItemID = rec.get(u'ItemID', 0)
|
| | | self.Count = rec.get(u'Count', 0)
|
| | | self.AuctionType = rec.get(u'AuctionType', 0)
|
| | | self.AddTime = fix_outgoingText(rec.get(u'AddTime', u''))
|
| | | self.BiddingTime = fix_outgoingText(rec.get(u'BiddingTime', u''))
|
| | | self.BidderID = rec.get(u'BidderID', 0)
|
| | | self.BidderName = fix_outgoingText(rec.get(u'BidderName', u''))
|
| | | self.BidderPrice = rec.get(u'BidderPrice', 0)
|
| | | self.ItemType = rec.get(u'ItemType', 0)
|
| | | self.ItemJobLimit = rec.get(u'ItemJobLimit', 0)
|
| | | self.ItemClassLV = rec.get(u'ItemClassLV', 0)
|
| | | self.UserDataLen = rec.get(u'UserDataLen', 0)
|
| | | self.UserData = fix_outgoingText(rec.get(u'UserData', u''))
|
| | | self.FamilyPlayerIDLen = rec.get(u'FamilyPlayerIDLen', 0)
|
| | | self.FamilyPlayerIDInfo = fix_outgoingText(rec.get(u'FamilyPlayerIDInfo', u''))
|
| | | self.BidderIDLen = rec.get(u'BidderIDLen', 0)
|
| | | self.BidderIDInfo = fix_outgoingText(rec.get(u'BidderIDInfo', u''))
|
| | |
|
| | | #Can not implement adoLoadStr method:No key defined!
|
| | | #Can not implement adoInsertStr method:No key defined!
|
| | | #Can not implement adoUpdateStr method:No key defined!
|
| | | #Can not implement adoUpdateStr method:No key defined!
|
| | | #Can not implement adoCheckUpdateStr method:No key defined!
|
| | | #Can not implement adoCheckUpdateExStr method:No key defined!
|
| | |
|
| | | def getAdoRecords(self, resultCollection):
|
| | | '''æ¥è¯¢ç»ææå
æäºè¿å¶æµ'''
|
| | | result = ''
|
| | | result = CommFunc.WriteDWORD(result, resultCollection.count())
|
| | | for rec in resultCollection:
|
| | | self.readRecord(rec)
|
| | | result += self.getBuffer()
|
| | | return result
|
| | |
|
| | | #Can not implement adoQueryIndexStr method:No key defined!
|
| | |
|
| | | def adoQueryCustom(self, collection, queryDict):
|
| | | '''èªå®ä¹æ¥è¯¢'''
|
| | | resultCollection = collection.find(queryDict)
|
| | |
|
| | | return self.getAdoRecords(resultCollection)
|
| | |
|
| | |
|
| | | def adoQueryAll(self, collection):
|
| | | '''æ¥è¯¢ææ''' |
| | | resultCollection = collection.find()
|
| | | |
| | | return self.getAdoRecords(resultCollection)
|
| | |
|
| | | #Can not implement adoDeleteByIndexStr method:No key defined!
|
| | | def outputString(self):
|
| | | output = '''// æåç©å表 #tagDBAuctionItem:
|
| | | ItemGUID = %s,
|
| | | PlayerID = %s,
|
| | | FamilyID = %s,
|
| | | ItemID = %s,
|
| | | Count = %s,
|
| | | AuctionType = %s,
|
| | | AddTime = %s,
|
| | | BiddingTime = %s,
|
| | | BidderID = %s,
|
| | | BidderName = %s,
|
| | | BidderPrice = %s,
|
| | | ItemType = %s,
|
| | | ItemJobLimit = %s,
|
| | | ItemClassLV = %s,
|
| | | UserDataLen = %s,
|
| | | UserData = %s,
|
| | | FamilyPlayerIDLen = %s,
|
| | | FamilyPlayerIDInfo = %s,
|
| | | BidderIDLen = %s,
|
| | | BidderIDInfo = %s,
|
| | | ADOResult = %s,
|
| | | '''%(
|
| | | self.ItemGUID,
|
| | | self.PlayerID,
|
| | | self.FamilyID,
|
| | | self.ItemID,
|
| | | self.Count,
|
| | | self.AuctionType,
|
| | | self.AddTime,
|
| | | self.BiddingTime,
|
| | | self.BidderID,
|
| | | self.BidderName,
|
| | | self.BidderPrice,
|
| | | self.ItemType,
|
| | | self.ItemJobLimit,
|
| | | self.ItemClassLV,
|
| | | self.UserDataLen,
|
| | | self.UserData,
|
| | | self.FamilyPlayerIDLen,
|
| | | self.FamilyPlayerIDInfo,
|
| | | self.BidderIDLen,
|
| | | self.BidderIDInfo,
|
| | | self.ADOResult,
|
| | | )
|
| | | return output
|
| | |
|
| | | def dumpString(self):
|
| | | output = '''%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s'''%(
|
| | | self.ItemGUID,
|
| | | self.PlayerID,
|
| | | self.FamilyID,
|
| | | self.ItemID,
|
| | | self.Count,
|
| | | self.AuctionType,
|
| | | self.AddTime,
|
| | | self.BiddingTime,
|
| | | self.BidderID,
|
| | | self.BidderName,
|
| | | self.BidderPrice,
|
| | | self.ItemType,
|
| | | self.ItemJobLimit,
|
| | | self.ItemClassLV,
|
| | | self.UserDataLen,
|
| | | self.UserData,
|
| | | self.FamilyPlayerIDLen,
|
| | | self.FamilyPlayerIDInfo,
|
| | | self.BidderIDLen,
|
| | | self.BidderIDInfo,
|
| | | )
|
| | | return output
|
| | |
|
| | | #Charæ°ç»ç±»åSetæ¥å£,使ç¨è¯¥æ¥å£å¯¹æ¤ç±»åæ°æ®èµå¼ï¼é²æ¢èµå¼çæ°æ®è¿é¿æ¥é
|
| | | def SetItemGUID(self,Str):
|
| | | if len(Str)<=40:
|
| | | self.ItemGUID = Str
|
| | | else:
|
| | | self.ItemGUID = Str[:40]
|
| | | |
| | | def SetAddTime(self,Str):
|
| | | if len(Str)<=19:
|
| | | self.AddTime = Str
|
| | | else:
|
| | | self.AddTime = Str[:19]
|
| | | |
| | | def SetBiddingTime(self,Str):
|
| | | if len(Str)<=19:
|
| | | self.BiddingTime = Str
|
| | | else:
|
| | | self.BiddingTime = Str[:19]
|
| | | |
| | | def SetBidderName(self,Str):
|
| | | if len(Str)<=33:
|
| | | self.BidderName = Str
|
| | | else:
|
| | | self.BidderName = Str[:33]
|
| | | |
| | |
|
| | | # æåè®°å½è¡¨ #tagDBAuctionRecord
|
| | | class tagDBAuctionRecord(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ('ItemGUID', ctypes.c_char * 40),
|
| | | ('PlayerID', ctypes.c_ulong),
|
| | | ('FamilyID', ctypes.c_ulong),
|
| | | ('RecordType', ctypes.c_ubyte),
|
| | | ('RecordResult', ctypes.c_ubyte),
|
| | | ('RecordTime', ctypes.c_char * 19),
|
| | | ('BidderPrice', ctypes.c_ulong),
|
| | | ('BidderName', ctypes.c_char * 33),
|
| | | ('ItemID', ctypes.c_ulong),
|
| | | ('Count', ctypes.c_ushort),
|
| | | ('UserDataLen', ctypes.c_ushort),
|
| | | ('UserData', ctypes.c_char_p),
|
| | | ('ADOResult', ctypes.c_ulong),
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | Structure.__init__(self)
|
| | | self.clear()
|
| | |
|
| | | def clear(self):
|
| | | self.ItemGUID = ''
|
| | | self.PlayerID = 0
|
| | | self.FamilyID = 0
|
| | | self.RecordType = 0
|
| | | self.RecordResult = 0
|
| | | self.RecordTime = ''
|
| | | self.BidderPrice = 0
|
| | | self.BidderName = ''
|
| | | self.ItemID = 0
|
| | | self.Count = 0
|
| | | self.UserDataLen = 0
|
| | | self.UserData = ''
|
| | |
|
| | | def readData(self, buf, pos = 0, length = 0):
|
| | | if not pos <= length:
|
| | | msg = error.formatMsg('error', error.ERROR_NO_148, '(pos = %s) > (length = %s)'%(pos, length))
|
| | | mylog.error(msg)
|
| | | return -1
|
| | | if len(buf) < pos + self.getLength():
|
| | | msg = error.formatMsg('error', error.ERROR_NO_149, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength()))
|
| | | mylog.error(msg)
|
| | | self.clear()
|
| | | self.ItemGUID, pos = CommFunc.ReadString(buf, pos, 40)
|
| | | self.PlayerID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.FamilyID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.RecordType, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.RecordResult, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | self.RecordTime, pos = CommFunc.ReadString(buf, pos, 19)
|
| | | self.BidderPrice, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.BidderName, pos = CommFunc.ReadString(buf, pos, 33)
|
| | | self.ItemID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.Count, pos = CommFunc.ReadWORD(buf, pos)
|
| | | self.UserDataLen, pos = CommFunc.ReadWORD(buf, pos)
|
| | | tmp, pos = CommFunc.ReadString(buf, pos, self.UserDataLen)
|
| | | self.UserData = ctypes.c_char_p(tmp)
|
| | | return self.getLength()
|
| | |
|
| | | def getBuffer(self):
|
| | | buf = ''
|
| | | buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 40, self.ItemGUID)
|
| | | buf = CommFunc.WriteDWORD(buf, self.PlayerID)
|
| | | buf = CommFunc.WriteDWORD(buf, self.FamilyID)
|
| | | buf = CommFunc.WriteBYTE(buf, self.RecordType)
|
| | | buf = CommFunc.WriteBYTE(buf, self.RecordResult)
|
| | | buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 19, self.RecordTime)
|
| | | buf = CommFunc.WriteDWORD(buf, self.BidderPrice)
|
| | | buf = CommFunc.WriteString(buf, sizeof(ctypes.c_char) * 33, self.BidderName)
|
| | | buf = CommFunc.WriteDWORD(buf, self.ItemID)
|
| | | buf = CommFunc.WriteWORD(buf, self.Count)
|
| | | buf = CommFunc.WriteWORD(buf, self.UserDataLen)
|
| | | buf = CommFunc.WriteString(buf, self.UserDataLen, self.UserData)
|
| | | return buf
|
| | |
|
| | | def getLength(self):
|
| | | length = 0
|
| | | length += sizeof(ctypes.c_char) * 40
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += sizeof(ctypes.c_char) * 19
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_char) * 33
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | length += sizeof(ctypes.c_ushort)
|
| | | length += self.UserDataLen
|
| | | return length
|
| | |
|
| | | def getRecord(self):
|
| | | '''ç»ç»åå¨è®°å½'''
|
| | | rec = {}
|
| | | rec[u'ItemGUID'] = fix_incomingText(self.ItemGUID)
|
| | | rec[u'PlayerID'] = self.PlayerID
|
| | | rec[u'FamilyID'] = self.FamilyID
|
| | | rec[u'RecordType'] = self.RecordType
|
| | | rec[u'RecordResult'] = self.RecordResult
|
| | | rec[u'RecordTime'] = fix_incomingText(self.RecordTime)
|
| | | rec[u'BidderPrice'] = self.BidderPrice
|
| | | rec[u'BidderName'] = fix_incomingText(self.BidderName)
|
| | | rec[u'ItemID'] = self.ItemID
|
| | | rec[u'Count'] = self.Count
|
| | | rec[u'UserDataLen'] = self.UserDataLen
|
| | | rec[u'UserData'] = fix_incomingText(self.UserData)
|
| | | return rec
|
| | |
|
| | | def readRecord(self, rec):
|
| | | '''ç±äºMongoDBè¯»åºæ¥æ¯unicode,ææå符串éè¦è¿è¡è½¬æ¢'''
|
| | | self.ItemGUID = fix_outgoingText(rec.get(u'ItemGUID', u''))
|
| | | self.PlayerID = rec.get(u'PlayerID', 0)
|
| | | self.FamilyID = rec.get(u'FamilyID', 0)
|
| | | self.RecordType = rec.get(u'RecordType', 0)
|
| | | self.RecordResult = rec.get(u'RecordResult', 0)
|
| | | self.RecordTime = fix_outgoingText(rec.get(u'RecordTime', u''))
|
| | | self.BidderPrice = rec.get(u'BidderPrice', 0)
|
| | | self.BidderName = fix_outgoingText(rec.get(u'BidderName', u''))
|
| | | self.ItemID = rec.get(u'ItemID', 0)
|
| | | self.Count = rec.get(u'Count', 0)
|
| | | self.UserDataLen = rec.get(u'UserDataLen', 0)
|
| | | self.UserData = fix_outgoingText(rec.get(u'UserData', u''))
|
| | |
|
| | | #Can not implement adoLoadStr method:No key defined!
|
| | | #Can not implement adoInsertStr method:No key defined!
|
| | | #Can not implement adoUpdateStr method:No key defined!
|
| | | #Can not implement adoUpdateStr method:No key defined!
|
| | | #Can not implement adoCheckUpdateStr method:No key defined!
|
| | | #Can not implement adoCheckUpdateExStr method:No key defined!
|
| | |
|
| | | def getAdoRecords(self, resultCollection):
|
| | | '''æ¥è¯¢ç»ææå
æäºè¿å¶æµ'''
|
| | | result = ''
|
| | | result = CommFunc.WriteDWORD(result, resultCollection.count())
|
| | | for rec in resultCollection:
|
| | | self.readRecord(rec)
|
| | | result += self.getBuffer()
|
| | | return result
|
| | |
|
| | | #Can not implement adoQueryIndexStr method:No key defined!
|
| | |
|
| | | def adoQueryCustom(self, collection, queryDict):
|
| | | '''èªå®ä¹æ¥è¯¢'''
|
| | | resultCollection = collection.find(queryDict)
|
| | |
|
| | | return self.getAdoRecords(resultCollection)
|
| | |
|
| | |
|
| | | def adoQueryAll(self, collection):
|
| | | '''æ¥è¯¢ææ''' |
| | | resultCollection = collection.find()
|
| | | |
| | | return self.getAdoRecords(resultCollection)
|
| | |
|
| | | #Can not implement adoDeleteByIndexStr method:No key defined!
|
| | | def outputString(self):
|
| | | output = '''// æåè®°å½è¡¨ #tagDBAuctionRecord:
|
| | | ItemGUID = %s,
|
| | | PlayerID = %s,
|
| | | FamilyID = %s,
|
| | | RecordType = %s,
|
| | | RecordResult = %s,
|
| | | RecordTime = %s,
|
| | | BidderPrice = %s,
|
| | | BidderName = %s,
|
| | | ItemID = %s,
|
| | | Count = %s,
|
| | | UserDataLen = %s,
|
| | | UserData = %s,
|
| | | ADOResult = %s,
|
| | | '''%(
|
| | | self.ItemGUID,
|
| | | self.PlayerID,
|
| | | self.FamilyID,
|
| | | self.RecordType,
|
| | | self.RecordResult,
|
| | | self.RecordTime,
|
| | | self.BidderPrice,
|
| | | self.BidderName,
|
| | | self.ItemID,
|
| | | self.Count,
|
| | | self.UserDataLen,
|
| | | self.UserData,
|
| | | self.ADOResult,
|
| | | )
|
| | | return output
|
| | |
|
| | | def dumpString(self):
|
| | | output = '''%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s\t%1s'''%(
|
| | | self.ItemGUID,
|
| | | self.PlayerID,
|
| | | self.FamilyID,
|
| | | self.RecordType,
|
| | | self.RecordResult,
|
| | | self.RecordTime,
|
| | | self.BidderPrice,
|
| | | self.BidderName,
|
| | | self.ItemID,
|
| | | self.Count,
|
| | | self.UserDataLen,
|
| | | self.UserData,
|
| | | )
|
| | | return output
|
| | |
|
| | | #Charæ°ç»ç±»åSetæ¥å£,使ç¨è¯¥æ¥å£å¯¹æ¤ç±»åæ°æ®èµå¼ï¼é²æ¢èµå¼çæ°æ®è¿é¿æ¥é
|
| | | def SetItemGUID(self,Str):
|
| | | if len(Str)<=40:
|
| | | self.ItemGUID = Str
|
| | | else:
|
| | | self.ItemGUID = Str[:40]
|
| | | |
| | | def SetRecordTime(self,Str):
|
| | | if len(Str)<=19:
|
| | | self.RecordTime = Str
|
| | | else:
|
| | | self.RecordTime = Str[:19]
|
| | | |
| | | def SetBidderName(self,Str):
|
| | | if len(Str)<=33:
|
| | | self.BidderName = Str
|
| | | else:
|
| | | self.BidderName = Str[:33]
|
| | | |
| | | # æåå
³æ³¨è¡¨ #tagDBAuctionAttention
|
| | | class tagDBAuctionAttention(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ('PlayerID', ctypes.c_ulong),
|
| | | ('AttentionLen', ctypes.c_ubyte),
|
| | | ('AttentionInfo', ctypes.c_char_p),
|
| | | ('ADOResult', ctypes.c_ulong),
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | Structure.__init__(self)
|
| | | self.clear()
|
| | |
|
| | | def clear(self):
|
| | | self.PlayerID = 0
|
| | | self.AttentionLen = 0
|
| | | self.AttentionInfo = ''
|
| | |
|
| | | def readData(self, buf, pos = 0, length = 0):
|
| | | if not pos <= length:
|
| | | msg = error.formatMsg('error', error.ERROR_NO_148, '(pos = %s) > (length = %s)'%(pos, length))
|
| | | mylog.error(msg)
|
| | | return -1
|
| | | if len(buf) < pos + self.getLength():
|
| | | msg = error.formatMsg('error', error.ERROR_NO_149, 'len = %s while %s expected!'%(len(buf) - pos, self.getLength()))
|
| | | mylog.error(msg)
|
| | | self.clear()
|
| | | self.PlayerID, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | self.AttentionLen, pos = CommFunc.ReadBYTE(buf, pos)
|
| | | tmp, pos = CommFunc.ReadString(buf, pos, self.AttentionLen)
|
| | | self.AttentionInfo = ctypes.c_char_p(tmp)
|
| | | return self.getLength()
|
| | |
|
| | | def getBuffer(self):
|
| | | buf = ''
|
| | | buf = CommFunc.WriteDWORD(buf, self.PlayerID)
|
| | | buf = CommFunc.WriteBYTE(buf, self.AttentionLen)
|
| | | buf = CommFunc.WriteString(buf, self.AttentionLen, self.AttentionInfo)
|
| | | return buf
|
| | |
|
| | | def getLength(self):
|
| | | length = 0
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += sizeof(ctypes.c_ubyte)
|
| | | length += self.AttentionLen
|
| | | return length
|
| | |
|
| | | def getRecord(self):
|
| | | '''ç»ç»åå¨è®°å½'''
|
| | | rec = {}
|
| | | rec[u'PlayerID'] = self.PlayerID
|
| | | rec[u'AttentionLen'] = self.AttentionLen
|
| | | rec[u'AttentionInfo'] = fix_incomingText(self.AttentionInfo)
|
| | | return rec
|
| | |
|
| | | def readRecord(self, rec):
|
| | | '''ç±äºMongoDBè¯»åºæ¥æ¯unicode,ææå符串éè¦è¿è¡è½¬æ¢'''
|
| | | self.PlayerID = rec.get(u'PlayerID', 0)
|
| | | self.AttentionLen = rec.get(u'AttentionLen', 0)
|
| | | self.AttentionInfo = fix_outgoingText(rec.get(u'AttentionInfo', u''))
|
| | |
|
| | | #Can not implement adoLoadStr method:No key defined!
|
| | | #Can not implement adoInsertStr method:No key defined!
|
| | | #Can not implement adoUpdateStr method:No key defined!
|
| | | #Can not implement adoUpdateStr method:No key defined!
|
| | | #Can not implement adoCheckUpdateStr method:No key defined!
|
| | | #Can not implement adoCheckUpdateExStr method:No key defined!
|
| | |
|
| | | def getAdoRecords(self, resultCollection):
|
| | | '''æ¥è¯¢ç»ææå
æäºè¿å¶æµ'''
|
| | | result = ''
|
| | | result = CommFunc.WriteDWORD(result, resultCollection.count())
|
| | | for rec in resultCollection:
|
| | | self.readRecord(rec)
|
| | | result += self.getBuffer()
|
| | | return result
|
| | |
|
| | | #Can not implement adoQueryIndexStr method:No key defined!
|
| | |
|
| | | def adoQueryCustom(self, collection, queryDict):
|
| | | '''èªå®ä¹æ¥è¯¢'''
|
| | | resultCollection = collection.find(queryDict)
|
| | |
|
| | | return self.getAdoRecords(resultCollection)
|
| | |
|
| | |
|
| | | def adoQueryAll(self, collection):
|
| | | '''æ¥è¯¢ææ''' |
| | | resultCollection = collection.find()
|
| | | |
| | | return self.getAdoRecords(resultCollection)
|
| | |
|
| | | #Can not implement adoDeleteByIndexStr method:No key defined!
|
| | | def outputString(self):
|
| | | output = '''// æåå
³æ³¨è¡¨ #tagDBAuctionAttention:
|
| | | PlayerID = %s,
|
| | | AttentionLen = %s,
|
| | | AttentionInfo = %s,
|
| | | ADOResult = %s,
|
| | | '''%(
|
| | | self.PlayerID,
|
| | | self.AttentionLen,
|
| | | self.AttentionInfo,
|
| | | self.ADOResult,
|
| | | )
|
| | | return output
|
| | |
|
| | | def dumpString(self):
|
| | | output = '''%1s\t%1s\t%1s'''%(
|
| | | self.PlayerID,
|
| | | self.AttentionLen,
|
| | | self.AttentionInfo,
|
| | | )
|
| | | return output
|
| | |
|