新增标记土地全部成熟接口

This commit is contained in:
weiz 2023-10-31 16:26:11 +08:00
parent d269f344d5
commit 1389e5848a
2 changed files with 12 additions and 0 deletions

View File

@ -83,6 +83,7 @@
'crop_name' => $params['crop_name'],
'crop_variety' => $params['crop_variety'],
'crop_brand' => $params['crop_brand'],
'flag' => 1,
'seed_time' => time(),
'crop_buy_time' => strtotime($params['crop_buy_time'])
]);
@ -98,6 +99,16 @@
return $this->success('添加成功',[],1,1);
}
//标记全部成熟
public function landCropAllRipe() {
$params = $this->request->post(['crop_id']);
if(empty($params['crop_id'])){
return $this->fail('参数错误');
}
$result = Db::name('farmer_land_crop')->where('crop_id',$params['crop_id'])->update(['flag'=>2]);
return $result ? $this->success('请求成功',[],1,1) : $this->fail('请求失败',[],1,1);
}
//添加播种图片
public function addLandCropPic(): Json
{

View File

@ -35,6 +35,7 @@ class UserController extends BaseApiController
$land_crop = Db::name('farmer_land_crop')->where([
['user_id','=',$params['user_id']],
['land_id','=',$v['land_id']],
['flag','=',1]
])->order('id desc')->findOrEmpty();
if(!empty($land_crop)){
$lands[$k]['is_cropped'] = true;