hxp
3 天以前 f2bbfcf7317caf5c0fb356a4f7ec560c6568fd69
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/PyMongoDB/LogicProcess/UserCtrlDB.py
@@ -3186,7 +3186,7 @@
                    game_sign = "ryzj"
                    game_id = 9134
                    curTime = int(time())
                    sign = md5.md5("%s%s%s%s%s%s" % (userID, game_id, game_sign, token, time, loginkey)).hexdigest()
                    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,
@@ -3203,7 +3203,7 @@
                        # 返回结果:(JSON格式): { state: 1  //(登录认证成功);其他失败 }
                        retDict = eval(the_page)
                        if retDict.get("state") != 1:
                            mylog.debug('checktoken fail:%s-%s'%(token, the_page))
                            mylog.debug('checktoken fail: loginkey=%s, req:%s, ret:%s'%(loginkey, values, the_page))
                            self.sendLoginFail(CommonDefine.dgPlayerLogin, authPack, disPswCheckError)
                            return True
                    except:
@@ -3215,6 +3215,55 @@
                else:
                    self.loginStartTime = nowTime
                    self.loginHeap = 0    
        elif appType == CommonDefine.gitFunshine:
            #读取旧数据, 用到扩展字段
            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个玩家验证,后面不验证
                    try:
                        # 节省配置复杂度  写死地址
                        req = urllib2.Request("https://api.funshine-game.com/v3/auth/token?token=%s" % token)
                        response = urllib2.urlopen(req, timeout=1)
                        the_page = response.read()
                        # 返回结果:(JSON格式): { "status": 1, "message":描述信息, "data":{"user_id":用户ID} }  // 1 为成功,0 为失败
                        retDict = eval(the_page)
                        if retDict.get("status") != 1:
                            mylog.debug('checktoken fail:%s-%s'%(token, 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:
            #读取旧数据, 用到扩展字段
            accountRec.adoLoadC(collection)