From 4ffa30cc4043037a43424a1c9b35218ac6fc1224 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 23 Nov 2021 13:12:14 +0800 Subject: [PATCH] 1 --- doc/Role.py | 9 +++- doc/_common.py | 17 +++++++ webapp/controller/RoleController.class.php | 57 ++-------------------- 3 files changed, 29 insertions(+), 54 deletions(-) diff --git a/doc/Role.py b/doc/Role.py index cb4eb54..2d79c05 100644 --- a/doc/Role.py +++ b/doc/Role.py @@ -59,10 +59,14 @@ class Role(object): ], 'response': [ _common.RspHead(), + ['kill_his', 0, '历史最高击杀数'], + ['alive_time_his', 0, '历史最高存活时间'], + ['harm_his', 0, '历史最高伤害'], + ['add_HP_his', 0, '历史最高治疗'], ] }, { - 'desc': 'getRobotInfo', + 'desc': '获取机器人信息getRobotInfo', 'group': 'Role', 'url': 'webapp/index.php?c=Role&a=getRobotInfo', 'params': [ @@ -70,6 +74,9 @@ class Role(object): ], 'response': [ _common.RspHead(), + ['!member_list', _common.RobotInfo(), '机器人数据'], + ['!sin_member', _common.RobotMetaInfo(), '机器人列表'], + ['num', 0, '货币数量'], ] }, { diff --git a/doc/_common.py b/doc/_common.py index 07b0827..97b7644 100644 --- a/doc/_common.py +++ b/doc/_common.py @@ -107,3 +107,20 @@ class RoleInfo(object): ['hero_id', 0, '当前使用的英雄ID'], ['max_seasonScore', 0, '最高积分'], ] + +class RobotInfo(object): + + def __init__(self): + self.fields = [ + ['account_id', 0, '机器人account_id'], + ['name', 0, '机器人名字'], + ['avatar_url', 0, '机器人头像'], + ] + +class RobotMetaInfo(object): + + def __init__(self): + self.fields = [ + ['name', 0, '机器人名字'], + ['avatar_url', 0, '机器人头像'], + ] diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index 137b3fa..e2e4af8 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -12,6 +12,7 @@ require_once('mt/SeasonPoint.php'); require_once('mt/RankReward.php'); require_once('mt/Equip.php'); require_once('mt/Player.php'); +require_once('mt/Robot.php'); class RoleController extends BaseAuthedController { @@ -27,7 +28,6 @@ class RoleController extends BaseAuthedController { //new classes\Quest(); $testTask = new NTaskController(); $testTask->updateTaskToDB(QUEST_DAY_LOGIN,1); - $this->updateSwitch($account_id, $switch_id); $userInfo = $this->safeGetOrmUserInfo(); if (!$userInfo) { @@ -345,64 +345,15 @@ class RoleController extends BaseAuthedController { public function getRobotInfo() { - $account_id = $_REQUEST['account_id']; - $member = array(); - $i = Rand(1, 100); - $coin = Rand(1, 100) * 0.01; - $num = 1; - $robot_id = 1000 + $i; - - $address = '../res/robot@robot' . $num . '.php'; - $robot_meta_cluster = require($address); - $robot_meta = getRobotConfig($robot_meta_cluster, $robot_id); - $rob = array( - 'id' => $robot_meta['id'], - 'name' => $robot_meta['name'], - 'avatar_url' => $robot_meta['avatar_url'], - 'sex' => $robot_meta['sex'] - ); - - array_push ($member, array( - 'account_id' => $rob['id'], - 'name' => $rob['name'], - 'avatar_url' => $rob['avatar_url'], - )); - echo json_encode(array( 'errcode' => 0, 'errmsg' => '', - 'member_list' => $member, - 'sin_member' => $robot_meta_cluster, - 'num' => $coin, + 'member_list' => array(mt\Robot::getRandMember()), + 'sin_member' => mt\Robot::getSinMembers(), + 'num' => Rand(1, 100) * 0.01 )); } - protected function updateSwitch($account_id, $switch_id) - { - $r = $this->getRedis($account_id); - if (!$r) { - die(); - return; - } - $switch_uuid = 'game2005api_switch:' . $account_id; - $r -> set($switch_uuid, $switch_id); - $r -> pexpire($switch_uuid, 1000 * 3600 * 24); - - } - - protected function getSwitch($account_id) - { - $r = $this->getRedis($account_id); - if (!$r) { - die(); - return; - } - $switch_uuid = 'game2005api_switch:' . $account_id; - $user_db_str = $r->get($switch_uuid); - $switch = json_decode($user_db_str, true); - return $switch; - } - public function getFightReward() { $account_id = $_REQUEST['account_id'];