1
This commit is contained in:
parent
d39f92c6fe
commit
4ffa30cc40
@ -59,10 +59,14 @@ class Role(object):
|
|||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
|
['kill_his', 0, '历史最高击杀数'],
|
||||||
|
['alive_time_his', 0, '历史最高存活时间'],
|
||||||
|
['harm_his', 0, '历史最高伤害'],
|
||||||
|
['add_HP_his', 0, '历史最高治疗'],
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
'desc': 'getRobotInfo',
|
'desc': '获取机器人信息getRobotInfo',
|
||||||
'group': 'Role',
|
'group': 'Role',
|
||||||
'url': 'webapp/index.php?c=Role&a=getRobotInfo',
|
'url': 'webapp/index.php?c=Role&a=getRobotInfo',
|
||||||
'params': [
|
'params': [
|
||||||
@ -70,6 +74,9 @@ class Role(object):
|
|||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
|
['!member_list', _common.RobotInfo(), '机器人数据'],
|
||||||
|
['!sin_member', _common.RobotMetaInfo(), '机器人列表'],
|
||||||
|
['num', 0, '货币数量'],
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -107,3 +107,20 @@ class RoleInfo(object):
|
|||||||
['hero_id', 0, '当前使用的英雄ID'],
|
['hero_id', 0, '当前使用的英雄ID'],
|
||||||
['max_seasonScore', 0, '最高积分'],
|
['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, '机器人头像'],
|
||||||
|
]
|
||||||
|
@ -12,6 +12,7 @@ require_once('mt/SeasonPoint.php');
|
|||||||
require_once('mt/RankReward.php');
|
require_once('mt/RankReward.php');
|
||||||
require_once('mt/Equip.php');
|
require_once('mt/Equip.php');
|
||||||
require_once('mt/Player.php');
|
require_once('mt/Player.php');
|
||||||
|
require_once('mt/Robot.php');
|
||||||
|
|
||||||
class RoleController extends BaseAuthedController {
|
class RoleController extends BaseAuthedController {
|
||||||
|
|
||||||
@ -27,7 +28,6 @@ class RoleController extends BaseAuthedController {
|
|||||||
//new classes\Quest();
|
//new classes\Quest();
|
||||||
$testTask = new NTaskController();
|
$testTask = new NTaskController();
|
||||||
$testTask->updateTaskToDB(QUEST_DAY_LOGIN,1);
|
$testTask->updateTaskToDB(QUEST_DAY_LOGIN,1);
|
||||||
$this->updateSwitch($account_id, $switch_id);
|
|
||||||
|
|
||||||
$userInfo = $this->safeGetOrmUserInfo();
|
$userInfo = $this->safeGetOrmUserInfo();
|
||||||
if (!$userInfo) {
|
if (!$userInfo) {
|
||||||
@ -345,64 +345,15 @@ class RoleController extends BaseAuthedController {
|
|||||||
|
|
||||||
public function getRobotInfo()
|
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(
|
echo json_encode(array(
|
||||||
'errcode' => 0,
|
'errcode' => 0,
|
||||||
'errmsg' => '',
|
'errmsg' => '',
|
||||||
'member_list' => $member,
|
'member_list' => array(mt\Robot::getRandMember()),
|
||||||
'sin_member' => $robot_meta_cluster,
|
'sin_member' => mt\Robot::getSinMembers(),
|
||||||
'num' => $coin,
|
'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()
|
public function getFightReward()
|
||||||
{
|
{
|
||||||
$account_id = $_REQUEST['account_id'];
|
$account_id = $_REQUEST['account_id'];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user