12345678910111213141516171819202122232425262728 |
- <?php
- namespace app\data\model;
- use think\admin\Model;
- use think\db\Query;
- /**
- * 快递配送模型
- * Class BasePostageRegion
- * @package app\data\model
- * @method static static|Query level($level)
- */
- class BasePostageRegion extends Model
- {
- public static function hot(){
- $hot=['北京市','南京市','成都市','重庆市','西安市','广州市','苏州市','杭州市','武汉市'];
- return app()->cache->remember('app_area_hot',function () use ($hot) {
- return self::whereIn('name',$hot)->level(2)->field(['id','name'])->select();
- },0);
- }
- public function scopeLevel(Query $query,$level){
- $query->where('level',$level);
- }
- public static function getCity(){
- return self::where('level','<=',2)->select();
- }
- }
|