From 50de5cf963b5e1dd79a994692f38ef13df62e9bb Mon Sep 17 00:00:00 2001 From: weiz Date: Fri, 1 Dec 2023 11:30:09 +0800 Subject: [PATCH] update --- app/api/controller/ActionController.php | 3 ++- app/api/controller/IndexController.php | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/api/controller/ActionController.php b/app/api/controller/ActionController.php index f66fc912..93543653 100644 --- a/app/api/controller/ActionController.php +++ b/app/api/controller/ActionController.php @@ -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'], diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index 3fda6b20..ea2afb7a 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -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']; -- 2.40.1