Merge pull request 'update' (#36) from zhangwei into dev

Reviewed-on: #36
This commit is contained in:
weiz 2023-12-01 11:31:02 +08:00
commit d83701edd3
2 changed files with 4 additions and 1 deletions

View File

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

View File

@ -144,7 +144,9 @@ class IndexController extends BaseApiController
return $this->fail('土地信息错误');
}
$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['harvest_date'] = date('Y-m-d',$plantInfo['harvest_date']);
$plantInfo['land_name'] = $landInfo['title'];
$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'];