From a933a57882a089fd5f855accba62c131d9aa69e3 Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Fri, 1 Sep 2023 14:27:57 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=B8=AA=E4=BA=BA=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/User.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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