diff --git a/app/controller/User.php b/app/controller/User.php index a75ba5a..ae95946 100644 --- a/app/controller/User.php +++ b/app/controller/User.php @@ -168,4 +168,24 @@ class User extends BaseController 'total' => $list->total() ]); } + + /** + * 用户信息 + * @return array + * @throws \think\db\exception\DataNotFoundException + * @throws \think\db\exception\DbException + * @throws \think\db\exception\ModelNotFoundException + */ + public function userInfo() + { + $userData = Session::get('login_user_data'); + + $UserModel = new UserModel(); + + $info = $UserModel->field('id,avatar,balance,withdrawal_balance')->where('id',$userData['id'])->find(); + + $info['avatar'] = get_image_url($info['avatar']); + + return $this->renderSuccess('数据返回成功',['data' => $info]); + } } \ No newline at end of file