From b7f8c6ad4205f3adb7b9cea1f87b0a20e0ed6ab9 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Tue, 25 Jun 2024 18:12:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E4=BA=86=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E9=80=BB=E8=BE=91=E4=BB=A5=E4=BD=BF=E7=94=A8=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E7=9A=84=E6=97=A5=E6=9C=9F=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/statistics/logic/ProductLogic.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/statistics/logic/ProductLogic.php b/app/statistics/logic/ProductLogic.php index 8fad8de91..06be8df22 100644 --- a/app/statistics/logic/ProductLogic.php +++ b/app/statistics/logic/ProductLogic.php @@ -9,20 +9,20 @@ class ProductLogic extends BaseLogic { public static function Count($where,$time) { - $todayProductCount=StoreBranchProduct::where($where)->whereDay($time)->count(); + $todayProductCount=StoreBranchProduct::where($where)->whereDay('create_time',$time)->count(); $yestertodayProductCount=StoreBranchProduct::where($where)->where('create_time', '<',strtotime($time)-1)->count(); if ($yestertodayProductCount == 0 ||$todayProductCount==0) { $weeklyProductTotalGrowthRate = 0; } else { - $weeklyProductTotalGrowthRate = ($todayProductCount - $yestertodayProductCount) / $yestertodayProductCount * 100; + $weeklyProductTotalGrowthRate =bcdiv(($todayProductCount - $yestertodayProductCount) ,$yestertodayProductCount) * 100; } $todayNewProductCount=StoreBranchProduct::where($where)->whereDay('create_time',$time)->count(); $yestertodayNewProductCount=StoreBranchProduct::where($where)->whereDay('create_time', date('Y-m-d',strtotime($time)-1))->count(); - if ($yestertodayProductCount == 0 ||$todayProductCount==0) { + if ($todayNewProductCount == 0 ||$yestertodayNewProductCount==0) { $weeklyNewProductTotalGrowthRate = 0; } else { - $weeklyNewProductTotalGrowthRate = ($todayNewProductCount - $yestertodayNewProductCount) / $yestertodayNewProductCount * 100; + $weeklyNewProductTotalGrowthRate =bcdiv(($todayNewProductCount - $yestertodayNewProductCount),$yestertodayNewProductCount) * 100; } $data = [ "totalProductCounInfo" => [