mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-09-02 06:01:37 +08:00
45 lines
787 B
PHP
45 lines
787 B
PHP
<?php
|
|
|
|
namespace base\common\provider;
|
|
|
|
use think\facade\Config;
|
|
|
|
// 应用请求对象类
|
|
class RequestBase extends \think\Request
|
|
{
|
|
protected $filter = [];
|
|
|
|
/**
|
|
* 当前是否JSON请求
|
|
* @return bool
|
|
*/
|
|
public function isJson(): bool
|
|
{
|
|
$acceptType = $this->type();
|
|
|
|
$is_json = str_contains($acceptType, 'json');
|
|
if (!$is_json) {
|
|
return false;
|
|
}
|
|
|
|
if (!Config::get('app.auto_parse_api')) {
|
|
return true;
|
|
}
|
|
if ($this->has('get_page_data')) {
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* 仅通过实际请求参数判断请求
|
|
*
|
|
* @return bool
|
|
*/
|
|
public function isJsonPure()
|
|
{
|
|
return parent::isJson();
|
|
}
|
|
}
|