hxp
1 天以前 388823edfe6308cba6f76ca6dc4f20022c5cb2be
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/usr/bin/python
# -*- coding: GBK -*-
#---------------------------------------------------------------------
#
#---------------------------------------------------------------------
##@package GMT_UnForbidLogin.py
# GMÃüÁî½âËøÍæ¼ÒÕ˺Å
#
# @author wdb
# @date 2012-6-14
# @version 1.2
#
# @note
# @change: "2012-06-21 15:30" wdb intÐ޸ĵ½GMCommon¿ª½Ó¿Ú
# @change: "2012-07-12 18:00" wdb Ôö¼Ó±àÂëÊôÐÔ
#---------------------------------------------------------------------
"""Version = 2012-07-12 18:00"""
#---------------------------------------------------------------------
#µ¼Èë
from MangoDBCommon import fix_incomingText
from Collections.CollectionDefine import *
from Common import (CommFuncEx, mylog)
from Collections import DataServerPlayerData
import GMCommon
#---------------------------------------------------------------------
#È«¾Ö±äÁ¿
 
#---------------------------------------------------------------------
 
## ÊÕµ½gmÃüÁîÖ´ÐÐ
# @param gmCmdDict:gmÃüÁî×Öµä
# @return None 
def OnExec(gmCmdDict):
    playerAccID = gmCmdDict.get(GMCommon.Def_GMKey_PlayerAccID, '')
    playerName = gmCmdDict.get(GMCommon.Def_GMKey_PlayerName, '')
    
    if playerAccID != '':
        return GMCommon.Def_DoQueryLogDB, ''
  
    elif playerName != '':        
        return GMCommon.Def_DoQueryUserDB, '%s'%GMCommon.Def_GMKey_PlayerName
    # »Ø¸´
    return GMCommon.Def_ParamErr, ''
    
    
## ²éѯlogdb·µ»Ø
# @param logdb:logdb
# @param data:´«ÈëµÄÐÅÏ¢
# @param gmCmdDict:gmÃüÁî×Öµä
# @return None 
def LogDBResponse(logdb, data, gmCmdDict):
    playerAccID = gmCmdDict.get(GMCommon.Def_GMKey_PlayerAccID, '')
 
    if playerAccID != '' and GMCommon.GetPlayerOnLineByAccID(logdb, playerAccID):
        return GMCommon.Def_SendToGameServer, ''
  
    # ×ª»»×Ö·û´®
    if data != '' and GMCommon.GetPlayerOnLineByAccID(logdb, data):        
        return GMCommon.Def_SendToGameServer, ''
    
    return GMCommon.Def_DoQueryUserDB, ''
 
 
## ²éѯuserdb·µ»Ø
# @param userdb:userdb
# @param data:´«ÈëµÄÐÅÏ¢
# @param gmCmdDict:gmÃüÁî×Öµä
# @return None 
def UserDBResponse(userdb, data, gmCmdDict):
    playerAccID = gmCmdDict.get(GMCommon.Def_GMKey_PlayerAccID, '')
    playerName = gmCmdDict.get(GMCommon.Def_GMKey_PlayerName, '')
    #  È¡µÃÍæ¼Òaccid
    if  playerName != '':
        playerAccID = GMCommon.GetPlayerAccID(userdb, {'PlayerName':fix_incomingText(playerName), 'IsDeleted':0})
        
        if playerAccID == '':
            return GMCommon.Def_NoTag, ''
    
    # ·µ»Øplayerid£¬ÅжÏÊÇ·ñÔÚÏß
    if data == '%s'%GMCommon.Def_GMKey_PlayerName:        
        return GMCommon.Def_DoQueryLogDB, playerAccID
    
    collection = userdb[UCN_DBPlayer]
    dbPlayer = DataServerPlayerData.tagDBPlayer()
    dbPlayer.IsDeleted = 0
    
    loadOK = dbPlayer.adoLoadCEx(collection, {'AccID':fix_incomingText(playerAccID),
                                                  'IsDeleted':dbPlayer.IsDeleted}) 
    if not loadOK:
        # »Ø¸´gm
        return GMCommon.Def_NoTag, ''
    
    # ÒÑÊÇËø¶¨×´Ì¬
    if (dbPlayer.AccState & pow(2, GMCommon.Def_PysForbidByPy)) > 0:
        return GMCommon.Def_NoNeed, ''
    
    # ÉèÖÃÍæ¼ÒÕ˺Å״̬
    dbPlayer.AccState = dbPlayer.AccState|pow(2, GMCommon.Def_PysForbidByPy)
    dbPlayer.ExAttr17 = dbPlayer.AccState
    dbPlayer.adoUpdateC(collection)
    
    # ¼Ç¼Á÷Ïò
    dataDic = {"PlayerID":dbPlayer.PlayerID, 'AccID':playerAccID}
    GMCommon.SendEventPack(gmCmdDict.get(GMCommon.Def_GMKey_Type, ''), dataDic)
    return GMCommon.Def_Success, ''