下单不降级
parent
1345f02b39
commit
6d4034e08b
|
|
@ -350,9 +350,10 @@ class UserInfo extends Model
|
|||
* 变更预收益成长值
|
||||
*
|
||||
* @param float $growthValue
|
||||
* @param bool $downgrade
|
||||
* @return void
|
||||
*/
|
||||
public function incrPreGrowthValue($growthValue)
|
||||
public function incrPreGrowthValue($growthValue, $downgrade = true)
|
||||
{
|
||||
if (bccomp($growthValue, '0', 2) === 0) {
|
||||
return;
|
||||
|
|
@ -365,9 +366,11 @@ class UserInfo extends Model
|
|||
$compared = bccomp($totalGrowthValue, config('agent.upgrade_rules.vip.sales_value'), 2);
|
||||
|
||||
if ($this->agent_level === static::AGENT_LEVEL_VIP && $compared < 0) {
|
||||
$this->update([
|
||||
'agent_level' => static::AGENT_LEVEL_CIVILIAN,
|
||||
]);
|
||||
if ($downgrade) {
|
||||
$this->update([
|
||||
'agent_level' => static::AGENT_LEVEL_CIVILIAN,
|
||||
]);
|
||||
}
|
||||
} elseif ($this->agent_level === static::AGENT_LEVEL_CIVILIAN && $compared >= 0) {
|
||||
$this->update([
|
||||
'agent_level' => static::AGENT_LEVEL_VIP,
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ class PayService
|
|||
]);
|
||||
|
||||
// 增加用户的预成长值
|
||||
$payable->user->userInfo->incrPreGrowthValue($payable->sales_value);
|
||||
$payable->user->userInfo->incrPreGrowthValue($payable->sales_value, false);
|
||||
|
||||
DistributionPreIncomeJob::create([
|
||||
'jobable_id' => $payable->id,
|
||||
|
|
|
|||
Loading…
Reference in New Issue