def doStoreQuery(self, request): mo = MsgPack() mi = self.checkStoreUser.check(request) if mi.error: mo.setError(1, mi.error) else: clientId = tysessiondata.getClientId(mi.userId) datas = hallRpcOne.hallstore._doStoreQueryUi(mi.userId, clientId).getResult() mo.updateResult(datas) return mo
def _sendDesc(self, userId): resp = MsgPack() resp.setCmd('match') resp.setResult('action', 'desc') resp.setResult('roomId', self.bigRoomId) resp.setResult('gameId', self.gameId) resp.setResult('userId', userId) signinCount = self.matchArea.getTotalSignerCount() # 房间实时报名人数 resp.setResult('signinCount', signinCount) matchDef = _buildMatchDesc(self.conf) resp.updateResult(matchDef) # 比赛配置 record = MatchRecordDaoRedis.loadRecord(self.gameId, userId, self.bigRoomId) if record: ret = MatchRecordDaoRedis.loadHistory(self.gameId, userId, self.bigRoomId) # ret = [ {"time":_["time"],"desc":"第%s名,获得%s" % (_["rank"],_["desc"]),"rank":_["rank"],"info":_["desc"] } # for _ in ret] ret = map( lambda _: { "time": _["time"], "desc": "第%s名" % (_["rank"], ), "rank": _["rank"], "info": _["desc"] } if _["desc"] == "" else { "time": _["time"], "desc": "第%s名,获得%s" % (_["rank"], _["desc"]), "rank": _["rank"], "info": _["desc"] }, ret) histories = { "crownCount": record.crownCount, "playCount": record.playCount, "bestRank": record.bestRank, "bestRankDate": record.bestRankDate, "records": ret } else: histories = { "crownCount": 0, "playCount": 0, "bestRank": 0, "bestRankDate": 0, "records": [] } resp.setResult('histories', histories) tyrpcconn.sendToUser(resp, userId)
def doAudit(self, request, result): mo = MsgPack() mi = self.checkExchange.check(request) if mi.error: mo.setError(1, mi.error) else: params = { 'userId': mi.userId, 'result': result, 'realGameId': tyglobal.gameId(), 'exchangeId': mi.exchangeId, 'extOrderId': 'dummy_jd_num_audit', '_test_': 1, } url = tyglobal.httpGame( ) + '/api/hall5/exchange/auditCallback?' + ftstr.toHttpStr(params) _, ret = fthttp.queryHttp('GET', url, None, None, 5) if ret and ret[0] == '{': mo.updateResult(ftstr.loads(ret)) else: mo.setError(1, ret) return mo
def doItemActionCmd(self, msg): mo = MsgPack() mo.setCmd('item5') mi = self.checkerAct.check(msg) if _DEBUG: debug('doItemActionCmd mi=', mi) if mi.error: mo.setError(1, mi.error) else: timestamp = fttime.getCurrentTimestamp() result = _action.doActionByItemId(mi.userId, mi.gameId, mi.itemId, mi.action, timestamp, mi.params, mi.clientId) if result.code != 0: mo.setError(result.code, result.message) mo.updateResult(result.toDict(_action._makeTodoTaskShowInfo)) mo.setResult('userId', mi.userId) mo.setResult('gameId', mi.gameId) mo.setResult('action', mi.action) mo.setResult('itemId', mi.itemId) if _DEBUG: debug('doItemActionCmd mi=', mi, 'result=', result) tyrpcconn.sendToUser(mi.userId, mo) return 1