Properties

$noNeedLogin

$noNeedLogin : bool

Type

bool — 无需登录的方法

$noNeedAuth

$noNeedAuth : bool

Type

bool — 无需鉴权的方法

$noNeedToken

$noNeedToken : array

Type

array — 无需token的方法

$beforeActionList

$beforeActionList : array

Type

array — 前置操作方法列表

$view

$view : \think\View

Type

View — 视图类实例

$request

$request : \think\Request

Type

Request — Request 实例

$failException

$failException : bool

Type

bool — 验证失败是否抛出异常

$batchValidate

$batchValidate : bool

Type

bool — 是否批量验证

Methods

generatePassword()

generatePassword(string  $password) : array

生成密码和加密盐

Parameters

string $password

密码

Returns

array —

decryptPassword()

decryptPassword(string  $password, string  $salt) : string

加密

Parameters

string $password

密码

string $salt

密码盐

Returns

string —

build_menu_child()

build_menu_child( $pid,  $menuList) : array

递归生成子菜单

Parameters

$pid
$menuList

Returns

array —

build_params()

build_params(array  $where = []) : array

构造查询参数

Parameters

array $where

Returns

array —

check_auth()

check_auth() : mixed

鉴权

Returns

mixed —

__construct()

__construct(\think\Request  $request = null) : mixed

构造方法

Parameters

\think\Request $request

Request 对象

Returns

mixed —

lists()

lists() : mixed

获取登录日志详情

Throws

\think\db\exception\DataNotFoundException
\think\db\exception\ModelNotFoundException
\think\exception\DbException

Returns

mixed —

detail()

detail() : mixed

获取登录日志详情

Throws

\think\db\exception\DataNotFoundException
\think\exception\DbException
\think\db\exception\ModelNotFoundException

Returns

mixed —

clear_login_log()

clear_login_log() : mixed

清空登录日志

Throws

\think\db\exception\DataNotFoundException
\think\exception\DbException
\think\db\exception\ModelNotFoundException

Returns

mixed —

_initialize()

_initialize() : mixed

初始化操作

Returns

mixed —

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 信息

Throws

\think\exception\HttpResponseException

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 信息

Throws

\think\exception\HttpResponseException

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 信息

Throws

\think\exception\HttpResponseException

checkApiSafety()

checkApiSafety() : mixed

校验API安全性

Throws

\HttpResponseException

Returns

mixed —

beforeAction()

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

前置操作

Parameters

string $method

前置操作方法名

array $options

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

fetch()

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

加载模板输出

Parameters

string $template

模板文件名

array $vars

模板输出变量

array $replace

模板替换

array $config

模板参数

Returns

mixed —

display()

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

渲染内容输出

Parameters

string $content

模板内容

array $vars

模板输出变量

array $replace

替换内容

array $config

模板参数

Returns

mixed —

assign()

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

模板变量赋值

Parameters

mixed $name

要显示的模板变量

mixed $value

变量的值

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 —

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

隐式传参

Throws

\think\exception\HttpResponseException

getResponseType()

getResponseType() : string

获取当前的 response 输出类型

Returns

string —

checkSign()

checkSign() : mixed

校验签名

Returns

mixed —

checkToken()

checkToken(string  $token) : mixed

校验token

Parameters

string $token

用户token

Returns

mixed —