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