修复图片上传类型选择
This commit is contained in:
parent
9caca3c5a0
commit
ea1f5ca2c1
|
@ -38,6 +38,7 @@
|
||||||
Db::name('farmer_animal_pic')->insert([
|
Db::name('farmer_animal_pic')->insert([
|
||||||
'animal_id' => $animalId,
|
'animal_id' => $animalId,
|
||||||
'pic' => $params['pic'],
|
'pic' => $params['pic'],
|
||||||
|
'type' => 1,
|
||||||
'create_time' => time()
|
'create_time' => time()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -100,8 +101,8 @@
|
||||||
//上传动物养殖情况图片
|
//上传动物养殖情况图片
|
||||||
public function addAnimalPic(): Json
|
public function addAnimalPic(): Json
|
||||||
{
|
{
|
||||||
$params = $this->request->post(['animal_id','pic']);
|
$params = $this->request->post(['animal_id','pic','type']);
|
||||||
if(empty($params['animal_id']) || empty($params['pic'])){
|
if(empty($params['animal_id']) || empty($params['pic']) || empty($params['type']) || !in_array($params['type'],[1,2])){
|
||||||
return $this->fail('参数错误');
|
return $this->fail('参数错误');
|
||||||
}
|
}
|
||||||
//写入数据
|
//写入数据
|
||||||
|
|
|
@ -88,6 +88,7 @@
|
||||||
if(!empty($params['pic'])){
|
if(!empty($params['pic'])){
|
||||||
Db::name('farmer_land_crop_pic')->insert([
|
Db::name('farmer_land_crop_pic')->insert([
|
||||||
'crop_id' => $landCropId,
|
'crop_id' => $landCropId,
|
||||||
|
'type' => 1,
|
||||||
'pic' => $params['pic'],
|
'pic' => $params['pic'],
|
||||||
'create_time' => time()
|
'create_time' => time()
|
||||||
]);
|
]);
|
||||||
|
@ -101,8 +102,8 @@
|
||||||
public function addLandCropPic(): Json
|
public function addLandCropPic(): Json
|
||||||
{
|
{
|
||||||
//获取参数
|
//获取参数
|
||||||
$params = $this->request->post(['crop_id','pic']);
|
$params = $this->request->post(['crop_id','pic','type']);
|
||||||
if(empty($params['crop_id']) || empty($params['pic'])){
|
if(empty($params['crop_id']) || empty($params['pic']) || empty($params['type']) || !in_array($params['type'],[1,2,3])){
|
||||||
return $this->fail('参数错误');
|
return $this->fail('参数错误');
|
||||||
}
|
}
|
||||||
//写入数据
|
//写入数据
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
Db::name('farmer_poultry_pic')->insert([
|
Db::name('farmer_poultry_pic')->insert([
|
||||||
'poultry_id' => $animalId,
|
'poultry_id' => $animalId,
|
||||||
'pic' => $params['pic'],
|
'pic' => $params['pic'],
|
||||||
|
'type' => 1,
|
||||||
'create_time' => time()
|
'create_time' => time()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -100,8 +101,8 @@
|
||||||
//上传家禽养殖情况图片
|
//上传家禽养殖情况图片
|
||||||
public function addPoultryPic(): Json
|
public function addPoultryPic(): Json
|
||||||
{
|
{
|
||||||
$params = $this->request->post(['poultry_id','pic']);
|
$params = $this->request->post(['poultry_id','pic','type']);
|
||||||
if(empty($params['poultry_id']) || empty($params['pic'])){
|
if(empty($params['poultry_id']) || empty($params['pic']) || empty($params['type']) || !in_array($params['type'],[1,2])){
|
||||||
return $this->fail('参数错误');
|
return $this->fail('参数错误');
|
||||||
}
|
}
|
||||||
//写入数据
|
//写入数据
|
||||||
|
|
Loading…
Reference in New Issue