| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #---------------------------------------------------------------------  | 
| #  | 
| #---------------------------------------------------------------------  | 
| ##@package GMT_MoneyExpiation.py  | 
| # GMÃüÁîÍæ¼Ò½ðÇ®²¹³¥  | 
| #  | 
| # @author wdb  | 
| # @date 2012-06-21  | 
| # @version 1.6  | 
| #  | 
| # @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 ÐÞ¸ÄÍæ¼Ò²»´æÔÚ²»²¹³¥  | 
| # @change: "2014-02-28 21:10" hxp Ôö¼ÓMU»õ±ÒÀàÐÍ-¶ñħ¾«»ª  | 
| #---------------------------------------------------------------------  | 
| """Version = 2014-02-28 21:10"""  | 
| #---------------------------------------------------------------------  | 
| #µ¼Èë  | 
| import GMCommon  | 
| from MangoDBCommon import (fix_incomingText, fix_outgoingText)  | 
| from Collections import DataServerPlayerData  | 
| from Common import(mylog, CommFuncEx)  | 
| from MangoDBCommon import seq  | 
| from DBCommon import CommonDefine  | 
| from Collections.CollectionDefine import *  | 
| DBConfig = __import__('Config.DBConfig')  | 
| #---------------------------------------------------------------------  | 
| #È«¾Ö±äÁ¿  | 
|   | 
| #---------------------------------------------------------------------  | 
|   | 
| ## ÊÕµ½gmÃüÁîÖ´ÐÐ  | 
| # @param gmCmdDict:gmÃüÁî×Öµä  | 
| # @return None   | 
| def OnExec(gmCmdDict):  | 
|     playerFind = gmCmdDict.get(GMCommon.Def_GMKey_PlayerFind, '')  | 
|     value = GMCommon.ToIntDef(gmCmdDict.get('value', ''), 0)  | 
|     moneyType = GMCommon.ToIntDef(gmCmdDict.get('moneyType', ''))  | 
|       | 
|     if playerFind == '' or value <= 0 or moneyType <= 0:  | 
|         return GMCommon.Def_ParamErr, ''       | 
|       | 
|     #ÊýÖµÉÏÏÞ(20ÒÚ)  | 
|     if value > GMCommon.Def_UpperLimit_DWord:  | 
|         return GMCommon.Def_MaxLimit, ''  | 
|   | 
|     # ²éÑ¯Íæ¼ÒPlayerID  | 
|     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, '')  | 
|         | 
|     moneyType = GMCommon.ToIntDef(gmCmdDict.get('moneyType', ''))  | 
|     value = GMCommon.ToIntDef(gmCmdDict.get('value', ''))  | 
|       | 
|     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)  | 
|     #/<½ð×Ó  | 
|     if moneyType == CommonDefine.TYPE_Price_Gold_Money:  | 
|         doc.Gold = value  | 
|     #/<½ðƱ  | 
|     elif moneyType == CommonDefine.TYPE_Price_Gold_Paper:  | 
|         doc.GoldPaper = value  | 
|     #/<Òø×Ó  | 
|     elif moneyType == CommonDefine.TYPE_Price_Silver_Money:  | 
|         doc.Silver = value  | 
|     #/<¶ñħ¾«»ª  | 
|     elif moneyType == CommonDefine.TYPE_Price_Silver_Paper:  | 
|         doc.SilverPaper = value  | 
|     else:  | 
|         return GMCommon.Def_MoneyTypeErr, ''  | 
|   | 
|     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, ''  | 
|   | 
|   |