新增银行卡验证、修正省市区验证
This commit is contained in:
@@ -18,7 +18,7 @@ class AreaService extends BaseService
|
||||
// 检测省份
|
||||
if (!empty($province_id)){
|
||||
$province = $this->getAreaByAreaId($province_id);
|
||||
if (empty($province['data'])){
|
||||
if (empty($province)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,7 @@ class AreaService extends BaseService
|
||||
// 检测城市
|
||||
if (!empty($city_id) && !empty($province_id)){
|
||||
$city = $this->getAreaByAreaId($city_id,$province_id);
|
||||
if (empty($city['data'])){
|
||||
if (empty($city)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -34,18 +34,64 @@ class AreaService extends BaseService
|
||||
// 检测区县
|
||||
if (!empty($county_id) && !empty($city_id)){
|
||||
$county = $this->getAreaByAreaId($county_id,$city_id);
|
||||
if (empty($county['data'])){
|
||||
if (empty($county)){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($province['data']) || !empty($city['data']) || !empty($county['data'])){
|
||||
if (!empty($province) || !empty($city) || !empty($county)){
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取省市区数据
|
||||
* @param string $province_id
|
||||
* @param string $city_id
|
||||
* @param string $county_id
|
||||
* @return array
|
||||
*/
|
||||
public function getAreaById(string $province_id, string $city_id, string $county_id): array
|
||||
{
|
||||
// 省份
|
||||
if (!empty($province_id)){
|
||||
$province = $this->getAreaByAreaId($province_id);
|
||||
if (empty($province)){
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
// 城市
|
||||
if (!empty($city_id) && !empty($province_id)){
|
||||
$city = $this->getAreaByAreaId($city_id,$province_id);
|
||||
if (empty($city)){
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
// 检测区县
|
||||
if (!empty($county_id) && !empty($city_id)){
|
||||
$county = $this->getAreaByAreaId($county_id,$city_id);
|
||||
if (empty($county)){
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($province) || !empty($city) || !empty($county)){
|
||||
$result = array();
|
||||
$result['province'] = $province;
|
||||
$result['city'] = $city;
|
||||
$result['county'] = $county;
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
return [];
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取省份列表
|
||||
* @return array
|
||||
@@ -95,7 +141,7 @@ class AreaService extends BaseService
|
||||
}
|
||||
$area = AreaModel::getOne($params);
|
||||
|
||||
return empty($area) ? success() : success($area->toArray());
|
||||
return empty($area) ? [] : $area->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,6 +155,6 @@ class AreaService extends BaseService
|
||||
$params['parent_id'] = $parent_id;
|
||||
$area = AreaModel::getList($params);
|
||||
|
||||
return empty($area) ? success() : success($area->toArray());
|
||||
return empty($area) ? [] : $area->toArray();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user