Skip to content

Commit

Permalink
Wnd_Query::check() 新增请求传参
Browse files Browse the repository at this point in the history
  • Loading branch information
swling committed Dec 11, 2022
1 parent c6bfd2b commit 859ff02
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions includes/query/wnd-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ abstract class Wnd_Query {
/**
* 获取Json Data
*
* @param $args 传参数组,对象,或http请求字符
* @param $force 是否强制传参,忽略 GET 请求参数
* @param $args 传参数组,对象,或http请求字符
* @param $force 是否强制传参,忽略 GET 请求参数
* @return array 数据
*/
final public static function get($args = '', $force = false): array{
Expand All @@ -20,11 +20,16 @@ final public static function get($args = '', $force = false): array{
*/
$args = $force ? wp_parse_args($args) : wp_parse_args($_GET, $args);

static::check();
static::check($args);

return static::query($args);
}

/**
* 权限检测
* 此处不添加 $args 参数,子类可自行添加带默认值的传参如 $args = [] 即可接收传参
* @since 0.8.74
*/
protected static function check() {}

/**
Expand All @@ -33,4 +38,5 @@ protected static function check() {}
* @since 0.8.74
*/
abstract protected static function query(): array;

}

0 comments on commit 859ff02

Please sign in to comment.