<input id="c-base_code" data-rule="required"
data-source="cl/base/selectGetBaseList"
data-field="base_name"
data-primary-key="base_code"
data-search-field="base_name"
data-params='{"custom[type]":"test"}'
class="form-control selectpage" name="row[base_code]" type="text" value="">
// 无需登录的接口,*表示全部
protected $noNeedLogin = [];
// 无需鉴权的接口,*表示全部
protected $noNeedRight = ['selectGetBaseList'];
public function selectGetBaseList(): \think\response\Json
{
$base_name = input('base_name/s');
$where = [];
if ($base_name) {
$where['base_name'] = ['like', '%' . $base_name . '%'];
}
$my_base_codes = $this->getMyBaseCodes();
if($my_base_codes){
$where['base_code'] = ['in', $my_base_codes];
}
$list = Db::table('dz_base')->where($where)->select();
//res
$res = [];
$res['list'] = $list;
$res['total'] = count($list);
$res['input'] = input();
$res['base_codes'] = $this->getMyBaseCodes();
return json($res);
}
网友评论