info@User ok

This commit is contained in:
aozhiwei 2021-11-29 13:55:16 +08:00
parent ac74da7a13
commit 11d3b7cdf4
4 changed files with 72 additions and 0 deletions

View File

@ -19,6 +19,33 @@ class User(object):
['info',_common.UserInfo(), '用户信息']
]
},
{
'name': 'update',
'desc': '更新用户信息',
'group': 'User',
'url': 'webapp/index.php?c=User&a=update',
'params': [
_common.ReqHead(),
['hero_id', 0, '更新上阵英雄id(可选参数,不传就不更新)']
],
'response': [
_common.RspHead(),
]
},
{
'name': 'info',
'desc': '获取用户信息',
'group': 'User',
'url': 'webapp/index.php?c=User&a=info',
'params': [
_common.ReqHead(),
['target_id', '', '用户account_id(如果要获取自己的就传自己的account_id)']
],
'response': [
_common.RspHead(),
['info',_common.UserInfo(), '用户信息']
]
},
{
'name': 'clientBattleReport',
'desc': '客户端战报',

View File

@ -38,6 +38,7 @@ class UserInfo(object):
def __init__(self):
self.fields = [
['account_id', '', '账号id'],
['name', '', '用户名字'],
['head_id', 0, '头像id'],
['head_frame', 0, '头像框id'],

View File

@ -91,6 +91,32 @@ class UserController extends BaseAuthedController {
}
}
public function update()
{
$validFields = array(
);
}
public function info()
{
$targetId = getReqVal('target_id', '');
$userDb = SqlHelper::ormSelectOne
($this->_getMysql($targetId),
't_user',
array(
'account_id' => $targetId
)
);
if (!$userDb) {
$this->_rspErr(1, '账号不存在');
return;
}
$this->_rspData(array(
'info' => User::info($userDb)
));
}
public function clientBattleReport()
{
$this->_updateUserInfo(array(

View File

@ -7,6 +7,24 @@ class User extends BaseModel {
public static function show($row)
{
return array(
'account_id' => $row['account_id'],
'name' => $row['name'],
'sex' => $row['sex'],
'head_id' => $row['hero_id'],
'head_frame' => $row['head_frame'],
'level' => $row['level'],
'exp' => $row['exp'],
'gold' => $row['gold'],
'diamond' => $row['diamond'],
'hero_id' => $row['hero_id'],
'first_fight' => $row['first_fight'],
);
}
public static function info($row)
{
return array(
'account_id' => $row['account_id'],
'name' => $row['name'],
'sex' => $row['sex'],
'head_id' => $row['hero_id'],