def Persistent(self): # ffext.LOGINFO("FFSCENE_PYTHON", "Persistent {0}".format(self.GetGlobalID())) dictSerial = self.GetPersistentDict() dbs_client.DoAsynCall(rpc_def.DbsPersistentPlayerData, self.GetGlobalID(), json.dumps(dictSerial), nChannel=self.GetGlobalID())
def update_id(self): if self.saving_flag is True: return self.saving_flag = True now_val = self.auto_inc_id dbs_client.DoAsynCall(rpc_def.DbsUpdateID, 0, [now_val, self.type_id, self.server_id, now_val])
def SaveAllConfig(): global g_dictAllGmConfig, g_szCurConfigName dictCopy = copy.deepcopy(g_dictAllGmConfig) if g_szCurConfigName is not None: dictCopy["g_szCurConfigName"] = g_szCurConfigName else: dictCopy["g_szCurConfigName"] = "" dbs_client.DoAsynCall(rpc_def.DbsSaveAllGmConfig, 0, json.dumps(dictCopy))
def real_session_verify(szAuthKey, online_time, ip, gate_name, cb_id): """ Auth. :param szAuthKey: :param online_time: :param ip: :param gate_name: :param cb_id: :return: """ if _loginMgr.size() > 3000: ffext.on_verify_auth_callback(0, "", cb_id) return [] print("real_session_verify ", szAuthKey, online_time, ip, gate_name, cb_id) req_login = login_pb2.login_req() try: req_login.ParseFromString(szAuthKey) except: print("req_login.ParseFromString error! ") return [] print("req_login.type ", req_login.type) nType = req_login.type if nType == login_pb2.login_type.Value("get_gate_info"): def _retGetGateAddr(err, msg): szGateAddr = msg["gate_info"] rsp = login_pb2.login_rsp() rsp.ret = 0 rsp.gate_info = szGateAddr.encode("utf-8") ffext.on_verify_auth_callback(0, rsp.SerializeToString(), cb_id) ffext.call_service(scene_def.GATE_MASTER, rpc_def.GetGateIp, {"0": 0}, _retGetGateAddr) return [] elif nType == login_pb2.login_type.Value("login"): szAuthKey = req_login.auth_info dbs_client.DoAsynCall( rpc_def.DbsGetUserSession, 0, szAuthKey, funCb=OnGetUseSessonCb, callbackParams=[szAuthKey, online_time, ip, gate_name, cb_id]) return [] elif nType == login_pb2.login_type.Value("gm_code"): # gm szToken, szScene, szCode = req_login.auth_info.split("#") if gm_tool.IsTokenValid(szToken, ip) is False: ffext.on_verify_auth_callback(0, "", cb_id) else: gm_tool.SendCode(szScene, szCode) return [] else: ffext.on_verify_auth_callback(0, "", cb_id) return []
def init(self): dbs_client.DoAsynCall(rpc_def.DbsGetIDData, 0, [self.type_id, self.server_id], funCb=self.RetGetIDAutoInc)
def LoadAllConfig(): dbs_client.DoAsynCall(rpc_def.DbsGetAllGmConfig, 0, None, funCb=OnLoadAllConfigCb, callbackParams=0)