35 lines
		
	
	
		
			779 B
		
	
	
	
		
			PHP
		
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			779 B
		
	
	
	
		
			PHP
		
	
	
| <?php
 | |
| 
 | |
| namespace app\model;
 | |
| 
 | |
| 
 | |
| use think\Collection;
 | |
| 
 | |
| class Area extends Base
 | |
| {
 | |
| 
 | |
|     /**
 | |
|      *
 | |
|      * @param $PCode
 | |
|      * @param $filter bool 是否过滤屏蔽的地区
 | |
|      * @return Area[]|array|\think\Collection
 | |
|      * @throws \think\db\exception\DataNotFoundException
 | |
|      * @throws \think\db\exception\DbException
 | |
|      * @throws \think\db\exception\ModelNotFoundException
 | |
|      */
 | |
|     public static function getByPCode($PCode,bool $filter = false)
 | |
|     {
 | |
|         return self::where("pcode",$PCode) ->when($filter,function ($q){
 | |
|             $q->where("status",self::COMMON_ON);
 | |
|         })->order("id asc")->select();
 | |
|     }
 | |
| 
 | |
| 
 | |
|     // 获取列表
 | |
|     public static function getAllList(): Collection
 | |
|     {
 | |
|         return self::order('id', 'asc')
 | |
|             ->select();
 | |
|     }
 | |
| }
 |