update
This commit is contained in:
parent
3d6dd82a74
commit
863895d3bc
|
@ -59,7 +59,7 @@
|
|||
public function add(): Json
|
||||
{
|
||||
//获取参数并验证
|
||||
$fields = ['title','area','province_code','city_code','county_code','town_code','village_code','group_code','master_name','master_phone','pic'];
|
||||
$fields = ['title','area','province_code','city_code','county_code','address','longitude','latitude','master_name','master_phone','pic'];
|
||||
$params = $this->request->post($fields);
|
||||
foreach($fields as $v){
|
||||
if(!isset($params[$v]) || $params[$v] == ''){
|
||||
|
@ -84,18 +84,6 @@
|
|||
if($county->isEmpty()){
|
||||
return $this->fail('区县编码错误');
|
||||
}
|
||||
$town = Town::field('town_name')->where('county_code',$params['county_code'])->where('town_code',$params['town_code'])->findOrEmpty();
|
||||
if($town->isEmpty()){
|
||||
return $this->fail('镇街编码错误');
|
||||
}
|
||||
$village = Village::field('village_name')->where('town_code',$params['town_code'])->where('village_code',$params['village_code'])->findOrEmpty();
|
||||
if($village->isEmpty()){
|
||||
return $this->fail('乡村编码错误');
|
||||
}
|
||||
$group = Group::field('group_name')->where('id',$params['group_code'])->findOrEmpty();
|
||||
if($group->isEmpty()){
|
||||
return $this->fail('小组编码错误');
|
||||
}
|
||||
//验证土地图片字段是否是json数组
|
||||
$pic = json_decode($params['pic'],true);
|
||||
if(empty($pic)){
|
||||
|
@ -113,12 +101,9 @@
|
|||
'city_name' => $city['city_name'],
|
||||
'county_code' => $params['county_code'],
|
||||
'county_name' => $county['county_name'],
|
||||
'town_code' => $params['town_code'],
|
||||
'town_name' => $town['town_name'],
|
||||
'village_code' => $params['village_code'],
|
||||
'village_name' => $village['village_name'],
|
||||
'group_code' => $params['group_code'],
|
||||
'group_name' => $group['group_name'],
|
||||
'address' => $params['address'],
|
||||
'longitude' => $params['longitude'],
|
||||
'latitude' => $params['latitude'],
|
||||
'master_name' => $params['master_name'],
|
||||
'master_phone' => $params['master_phone'],
|
||||
'pic' => $params['pic'],
|
||||
|
|
Loading…
Reference in New Issue