This commit is contained in:
aozhiwei 2021-11-23 13:12:14 +08:00
parent d39f92c6fe
commit 4ffa30cc40
3 changed files with 29 additions and 54 deletions

View File

@ -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, '货币数量'],
]
},
{

View File

@ -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, '机器人头像'],
]

View File

@ -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'];