地区模型移动到common
This commit is contained in:
parent
a73cfbccea
commit
074cd8949b
@ -11,12 +11,13 @@ namespace app\api\controller;
|
||||
|
||||
use app\api\BaseController;
|
||||
use app\api\middleware\Auth;
|
||||
use app\api\model\GeoProvince as GeoProvinceModel;
|
||||
use app\api\model\GeoCity as GeoCityModel;
|
||||
use app\api\model\GeoArea as GeoAreaModel;
|
||||
use app\api\model\GeoStreet as GeoStreetModel;
|
||||
use app\api\model\GeoVillage as GeoVillageModel;
|
||||
use app\api\model\GeoBrigade as GeoBrigadeModel;
|
||||
use app\common\model\geo\GeoProvince as GeoProvinceModel;
|
||||
use app\common\model\geo\GeoCity as GeoCityModel;
|
||||
use app\common\model\geo\GeoArea as GeoAreaModel;
|
||||
use app\common\model\geo\GeoStreet as GeoStreetModel;
|
||||
use app\common\model\geo\GeoVillage as GeoVillageModel;
|
||||
use app\common\model\geo\GeoBrigade as GeoBrigadeModel;
|
||||
|
||||
|
||||
/**
|
||||
* 首页接口
|
||||
@ -29,7 +30,7 @@ class Geo extends BaseController
|
||||
* @var array
|
||||
*/
|
||||
protected $middleware = [
|
||||
Auth::class => ['except' => ['Province','City','Area','Street','Village', 'Brigade']]
|
||||
Auth::class => ['except' => ['Province','City','Area','Street','Village', 'Brigade','test']]
|
||||
];
|
||||
|
||||
/**
|
||||
@ -124,4 +125,5 @@ class Geo extends BaseController
|
||||
|
||||
$this->apiSuccess('OK',$list);
|
||||
}
|
||||
|
||||
}
|
26
app/common/model/geo/GeoArea.php
Normal file
26
app/common/model/geo/GeoArea.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* @date :2023年03月2日
|
||||
* @author:刘孝全
|
||||
* @email:q8197264@126.com
|
||||
*
|
||||
* @ 地区联动模型
|
||||
*/
|
||||
namespace app\common\model\geo;
|
||||
|
||||
use think\model;
|
||||
|
||||
class GeoArea extends Model
|
||||
{
|
||||
protected $table = "fa_geo_area";
|
||||
|
||||
static function Get($pcode){
|
||||
$list = self::where(['switch'=>1,'city_code'=>$pcode])
|
||||
->field('area_id id,area_code code,area_name name')
|
||||
->select();
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
|
||||
}
|
22
app/common/model/geo/GeoBrigade.php
Normal file
22
app/common/model/geo/GeoBrigade.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* @date :2023年03月2日
|
||||
* @author:刘孝全
|
||||
* @email:q8197264@126.com
|
||||
*
|
||||
* @ 地区联动 - 大队
|
||||
*/
|
||||
namespace app\common\model\geo;
|
||||
|
||||
use think\model;
|
||||
|
||||
class GeoBrigade extends Model
|
||||
{
|
||||
protected $table="fa_geo_brigade";
|
||||
|
||||
static function Get(){
|
||||
$res = self::select();
|
||||
|
||||
return $res;
|
||||
}
|
||||
}
|
25
app/common/model/geo/GeoCity.php
Normal file
25
app/common/model/geo/GeoCity.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* @date :2023年03月2日
|
||||
* @author:刘孝全
|
||||
* @email:q8197264@126.com
|
||||
*
|
||||
* @ 地区联动模型
|
||||
*/
|
||||
namespace app\common\model\geo;
|
||||
|
||||
use think\model;
|
||||
|
||||
class GeoCity extends Model {
|
||||
protected $table = "fa_geo_city";
|
||||
|
||||
static function Get($pcode){
|
||||
$list = self::where(['switch'=>1,'province_code'=>$pcode])
|
||||
->field('city_id id,city_code code,city_name name')
|
||||
->select();
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
|
||||
}
|
31
app/common/model/geo/GeoProvince.php
Normal file
31
app/common/model/geo/GeoProvince.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
/**
|
||||
* @date :2023年03月2日
|
||||
* @author:刘孝全
|
||||
* @email:q8197264@126.com
|
||||
*
|
||||
* @ 地区联动模型
|
||||
*/
|
||||
namespace app\common\model\geo;
|
||||
|
||||
use think\model;
|
||||
|
||||
class GeoProvince extends Model {
|
||||
protected $table = "fa_geo_province";
|
||||
|
||||
// public function test(){
|
||||
// return $this->belongsToMany(User::class,'fa_geo_city','user_id','role_id');
|
||||
// }
|
||||
|
||||
/**
|
||||
* 省
|
||||
*/
|
||||
static function Get(){
|
||||
$res = self::where(['switch'=>1])
|
||||
->field('province_id id,province_code code,province_name name')
|
||||
->select();
|
||||
|
||||
return $res;
|
||||
}
|
||||
|
||||
}
|
23
app/common/model/geo/GeoStreet.php
Normal file
23
app/common/model/geo/GeoStreet.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
/**
|
||||
* @date :2023年03月2日
|
||||
* @author:刘孝全
|
||||
* @email:q8197264@126.com
|
||||
*
|
||||
* @ 地区联动模型
|
||||
*/
|
||||
namespace app\common\model\geo;
|
||||
|
||||
use think\model;
|
||||
|
||||
class GeoStreet extends Model{
|
||||
protected $table = "fa_geo_street";
|
||||
|
||||
static function Get($pcode) {
|
||||
$list = self::where(['switch'=>1,'area_code'=>$pcode])
|
||||
->field('street_id id,street_code code,street_name name')
|
||||
->select();
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
25
app/common/model/geo/GeoVillage.php
Normal file
25
app/common/model/geo/GeoVillage.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/**
|
||||
* @date :2023年03月2日
|
||||
* @author:刘孝全
|
||||
* @email:q8197264@126.com
|
||||
*
|
||||
* @ 地区联动模型
|
||||
*/
|
||||
namespace app\common\model\geo;
|
||||
|
||||
use think\model;
|
||||
|
||||
|
||||
class GeoVillage extends Model
|
||||
{
|
||||
protected $table = "fa_geo_village";
|
||||
|
||||
static function Get($pcode) {
|
||||
$list = self::where(['switch'=>1,'street_code'=>$pcode])
|
||||
->field('village_id id,village_code code,village_name name')
|
||||
->select();
|
||||
|
||||
return $list;
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user