From 365eb2b811762665ae40ddc4d453a778bb7640bd Mon Sep 17 00:00:00 2001 From: ctexthuang Date: Thu, 27 Feb 2025 15:45:41 +0800 Subject: [PATCH] feat : coupon --- app/Service/Api/Login/LoginBaseService.php | 8 ++++++++ app/Service/Api/Login/LoginService.php | 2 +- app/Service/Api/Login/WxFastLoginService.php | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/Service/Api/Login/LoginBaseService.php b/app/Service/Api/Login/LoginBaseService.php index 891ec16..47a1664 100644 --- a/app/Service/Api/Login/LoginBaseService.php +++ b/app/Service/Api/Login/LoginBaseService.php @@ -97,6 +97,11 @@ abstract class LoginBaseService extends BaseService */ protected string $unionId = ''; + /** + * @var int 是否新人弹窗 + */ + protected int $isNewcomerCouponPopUp = 0; + /** * 登录 * @return void @@ -127,6 +132,7 @@ abstract class LoginBaseService extends BaseService 'is_bind_mobile' => $this->userInfo->mobile ? UserCode::IS_BIND_PHONE : UserCode::IS_NOT_BIND_PHONE, 'nickName' => $this->userInfo->nickName, 'is_default_avatar' => $this->userInfo->avatar_id == 0 ? UserCode::IS_DEFAULT_AVATAR : UserCode::IS_NOT_DEFAULT_AVATAR, + 'is_newcomer_coupon_pop_up' => $this->isNewcomerCouponPopUp, ]; $loginReturn['token'] = $this->cryptoFactory->cryptoClass('jwt', json_encode($loginReturn))->encrypt(); @@ -230,6 +236,8 @@ abstract class LoginBaseService extends BaseService if (empty($insertCoupon)) return; if (!(new UserCoupon)->insert($insertCoupon)) throw new ErrException('注册失败-00003'); + + $this->isNewcomerCouponPopUp = 1; } abstract protected function register(); diff --git a/app/Service/Api/Login/LoginService.php b/app/Service/Api/Login/LoginService.php index 7395646..4718c1c 100644 --- a/app/Service/Api/Login/LoginService.php +++ b/app/Service/Api/Login/LoginService.php @@ -17,7 +17,7 @@ class LoginService extends BaseService { protected string $loginType = ''; - public function handle() + public function handle(): array { $this->loginType = $this->request->input('login_type',''); diff --git a/app/Service/Api/Login/WxFastLoginService.php b/app/Service/Api/Login/WxFastLoginService.php index deddf73..d94a0dc 100644 --- a/app/Service/Api/Login/WxFastLoginService.php +++ b/app/Service/Api/Login/WxFastLoginService.php @@ -35,7 +35,7 @@ class WxFastLoginService extends LoginBaseService * @throws NotFoundExceptionInterface * @throws RedisException */ - public function handle() + public function handle(): array { $this->jsCode = $this->request->input('js_code');