#!/usr/bin/python
|
# -*- coding: GBK -*-
|
#---------------------------------------------------------------------
|
#
|
#---------------------------------------------------------------------
|
##@package GMT_ItemExpiation.py
|
# GMÃüÁîÍæ¼ÒÎïÆ·²¹³¥
|
#
|
# @author wdb
|
# @date 2012-06-21
|
# @version 1.5
|
#
|
# @note
|
# @change: "2012-07-12 18:00" wdb Ôö¼Ó±àÂëÊôÐÔ
|
# @change: "2012-07-13 10:00" wdb Ð޸ĻñµÃÍæ¼Òid´íÎó
|
# @change: "2012-07-30 11:30" wdb GM»Ø¸´Ï¸»¯£¬´úÂëÓÅ»¯
|
# @change: "2011-09-21 13:00" whx ÐÞ¸ÄÍæ¼Ò²»ÔÚÏß²»²¹³¥
|
# @change: "2012-09-25 18:00" whx ÐÞ¸ÄÍæ¼Ò²»´æÔÚ²»²¹³¥
|
#---------------------------------------------------------------------
|
"""Version = 2012-09-25 18:00"""
|
#---------------------------------------------------------------------
|
#µ¼Èë
|
import GMCommon
|
from MangoDBCommon import (fix_incomingText, fix_outgoingText)
|
from Collections import DataServerPlayerData
|
from Common import(mylog, CommFuncEx)
|
from Collections.CollectionDefine import *
|
from MangoDBCommon import seq
|
DBConfig = __import__('Config.DBConfig')
|
#---------------------------------------------------------------------
|
#È«¾Ö±äÁ¿
|
|
#---------------------------------------------------------------------
|
|
## ÊÕµ½gmÃüÁîÖ´ÐÐ
|
# @param gmCmdDict:gmÃüÁî×Öµä
|
# @return None
|
def OnExec(gmCmdDict):
|
playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '')
|
itemID = GMCommon.ToIntDef(gmCmdDict.get('itemID', ''))
|
itemCount = GMCommon.ToIntDef(gmCmdDict.get('itemCount', ''))
|
|
if playerFind == '' or itemID <= 0 or itemCount <= 0:
|
return GMCommon.Def_ParamErr, ''
|
|
# »Ø¸´gm²ÎÊý´íÎó
|
return GMCommon.Def_DoQueryUserDB, ''
|
|
|
## ²éѯlogdb·µ»Ø
|
# @param logdb:logdb
|
# @param data:´«ÈëµÄÐÅÏ¢
|
# @param gmCmdDict:gmÃüÁî×Öµä
|
# @return None
|
def LogDBResponse(logdb, data, gmCmdDict):
|
return GMCommon.Def_PlayerOfLine, ''
|
|
|
## ²éѯuserdb·µ»Ø
|
# @param userdb:userdb
|
# @param data:´«ÈëµÄÐÅÏ¢
|
# @param gmCmdDict:gmÃüÁî×Öµä
|
# @return None
|
def UserDBResponse(userdb, data, gmCmdDict):
|
playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '')
|
queryType = gmCmdDict.get(GMCommon.Def_GMKey_QueryType, '')
|
|
itemID = GMCommon.ToIntDef(gmCmdDict.get('itemID', ''), 0)
|
itemCount = GMCommon.ToIntDef(gmCmdDict.get('itemCount', ''), 0)
|
|
# queryType²»ÊÇaccID£¬·¢Ë͵ÄÐÅÏ¢ÊÇÍæ¼ÒµÄÃû×Ö£¬ È¡µÃÍæ¼Òaccid
|
playerAccID = ""
|
if queryType == 'playerName':
|
playerAccID = GMCommon.GetPlayerAccID(userdb, {'PlayerName':fix_incomingText(playerFind), 'IsDeleted':0})
|
|
elif queryType == 'accID':
|
playerAccID = GMCommon.GetPlayerAccID(userdb, {'AccID':fix_incomingText(playerFind), 'IsDeleted':0})
|
|
else:
|
return GMCommon.Def_ParamErr, ''
|
|
if playerAccID == '':
|
return GMCommon.Def_NoTag, ''
|
|
con = userdb[UCN_Expiation]
|
doc = DataServerPlayerData.tagExpiation()
|
doc.AccID = playerAccID
|
doc.ExpiationTime = CommFuncEx.TDateTime_Now()
|
doc.ExpiationIndex = seq(userdb, UCN_Expiation, 'ExpiationIndex',
|
DBConfig.tagExpiation_ExpiationIndex_FEED,
|
DBConfig.tagExpiation_ExpiationIndex_STEP)
|
|
doc.ItemTypeID = itemID
|
doc.Count = itemCount
|
|
if not doc.adoInsert(con):
|
return GMCommon.Def_InsertFail, ''
|
|
# ¼Ç¼Á÷Ïò
|
dataDic = {"PlayerID":0, 'AccID':playerAccID}
|
|
GMCommon.SendEventPack(gmCmdDict.get(GMCommon.Def_GMKey_Type, ''), dataDic, str(gmCmdDict))
|
return GMCommon.Def_Success, ''
|
|
|
|
|
|