diff --git a/app/Console/Commands/OrderSettleCommand.php b/app/Console/Commands/OrderSettleCommand.php index 366ec30e..65030523 100644 --- a/app/Console/Commands/OrderSettleCommand.php +++ b/app/Console/Commands/OrderSettleCommand.php @@ -102,7 +102,6 @@ class OrderSettleCommand extends Command // 更新下单用户的成长值和预成长值 $order->user->userInfo()->update([ 'growth_value' => DB::raw("growth_value+{$salesValue}"), - 'pre_growth_value' => DB::raw("pre_growth_value-{$salesValue}"), ]); // 下单用户的销售值日志 diff --git a/app/Models/UserInfo.php b/app/Models/UserInfo.php index 0e232375..02fcacac 100644 --- a/app/Models/UserInfo.php +++ b/app/Models/UserInfo.php @@ -58,7 +58,6 @@ class UserInfo extends Model 'quota_v1', 'quota_v2', 'growth_value', - 'pre_growth_value', 'group_sales_value', 'real_inviter_id', ]; @@ -383,38 +382,6 @@ class UserInfo extends Model ]); } - /** - * 变更预收益成长值 - * - * @param float $growthValue - * @param bool $downgrade - * @return void - */ - public function incrPreGrowthValue($growthValue, $downgrade = true) - { - if (bccomp($growthValue, '0', 2) === 0) { - return; - } - - // 增加预收益的成长值 - $this->increment('pre_growth_value', $growthValue); - - $totalGrowthValue = bcadd($this->growth_value, $this->pre_growth_value, 2); - $compared = bccomp($totalGrowthValue, config('agent.upgrade_rules.vip.sales_value'), 2); - - if ($this->agent_level === static::AGENT_LEVEL_VIP && $compared < 0) { - 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, - ]); - } - } - /** * 获取此用户的所有父级ID * diff --git a/app/Services/AfterSaleService.php b/app/Services/AfterSaleService.php index f06b0af4..7d932565 100644 --- a/app/Services/AfterSaleService.php +++ b/app/Services/AfterSaleService.php @@ -423,10 +423,6 @@ class AfterSaleService // 2.生成分销任务 // 3.生成新订单 - if (bccomp($afterSale->sales_value, '0', 2) === 1) { - $order->user->userInfo->incrPreGrowthValue(bcmul($afterSale->sales_value, '-1', 2)); - } - // 非赠品售后单,且售后单类型是换货、退款、退款退货 if (! $afterSaleProduct->isGift() && in_array($afterSale->type, [ diff --git a/app/Services/OrderService.php b/app/Services/OrderService.php index dccf3c7e..5f7a4e38 100644 --- a/app/Services/OrderService.php +++ b/app/Services/OrderService.php @@ -1075,9 +1075,6 @@ class OrderService 'reason' => '取消订单', ]); - // 扣除用户的预成长值 - $order->user->userInfo->incrPreGrowthValue(bcmul($order->sales_value, '-1', 2)); - DistributionPreIncomeJob::create([ 'jobable_id' => $refundLog->id, 'jobable_type' => $refundLog->getMorphClass(), diff --git a/app/Services/PayService.php b/app/Services/PayService.php index 6a67fa3e..5c4806e4 100644 --- a/app/Services/PayService.php +++ b/app/Services/PayService.php @@ -72,9 +72,6 @@ class PayService 'status' => Order::STATUS_PAID, ]); - // 增加用户预成长值 - $payable->userInfo->incrPreGrowthValue($payable->sales_value, false); - DistributionPreIncomeJob::create([ 'jobable_id' => $payable->id, 'jobable_type' => $payable->getMorphClass(), diff --git a/database/migrations/2021_12_28_153510_add_pre_growths_value_to_user_infos_table.php b/database/migrations/2021_12_28_153510_add_pre_growths_value_to_user_infos_table.php deleted file mode 100644 index ec278967..00000000 --- a/database/migrations/2021_12_28_153510_add_pre_growths_value_to_user_infos_table.php +++ /dev/null @@ -1,32 +0,0 @@ -unsignedDecimal('pre_growth_value', 18, 2)->default(0)->comment('预收益成长值'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('user_infos', function (Blueprint $table) { - $table->dropColumn(['pre_growth_value']); - }); - } -}