增加种植详情接口

This commit is contained in:
weiz 2023-11-27 17:52:52 +08:00
parent 762a5c5f11
commit c5f29c6164
1 changed files with 14 additions and 0 deletions

View File

@ -24,6 +24,20 @@
return $this->success('请求成功',$data);
}
public function detail(): Json
{
$params = $this->request->get(['plant_id']);
if(empty($params['plant_id'])){
return $this->fail('缺少必要参数');
}
$data = Plant::where('id',$params['plant_id'])->findOrEmpty();
if($data->isEmpty()){
return $this->fail('种植信息错误');
}
$data['pic'] = json_decode($data['pic'],true);
return $this->success('请求成功',$data->toArray());
}
//添加种植
public function add(): Json
{