6
0
Fork 0

下单不降级

release
李静 2022-01-07 20:27:03 +08:00
parent 1345f02b39
commit 6d4034e08b
2 changed files with 8 additions and 5 deletions

View File

@ -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,

View File

@ -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,