From a4ed8551564034367e5ba2d272fad32fd9729188 Mon Sep 17 00:00:00 2001 From: wuhui_zzw <1760308791@qq.com> Date: Tue, 21 Nov 2023 15:27:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=EF=BC=9A=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E5=90=8E=E5=A6=82=E6=9E=9C=E4=B8=8D=E6=98=AF?= =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=91=98=E5=88=99=E5=BC=80=E5=90=AF=E6=8E=A8?= =?UTF-8?q?=E5=B9=BF=E5=91=98=E8=BA=AB=E4=BB=BD=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=EF=BC=9A=E7=94=B1=E4=BA=8E=E5=9B=BE=E7=89=87=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E5=AF=BC=E8=87=B4=E5=88=86=E9=94=80=E6=8E=A8?= =?UTF-8?q?=E5=B9=BF=E6=B5=B7=E6=8A=A5=E7=94=9F=E6=88=90=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/common/repositories/user/UserRepository.php | 9 +++++++-- app/controller/api/user/User.php | 9 ++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/app/common/repositories/user/UserRepository.php b/app/common/repositories/user/UserRepository.php index 54f8a13..49ea65b 100644 --- a/app/common/repositories/user/UserRepository.php +++ b/app/common/repositories/user/UserRepository.php @@ -1149,9 +1149,14 @@ class UserRepository extends BaseRepository public function returnToken($user, $tokenInfo) { - if (!$user->status) { - throw new ValidateException('账号已被禁用'); + if (!$user->status) throw new ValidateException('账号已被禁用'); + // 判断:如果用户未开启推广员 则开启推广员 + if($user->is_promoter != 1){ + $user->is_promoter = 1; + $user->promoter_time = date('Y-m-d H:i:s'); + $user->save(); } + $user = $user->hidden(['label_id', 'group_id', 'main_uid', 'pwd', 'addres', 'card_id', 'last_time', 'last_ip', 'create_time', 'mark', 'status', 'spread_uid', 'spread_time', 'real_name', 'birthday', 'brokerage_price'])->toArray(); return [ 'token' => $tokenInfo['token'], diff --git a/app/controller/api/user/User.php b/app/controller/api/user/User.php index 8c768ff..97e5e87 100644 --- a/app/controller/api/user/User.php +++ b/app/controller/api/user/User.php @@ -58,12 +58,15 @@ class User extends BaseController $type = $this->request->param('type'); $user = $this->user; $siteName = systemConfig('site_name'); - $qrcode = $type == 'routine' - ? $this->repository->mpQrcode($user) - : $this->repository->wxQrcode($user); + $qrcode = $type == 'routine' ? $this->repository->mpQrcode($user) : $this->repository->wxQrcode($user); $poster = systemGroupData('spread_banner'); $nickname = $user['nickname']; $mark = '邀请您加入' . $siteName; + // 处理图片路径 必须为https + $jsonPoster = json_encode($poster,JSON_UNESCAPED_SLASHES); + $jsonPoster = str_replace('http://','https://',$jsonPoster); + $poster = json_decode($jsonPoster,true); + return app('json')->success(compact('qrcode', 'poster', 'nickname', 'mark')); }