Properties

$emotionPath

$emotionPath

$noNeedLogin

$noNeedLogin

$noNeedRight

$noNeedRight

$multiFields

$multiFields

$auth

$auth : \app\common\controller\Auth

权限控制类

Type

\app\common\controller\Auth —

$modelClass

$modelClass

$searchFields

$searchFields

$selectpageFields

$selectpageFields

$relationSearch

$relationSearch

$excludeFields

$excludeFields

$dataLimit

$dataLimit

是否开启数据限制 支持auth/personal 表示按权限判断/仅限个人 默认为禁用,若启用请务必保证表中存在admin_id字段

$dataLimitField

$dataLimitField

$dataLimitFieldAutoFill

$dataLimitFieldAutoFill

$modelValidate

$modelValidate

$modelSceneValidate

$modelSceneValidate

$view

$view : \think\View

视图类实例

Type

View

$request

$request : \think\Request

Request实例

Type

Request

$failException

$failException : bool

验证失败是否抛出异常

Type

bool

$batchValidate

$batchValidate : bool

是否批量验证

Type

bool

$beforeActionList

$beforeActionList : array

前置操作方法列表(即将废弃)

Type

array

$middleware

$middleware : array

控制器中间件

Type

array

$app

$app : \think\App

应用实例

Type

App

Methods

index()

index() : mixed

Returns

mixed —

recyclebin()

recyclebin() : mixed

Returns

mixed —

add()

add() : mixed

Returns

mixed —

edit()

edit() : mixed

编辑

Returns

mixed —

del()

del() : mixed

Returns

mixed —

destroy()

destroy() : mixed

Returns

mixed —

restore()

restore() : mixed

Returns

mixed —

multi()

multi() : mixed

Returns

mixed —

_empty()

_empty() : mixed

Returns

mixed —

__construct()

__construct(\think\App  $app = null) : mixed

构造方法

Parameters

\think\App $app

Returns

mixed —

registerMiddleware()

registerMiddleware() : mixed

Returns

mixed —

__debugInfo()

__debugInfo() : mixed

Returns

mixed —

initialize()

initialize() : mixed

Returns

mixed —

error()

error(mixed  $msg = '', string  $url = null, mixed  $data = '', int  $wait = 3, array  $header = []) : void

操作错误跳转的快捷方法

Parameters

mixed $msg

提示信息

string $url

跳转的URL地址

mixed $data

返回的数据

int $wait

跳转等待时间

array $header

发送的Header信息

success()

success(mixed  $msg = '', string  $url = null, mixed  $data = '', int  $wait = 3, array  $header = []) : void

操作成功跳转的快捷方法

Parameters

mixed $msg

提示信息

string $url

跳转的URL地址

mixed $data

返回的数据

int $wait

跳转等待时间

array $header

发送的Header信息

checkRule()

checkRule(string  $rule, mixed  $type = AuthRule::RULE_URL, string  $mode = 'url') : bool

权限检测

Parameters

string $rule

检测的规则

mixed $type
string $mode

check模式

Returns

bool —

buildTableParames()

buildTableParames(mixed  $searchfields = null, array  $excludeFields = [], bool  $relationSearch = null) : array

构建请求参数

Parameters

mixed $searchfields

快速查询的字段

array $excludeFields

忽略构建搜索的字段

bool $relationSearch

是否关联查询

Returns

array —

getDataLimitAdminIds()

getDataLimitAdminIds() : mixed

获取数据限制的管理员ID 禁用数据限制时返回的是null

Returns

mixed —

selectpage()

selectpage() : mixed

当前方法只是一个比较通用的搜索匹配,请按需重载此方法来编写自己的搜索逻辑,$where按自己的需求写即可 这里示例了所有的参数,所以比较复杂,实现上自己实现只需简单的几行即可

Returns

mixed —

token()

token() : mixed

Returns

mixed —

preExcludeFields()

preExcludeFields( $params) : array

排除前台提交过来的字段

Parameters

$params

Returns

array —

beforeAction()

beforeAction(string  $method, array  $options = []) : mixed

前置操作

Parameters

string $method

前置操作方法名

array $options

调用参数 ['only'=>[...]] 或者['except'=>[...]]

Returns

mixed —

fetch()

fetch(string  $template = '', array  $vars = [], array  $config = []) : mixed

加载模板输出

Parameters

string $template

模板文件名

array $vars

模板输出变量

array $config

模板参数

Returns

mixed —

display()

display(string  $content = '', array  $vars = [], array  $config = []) : mixed

渲染内容输出

Parameters

string $content

模板内容

array $vars

模板输出变量

array $config

模板参数

Returns

mixed —

assign()

assign(mixed  $name, mixed  $value = '') : $this

模板变量赋值

Parameters

mixed $name

要显示的模板变量

mixed $value

变量的值

Returns

$this —

filter()

filter(callable  $filter) : $this

视图过滤

Parameters

callable $filter

过滤方法或闭包

Returns

$this —

engine()

engine(array|string  $engine) : $this

初始化模板引擎

Parameters

array|string $engine

引擎参数

Returns

$this —

validateFailException()

validateFailException(bool  $fail = true) : $this

设置验证失败后是否抛出异常

Parameters

bool $fail

是否抛出异常

Returns

$this —

validate()

validate(array  $data, string|array  $validate, array  $message = [], bool  $batch = false, mixed  $callback = null) : array|string|true

验证数据

Parameters

array $data

数据

string|array $validate

验证器名或者验证规则数组

array $message

提示信息

bool $batch

是否批量验证

mixed $callback

回调方法(闭包)

Throws

\think\exception\ValidateException

Returns

array|string|true —

result()

result(mixed  $data, int  $code, mixed  $msg = '', string  $type = '', array  $header = []) : void

返回封装后的API数据到客户端

Parameters

mixed $data

要返回的数据

int $code

返回的code

mixed $msg

提示信息

string $type

返回数据格式

array $header

发送的Header信息

redirect()

redirect(string  $url, array|int  $params = [], int  $code = 302, array  $with = []) : void

URL重定向

Parameters

string $url

跳转的URL表达式

array|int $params

其它URL参数

int $code

http code

array $with

隐式传参

getResponseType()

getResponseType() : string

获取当前的response 输出类型

Returns

string —