|
|
|
@ -356,7 +356,7 @@ class PaySuccess extends BaseService |
|
|
|
|
$orderInfo = $this->orderInfo; |
|
|
|
|
$userInfo = $this->userInfo; |
|
|
|
|
//判断当前用户角色 |
|
|
|
|
$orderType = $orderInfo['type']; |
|
|
|
|
$orderType = $orderInfo['order_type']; |
|
|
|
|
$userType = $userInfo['user_type']; |
|
|
|
|
if ($userType == UserTypeEnum::STORE) { |
|
|
|
|
return; |
|
|
|
@ -364,15 +364,25 @@ class PaySuccess extends BaseService |
|
|
|
|
$userModel = new UserModel(); |
|
|
|
|
$up = []; |
|
|
|
|
$time = date('Y-m-d'); |
|
|
|
|
if (!empty($userInfo['effective_time']) && strtotime($userInfo['effective_time']) > strtotime(date('Y-m-d'))) { |
|
|
|
|
$time = $userInfo['effective_time']; |
|
|
|
|
} |
|
|
|
|
//已经是会员或者未开通会员 |
|
|
|
|
if ($orderType == IdentityEnum::MEMBER && $userType != UserTypeEnum::DEALER) { |
|
|
|
|
$up['user_type'] = UserTypeEnum::MEMBER; |
|
|
|
|
//已经是会员 |
|
|
|
|
if ($userType == UserTypeEnum::MEMBER) { |
|
|
|
|
//是否到期 |
|
|
|
|
if (!empty($userInfo['effective_time']) && strtotime($userInfo['effective_time']) > strtotime(date('Y-m-d'))) { |
|
|
|
|
$time = $userInfo['effective_time']; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
//分销商 |
|
|
|
|
$up['user_type'] = UserTypeEnum::DEALER; |
|
|
|
|
//已经是分销商 |
|
|
|
|
if ($userType == UserTypeEnum::DEALER) { |
|
|
|
|
//是否到期 |
|
|
|
|
if (!empty($userInfo['effective_time']) && strtotime($userInfo['effective_time']) > strtotime(date('Y-m-d'))) { |
|
|
|
|
$time = $userInfo['effective_time']; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (!User::isDealerUser($userInfo['user_id'])) { |
|
|
|
|
// 新增分销商用户 |
|
|
|
|
User::add($userInfo['user_id'], [ |
|
|
|
@ -383,5 +393,6 @@ class PaySuccess extends BaseService |
|
|
|
|
} |
|
|
|
|
$up['effective_time'] = date("Y-m-d", strtotime("+{$orderInfo['month']} months", strtotime($time))); |
|
|
|
|
$userModel->where(['user_id' => $userInfo['user_id']])->save($up); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |