From a3b43fdf5e695d969fd4a078c5c1f6c12c95e3bb Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Fri, 21 Jan 2022 15:37:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=89=B9=E9=9B=B6=E4=B8=AA?= =?UTF-8?q?=E4=BA=BA=E4=B8=AD=E5=BF=83=E4=B8=9A=E7=BB=A9=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Dealer.php | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) 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'); } /**