hch
2 天以前 35d98e9c630fd4408561c8c54b4c09193bb9ce9e
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/LogicProcess/UserCtrlDB.py
@@ -3151,6 +3151,69 @@
                    self.loginHeap += 1
                else:
                    self.loginStartTime = nowTime
                    self.loginHeap = 0
        elif appType == CommonDefine.gitGaore:
            #读取旧数据, 用到扩展字段
            accountRec.adoLoadC(collection)
            accountRec.AppID = authPack.AppID.strip(chr(0))
            accountRec.AccountID = authPack.AccountID
            accountRec.TokenExpire = authPack.TokenExpire.strip(chr(0))
            accountRec.Phone = authPack.Phone
            accountRec.Psw = "1" # token太长 放在Extra
            accountRec.Adult = authPack.Adult
            accountRec.RegIP = authPack.IP.strip(chr(0))    # RegIP 当做登录IP用 2018-03-03
            # quick游戏token太长,第一位是spid,第二位是deviceFlag, 第三位是token
            extraList = authPack.Extra.split("|")
            if len(extraList) < redefineIndex + 2:
                self.sendLoginFail(CommonDefine.dgPlayerLogin, authPack, disPswCheckError)
                return True
            token = extraList[redefineIndex]
            uid = extraList[redefineIndex + 1] #原始的uid,含大小写
            # 极速游戏,远程验证
            if accountRec.RegIP == "127.0.0.1":
                #debug内部服务器不验证token, 脱机挂玩家不验证
                mylog.debug('iner no check')
            else:
                # url的访问没有多线程 有可能导致登录堆积卡顿的现象
                if self.loginHeap < 5:
                    # 10秒内前X个玩家验证,后面不验证
                    loginkey = CommFunc.GetLoginKey(authAccID, accountRec.AppID)
                    userID = uid
                    game_sign = "ryzj"
                    game_id = 9134
                    curTime = int(time())
                    sign = md5.md5("%s%s%s%s%s%s" % (userID, game_id, game_sign, token, curTime, loginkey)).hexdigest()
                    values = {'userID' : userID,
                              'game_sign' : game_sign,
                              'game_id' : game_id,
                              'token' : token,
                              'time' : curTime,
                              'sign' : sign,
                              }
                    try:
                        data = urllib.urlencode(values)
                        # 节省配置复杂度  写死地址
                        req = urllib2.Request("https://apisdk.gaore.com/user/verifyAccount/state.php", data)
                        response = urllib2.urlopen(req, timeout=1)
                        the_page = response.read()
                        # 返回结果:(JSON格式): { state: 1  //(登录认证成功);其他失败 }
                        retDict = eval(the_page)
                        if retDict.get("state") != 1:
                            mylog.debug('checktoken fail: loginkey=%s, req:%s, ret:%s'%(loginkey, values, the_page))
                            self.sendLoginFail(CommonDefine.dgPlayerLogin, authPack, disPswCheckError)
                            return True
                    except:
                        pass
                nowTime = time()
                if nowTime - self.loginStartTime < 10:
                    self.loginHeap += 1
                else:
                    self.loginStartTime = nowTime
                    self.loginHeap = 0    
        elif appType == CommonDefine.gitHYGame:
            #读取旧数据, 用到扩展字段