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; - } + // } } }