diff --git a/doc/User.py b/doc/User.py index c0456727..1f46e16d 100644 --- a/doc/User.py +++ b/doc/User.py @@ -83,6 +83,20 @@ class User(object): ['info',_common.UserInfo(), '用户信息'], ] }, + { + 'name': 'query', + 'desc': '通过名字查询用户信息(精准查询)', + 'group': 'User', + 'url': 'webapp/index.php?c=User&a=query', + 'params': [ + _common.ReqHead(), + ['name', '', '角色名'] + ], + 'response': [ + _common.RspHead(), + ['info',_common.UserInfo(), '用户信息'], + ] + }, { 'name': 'detailInfo', 'desc': '获取用户信息(详细)', diff --git a/webapp/controller/UserController.class.php b/webapp/controller/UserController.class.php index 2c843c56..4209a9de 100644 --- a/webapp/controller/UserController.class.php +++ b/webapp/controller/UserController.class.php @@ -367,6 +367,30 @@ class UserController extends BaseAuthedController { )); } + public function query() + { + $name = getReqVal('name', ''); + $userDb = SqlHelper::ormSelectOne + ($this->_getMysql($name), + 't_user', + array( + 'name' => $name + ) + ); + if (!$userDb) { + $this->_rspErr(1, 'not found'); + return; + } + $channel = phpcommon\extractChannel($userDb['account_id']); + if ($channel != BC_CHANNEL) { + $this->_rspErr(1, 'not found'); + return; + } + $this->_rspData(array( + 'info' => User::info($userDb) + )); + } + public function detailInfo() { $targetId = getReqVal('target_id', '');