wanghousheng 8 months ago
parent 4548d8ca45
commit b432fa2691
  1. 26
      app/api/service/User.php
  2. 3
      app/api/service/identity/PaySuccess.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方法的二次封装

@ -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)));
}

Loading…
Cancel
Save