|
@@ -119,7 +119,11 @@ class Area extends Model
|
|
|
}
|
|
|
|
|
|
public static function getTreeId($id){
|
|
|
- $county=self::where('id',$id)->area()->find();
|
|
|
+ if(is_numeric($id)) {
|
|
|
+ $county = self::where('id', $id)->area()->find();
|
|
|
+ }else{
|
|
|
+ $county= self::where('name|shortname',$id)->find();
|
|
|
+ }
|
|
|
if(!$county){
|
|
|
throw_user('区县不存在');
|
|
|
}
|
|
@@ -128,7 +132,7 @@ class Area extends Model
|
|
|
if(!$provinceId){
|
|
|
throw_user('省不存在');
|
|
|
}
|
|
|
- return [$provinceId,$cityId,$id];
|
|
|
+ return [$provinceId,$cityId,$county['id']];
|
|
|
}
|
|
|
public static function getNameString($id,$sp=''){
|
|
|
if(!$id){
|