update #36

Merged
weiz merged 1 commits from zhangwei into dev 2023-12-01 11:31:03 +08:00
2 changed files with 4 additions and 1 deletions

View File

@ -81,7 +81,8 @@
$qrCodeFile = $qrCode->png($qrCodeUrl,false, 6)->entry(); $qrCodeFile = $qrCode->png($qrCodeUrl,false, 6)->entry();
Plant::where('id',$params['plant_id'])->update([ Plant::where('id',$params['plant_id'])->update([
'status'=>2, 'status'=>2,
'qr_code' => empty($qrCodeFile) ? '' : $qrCodeFile 'qr_code' => empty($qrCodeFile) ? '' : $qrCodeFile,
'harvest_date' => time(),
]); ]);
Land::where('id',$plant['land_id'])->update([ Land::where('id',$plant['land_id'])->update([
'residual_area'=>$land['residual_area']+$plant['area'], 'residual_area'=>$land['residual_area']+$plant['area'],

View File

@ -144,7 +144,9 @@ class IndexController extends BaseApiController
return $this->fail('土地信息错误'); return $this->fail('土地信息错误');
} }
$plantInfo['pic'] = json_decode($plantInfo['pic'],true); $plantInfo['pic'] = json_decode($plantInfo['pic'],true);
$plantInfo['group_day'] = floor(($plantInfo['harvest_date'] - $plantInfo['plant_date']) / 86400);
$plantInfo['plant_date'] = date('Y-m-d',$plantInfo['plant_date']); $plantInfo['plant_date'] = date('Y-m-d',$plantInfo['plant_date']);
$plantInfo['harvest_date'] = date('Y-m-d',$plantInfo['harvest_date']);
$plantInfo['land_name'] = $landInfo['title']; $plantInfo['land_name'] = $landInfo['title'];
$plantInfo['land_area'] = $landInfo['total_area']; $plantInfo['land_area'] = $landInfo['total_area'];
$plantInfo['land_address'] = $landInfo['province_name'].$landInfo['city_name'].$landInfo['county_name'].$landInfo['town_name'].$landInfo['village_name'].$landInfo['group_name']; $plantInfo['land_address'] = $landInfo['province_name'].$landInfo['city_name'].$landInfo['county_name'].$landInfo['town_name'].$landInfo['village_name'].$landInfo['group_name'];