From d6d542bd58964fe7d47d1bddbcb803dc601eab1f Mon Sep 17 00:00:00 2001 From: wanghongjun <1445693971@qq,com> Date: Thu, 2 Jan 2025 09:34:18 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=93=E6=8A=A5=E7=BB=9F=E8=AE=A1=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/admin/Index.php | 2 +- app/model/FinalReportDate.php | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/controller/admin/Index.php b/app/controller/admin/Index.php index 156dfca..6bc3b69 100644 --- a/app/controller/admin/Index.php +++ b/app/controller/admin/Index.php @@ -104,7 +104,7 @@ class Index extends Base { $dateArr[] = $nowDate; foreach ($dateArr as $key => $monthDate) { - $amountArr[$key] = (new FinalReportDate())->getSumAmount($monthDate); + $amountArr[$key] = (new FinalReportDate())->getSumAmount($monthDate, 2); } return $this->buildSuccess([ diff --git a/app/model/FinalReportDate.php b/app/model/FinalReportDate.php index 3617c08..badb792 100644 --- a/app/model/FinalReportDate.php +++ b/app/model/FinalReportDate.php @@ -7,11 +7,15 @@ use think\Model; class FinalReportDate extends Model { - public function getSumAmount($date) + public function getSumAmount($date, $type = 1) { $result = $this->where(['report_date' => $date])->field('id')->find(); if (!$result) return 0; $ydzse_sum = FinalReportData::getFrdSumAmount($result['id']); - return $ydzse_sum ? number_format($ydzse_sum, 2, '.', ',') : 0; + if ($type == 1) { + return $ydzse_sum ? number_format($ydzse_sum, 2, '.', ',') : 0; + } else { + return $ydzse_sum ?: 0; + } } }