From b2e91c6c7115b8585924eb8dc6dfabfd662f0fbb Mon Sep 17 00:00:00 2001 From: limu <123456> Date: Thu, 18 Jan 2024 17:04:53 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E8=A1=A5=E5=85=A8-sb=20?= =?UTF-8?q?=E7=8E=8B=E9=B8=A3=E5=B7=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/api/user/User.php | 54 ++++++++++++++++++++++++++++++++ route/api.php | 3 ++ 2 files changed, 57 insertions(+) diff --git a/app/controller/api/user/User.php b/app/controller/api/user/User.php index 9afe799..323a79c 100644 --- a/app/controller/api/user/User.php +++ b/app/controller/api/user/User.php @@ -322,11 +322,65 @@ class User extends BaseController public function account() { + $user = $this->user; if (!$user->phone) return app('json')->fail('请绑定手机号'); + return app('json')->success($this->repository->selfUserList($user->phone)); } + public function getCheck() + { + + $user = $this->user; + $data['card'] = $user->card ?? ''; + $data['age'] = $user->age ?? ''; + $data['spread_uid'] = $user->spread_uid ?? ''; + $data['real_name'] = $user->real_name ?? ''; + + $b = ''; + if(!empty($data['spread_uid'])){ + $a = userModel::getDB()->where('uid',$data['spread_uid'])->find(); + $b = $a->phone; + } + $data['spread_phone'] = $b ?? ''; + + return app('json')->success($data); + } + + public function update() + { + $age = $this->request->param('age') ?? ''; + $card = $this->request->param('card') ?? ''; + $spread_phone = $this->request->param('spread_phone') ?? ''; + $real_name = $this->request->param('real_name') ?? ''; + + $user = userModel::getDB()->where('uid',$this->user->uid)->find(); + if(!empty($age)){ + $user->age = $age; + } + + if(!empty($card)){ + $user->card = $card; + } + + if(!empty($real_name)){ + $user->real_name = $real_name; + } + + + if(!empty($spread_phone)){ + $a = userModel::getDB()->where('phone',$spread_phone)->find(); + if(!$a){ + return app('json')->fail('查无此推荐人'); + } + $user->spread_uid = $a->uid; + } + + $user->save(); + return app('json')->success('更新成功'); + } + //wmc //分享视频/推文增加品宣积分 public function brand() diff --git a/route/api.php b/route/api.php index dbdf524..40f46a0 100644 --- a/route/api.php +++ b/route/api.php @@ -117,6 +117,9 @@ Route::group('api/', function () { Route::get('cashLog', 'User/cashLog'); Route::get('getAreaList', 'User/getAreaList'); + Route::get('getCheck', 'User/getCheck'); + Route::get('update', 'User/update'); + Route::post('switch', 'User/switchUser');