coupon-admin/app/model/Area.php

35 lines
779 B
PHP
Raw Normal View History

2021-11-29 09:32:48 +00:00
<?php
namespace app\model;
2021-11-29 10:30:30 +00:00
use think\Collection;
2021-11-29 09:32:48 +00:00
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)
{
2021-11-29 10:30:30 +00:00
return self::where("pcode",$PCode) ->when($filter,function ($q){
2021-11-29 09:32:48 +00:00
$q->where("status",self::COMMON_ON);
})->order("id asc")->select();
}
2021-11-29 10:30:30 +00:00
// 获取列表
public static function getAllList(): Collection
{
return self::order('id', 'asc')
->select();
}
2021-11-29 09:32:48 +00:00
}