Merge branch 'hjb' of git.kingsome.cn:server/game2006api into hjb
This commit is contained in:
commit
9b66a8e0eb
13
doc/User.py
13
doc/User.py
@ -69,6 +69,19 @@ class User(object):
|
||||
['info',_common.UserInfo(), '用户信息'],
|
||||
]
|
||||
},
|
||||
{
|
||||
'name': 'getBattleInfo',
|
||||
'desc': '获取用户战斗信息',
|
||||
'group': 'User',
|
||||
'url': 'webapp/index.php?c=User&a=getBattleInfo',
|
||||
'params': [
|
||||
_common.ReqHead(),
|
||||
],
|
||||
'response': [
|
||||
_common.RspHead(),
|
||||
['info',_common.UserBattleInfo(), '用户战斗信息'],
|
||||
]
|
||||
},
|
||||
{
|
||||
'name': 'query',
|
||||
'desc': '通过名字查询用户信息(精准查询)',
|
||||
|
@ -162,6 +162,14 @@ class UserInfo(object):
|
||||
['!honor_info', [HonorInfo()], '荣誉信息'],
|
||||
]
|
||||
|
||||
class UserBattleInfo(object):
|
||||
|
||||
def __init__(self):
|
||||
self.fields = [
|
||||
['user_info', [UserInfo()], '用户信息'],
|
||||
['hero_info', [HeroInfo()], '上阵英雄信息'],
|
||||
]
|
||||
|
||||
class HonorInfo(object):
|
||||
|
||||
def __init__(self):
|
||||
|
@ -451,6 +451,35 @@ class UserController extends BaseAuthedController {
|
||||
));
|
||||
}
|
||||
|
||||
public function getBattleInfo()
|
||||
{
|
||||
$userDb = SqlHelper::ormSelectOne
|
||||
(myself()->_getSelfMysql(),
|
||||
't_user',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId()
|
||||
)
|
||||
);
|
||||
if (!$userDb) {
|
||||
$this->_rspErr(1, 'Account does not exist');
|
||||
return;
|
||||
}
|
||||
$userInfo = User::Info($userDb);
|
||||
$heroDb = Hero::findByAccountId(myself()->_getAccountId(), $userDb['hero_uniid']);
|
||||
if (!$heroDb) {
|
||||
$this->_rspErr(1, 'Hero does not exist');
|
||||
return;
|
||||
}
|
||||
$heroInfo = Hero::toDto($heroDb);
|
||||
$heroInfo['avatar_info'] = Hero::avatarInfo($heroDb);
|
||||
myself()->_rspData(array(
|
||||
'info' => array(
|
||||
'user_info' => $userInfo,
|
||||
'hero_info' => $heroInfo
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
public function query()
|
||||
{
|
||||
$name = getReqVal('name', '');
|
||||
|
Loading…
x
Reference in New Issue
Block a user