diff --git a/app/Models/Dealer.php b/app/Models/Dealer.php index ef89c8aa..78ac69f9 100644 --- a/app/Models/Dealer.php +++ b/app/Models/Dealer.php @@ -88,23 +88,23 @@ class Dealer extends Model */ public function getSaleValuesAttribute() { - return $this->self_sales_value + $this->team_sales_value; - // $tz = now(); + // return $this->self_sales_value + $this->team_sales_value; + $tz = now(); - // if ($tz->day >= 20) { - // // 结算当月20号开始的业绩 - // $startAt = $tz->copy()->setDay(20)->startOfDay(); - // } elseif ($tz->day >= 5) { - // // 结算当月5号开始的的业绩 - // $startAt = $tz->copy()->setDay(5)->startOfDay(); - // } else { - // // 结算上月20号开始的业绩 - // $startAt = $tz->copy()->subMonthNoOverflow()->setDay(20)->startOfDay(); - // } + if ($tz->day >= 20) { + // 结算当月20号开始的业绩 + $startAt = $tz->copy()->setDay(20)->startOfDay(); + } elseif ($tz->day >= 5) { + // 结算当月5号开始的的业绩 + $startAt = $tz->copy()->setDay(5)->startOfDay(); + } else { + // 结算上月20号开始的业绩 + $startAt = $tz->copy()->subMonthNoOverflow()->setDay(20)->startOfDay(); + } - // return DealerPurchaseLog::query()->where('order_completed_at', '>=', $startAt) - // ->where('path', 'like', "{$this->userInfo->full_path}%") - // ->sum('total_amount'); + return DealerPurchaseLog::query()->where('order_completed_at', '>=', $startAt) + ->where('path', 'like', "{$this->userInfo->full_path}%") + ->sum('total_amount'); } /**