From c769fbbd3718c0958abd2b36175d93bc911f07f0 Mon Sep 17 00:00:00 2001 From: luofei <604446095@qq.com> Date: Sat, 2 Mar 2024 15:57:33 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BB=91=E5=AE=9A=E9=82=80?= =?UTF-8?q?=E8=AF=B7=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/repositories/user/UserRepository.php | 6 ++++++ app/controller/api/user/User.php | 7 +++++++ route/api.php | 1 + 3 files changed, 14 insertions(+) diff --git a/app/common/repositories/user/UserRepository.php b/app/common/repositories/user/UserRepository.php index c00ac160..ceb41dab 100644 --- a/app/common/repositories/user/UserRepository.php +++ b/app/common/repositories/user/UserRepository.php @@ -1649,4 +1649,10 @@ class UserRepository extends BaseRepository { return app()->make(UserInfoRepository::class)->getSearch(['is_used' => 1])->order(['sort', 'create_time' => 'ASC'])->select()->toArray(); } + + public function bindPromotionCode($promotionCode, $uid) + { + return $this->dao->update($uid, ['promotion_code' => $promotionCode, 'promoter_time' => date('Y-m-d H:i:s')]); + } + } diff --git a/app/controller/api/user/User.php b/app/controller/api/user/User.php index 277f9872..b06ec79c 100644 --- a/app/controller/api/user/User.php +++ b/app/controller/api/user/User.php @@ -589,4 +589,11 @@ class User extends BaseController return app('json')->success(['url' => $data]); } + public function bindPromotionCode() + { + $promotionCode = $this->request->param('promotion_code'); + $this->repository->bindPromotionCode($promotionCode, $this->request->uid()); + return app('json')->success('修改成功'); + } + } diff --git a/route/api.php b/route/api.php index bec9ef5f..90f2d7b3 100644 --- a/route/api.php +++ b/route/api.php @@ -115,6 +115,7 @@ Route::group('api/', function () { Route::post('change/phone', 'User/changePhone'); Route::post('change/info', 'User/updateBaseInfo'); Route::post('change/password', 'User/changePassword'); + Route::post('change/bind_promotion_code', 'User/bindPromotionCode'); //收藏 Route::get('/relation/product/lst', 'UserRelation/productList'); Route::get('/relation/merchant/lst', 'UserRelation/merchantList');