dev
vine_liutk 2022-11-21 12:01:35 +08:00
parent 2a22d31f4c
commit b4d4b022c8
2 changed files with 7 additions and 3 deletions

View File

@ -160,7 +160,11 @@ class CropYieldController extends Controller
$staticCropIds[] = $crop->id;
if ($crop->extends) {
$i = 0;
$extends = json_decode($crop->extends, true);
if(is_array($crop->extends)){
$extends = $crop->extends;
}else{
$extends = json_decode($crop->extends, true);
}
foreach ($extends as $item) {
$i++;
$_key = 'extend_'.$i;

View File

@ -29,8 +29,8 @@ class CropYieldListResource extends JsonResource
'yield' => $this->formatNumber($this->yield).$this->whenLoaded('crop', function () {
return $this->crop?->unit;
}, ''),
'output' => $this->formatNumber($this->output),
'cultivated' => $this->formatNumber($this->cultivated),
'output' => $this->formatNumber($this->output).'元',
'cultivated' => $this->formatNumber($this->cultivated).'亩',
'extends' => $this->extends,
'created_by' => $this->whenLoaded('createdBy', function () {
return $this->createdBy?->name;