From b432fa2691acc24bef4f454d4f945f5a094e2eae Mon Sep 17 00:00:00 2001 From: wanghousheng Date: Mon, 25 Mar 2024 23:46:32 +0800 Subject: [PATCH] 1 --- app/api/service/User.php | 26 +++++++++++++++++++++---- app/api/service/identity/PaySuccess.php | 3 +++ 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/app/api/service/User.php b/app/api/service/User.php index 95695d9c..60cf1f9b 100644 --- a/app/api/service/User.php +++ b/app/api/service/User.php @@ -93,7 +93,7 @@ class User extends UserService $userId = self::getCurrentLoginUserId(); //分销表里有没有 $dealerInfo = \app\api\model\dealer\User::detail($userId, []); - if (!empty($dealerInfo) && self::checkEffectiveTime()) { + if (!empty($dealerInfo) && self::checkFxEffectiveTime()) { return true; } } @@ -113,7 +113,7 @@ class User extends UserService $userId = self::getCurrentLoginUserId(); //分销表里有没有 $dealerInfo = \app\api\model\dealer\User::detail($userId, []); - if (!empty($dealerInfo) && self::checkEffectiveTime() && $dealerInfo['type'] == DealerUserEnum::ENGINEER) { + if (!empty($dealerInfo) && self::checkFxEffectiveTime() && $dealerInfo['type'] == DealerUserEnum::ENGINEER) { return true; } } @@ -133,7 +133,7 @@ class User extends UserService if ($userInfo && $userInfo['user_type'] == UserTypeEnum::STORE) { $userId = $userInfo['user_id']; - + //商家表里有没有 $model = new \app\common\model\store\User(); $store_id = $model->where(['user_id' => $userId])->value('store_id'); @@ -160,7 +160,7 @@ class User extends UserService } /** - * @notes:检测plus会员 分销商是否到期 + * @notes:检测plus会员是否到期 * @return bool * @throws BaseException * @author: wanghousheng @@ -177,6 +177,24 @@ class User extends UserService return false; } + /** + * @notes:检测分销商是否到期 + * @return bool + * @throws BaseException + * @author: wanghousheng + */ + private static function checkFxEffectiveTime(): bool + { + $userInfo = static::getCurrentLoginUser(); + if (!empty($userInfo) && !empty($userInfo['fx_effective_time'])) { + $effective_time = strtotime($userInfo['fx_effective_time'] . ' 23:59:59'); + if (time() < $effective_time) { + return true; + } + } + return false; + } + /** * 获取当前登录的用户身份 * getCurrentLoginUser方法的二次封装 diff --git a/app/api/service/identity/PaySuccess.php b/app/api/service/identity/PaySuccess.php index 204b6d96..404331c5 100644 --- a/app/api/service/identity/PaySuccess.php +++ b/app/api/service/identity/PaySuccess.php @@ -392,6 +392,9 @@ class PaySuccess extends BaseService 'real_name' => $mobile, 'mobile' => $mobile, ]); + } else { + //更新分销用户 + User::update(['is_delete' => 0], ['user_id' => $userInfo['user_id']]); } $up['fx_effective_time'] = date("Y-m-d", strtotime("+{$orderInfo['month']} months", strtotime($time))); }