From d84f5d4413b29825ef69a35cb52be139f53c3c09 Mon Sep 17 00:00:00 2001 From: chenbo <709206448@qq.com> Date: Fri, 12 Jan 2024 15:11:45 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E7=94=A8=E6=88=B7=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E9=82=80=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 | 5 +++++ app/controller/api/user/User.php | 7 +++++++ route/api.php | 1 + 3 files changed, 13 insertions(+) diff --git a/app/common/repositories/user/UserRepository.php b/app/common/repositories/user/UserRepository.php index 745a1e26..06a66528 100644 --- a/app/common/repositories/user/UserRepository.php +++ b/app/common/repositories/user/UserRepository.php @@ -1472,4 +1472,9 @@ class UserRepository extends BaseRepository } }); } + + 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 1b0d602d..609cce5f 100644 --- a/app/controller/api/user/User.php +++ b/app/controller/api/user/User.php @@ -528,4 +528,11 @@ class User extends BaseController return app('json')->success('修改成功'); } + 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 b726a9b3..354bac62 100644 --- a/route/api.php +++ b/route/api.php @@ -171,6 +171,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');