From f03f175b5ed1c0c9bba47f9f1874987b5719719d Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Mon, 21 Nov 2022 11:37:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=96=E6=B6=88=E5=90=8E=E5=8F=B0=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E5=9C=A8=E6=95=B0=E5=80=BC=E5=8A=A0=E4=B8=8A=E5=8D=95?= =?UTF-8?q?=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Http/Resources/CropYieldResource.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/Http/Resources/CropYieldResource.php b/app/Http/Resources/CropYieldResource.php index eb89f22..a7e02d1 100644 --- a/app/Http/Resources/CropYieldResource.php +++ b/app/Http/Resources/CropYieldResource.php @@ -23,14 +23,15 @@ class CropYieldResource extends JsonResource 'crop_name' => $this->whenLoaded('crop', function () { return $this->crop?->name; }, ''), + 'crop_unit' => $this->whenLoaded('crop', function () { + return $this->crop?->unit; + }, ''), 'crop_id' => $this->crop_id, 'time_year' => $this->time_year, 'quarter' => $this->quarter, - 'yield' => $this->formatNumber($this->yield).$this->whenLoaded('crop', function () { - return $this->crop?->unit ?? ''; - }, ''), - 'output' => $this->formatNumber($this->output).'元', - 'cultivated' => $this->formatNumber($this->cultivated).'亩', + 'yield' => $this->formatNumber($this->yield), + 'output' => $this->formatNumber($this->output), + 'cultivated' => $this->formatNumber($this->cultivated), 'extends' => $this->extends, 'created_by' => $this->whenLoaded('createdBy', function () { return $this->createdBy?->name; @@ -40,10 +41,10 @@ class CropYieldResource extends JsonResource } private function formatNumber($number){ - if($number > 10000){ - return round($number/10000, 2).'万'; - }else{ + // if($number > 10000){ + // return round($number/10000, 2).'万'; + // }else{ return $number; - } + // } } }