coupon-admin/app/model/Area.php

26 lines
608 B
PHP

<?php
namespace app\model;
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();
}
}