ComposerUpdate

This commit is contained in:
Anyon 2020-02-28 09:57:30 +08:00
parent 0f504ec906
commit 8276a98f5b
11 changed files with 41 additions and 31 deletions

View File

@ -76,11 +76,11 @@
<tbody> <tbody>
<tr> <tr>
<td>管理程序</td> <td>管理程序</td>
<td>ThinkAdmin {$app->config->get('app.thinkadmin_ver','v6')}</td> <td>ThinkAdmin Version {$app->config->get('app.thinkadmin_ver','v6')}</td>
</tr> </tr>
<tr> <tr>
<td>核心框架</td> <td>核心框架</td>
<td>ThinkPHP {$app->version()}</td> <td>ThinkPHP Version {$app->version()}</td>
</tr> </tr>
<tr> <tr>
<td>服务器信息</td> <td>服务器信息</td>
@ -91,12 +91,12 @@
<td>{$request->server('SERVER_SOFTWARE',php_sapi_name())}</td> <td>{$request->server('SERVER_SOFTWARE',php_sapi_name())}</td>
</tr> </tr>
<tr> <tr>
<td>PHP版本</td> <td>PHP 版本</td>
<td>PHP Version {$Think.const.PHP_VERSION}</td> <td>PHP Version {$Think.const.PHP_VERSION}</td>
</tr> </tr>
<tr> <tr>
<td>MySQL版本</td> <td>MySQL 版本</td>
<td>{$app->db->query('SELECT VERSION()')[0]['VERSION()']}</td> <td>MySQL Version {$app->db->query('SELECT VERSION()')[0]['VERSION()']}</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View File

@ -15,7 +15,7 @@
{/if} {/if}
{if auth("clear")} {if auth("clear")}
<button data-load='{:url("clear")}' data-confirm="确定要清理7天前的任务记录吗?" class='layui-btn layui-btn-sm layui-btn-primary'>清理记录</button> <button data-load='{:url("clear")}' data-confirm="确定要定时清理7天前的记录吗" class='layui-btn layui-btn-sm layui-btn-primary'>定时清理</button>
{/if} {/if}
{/block} {/block}

8
composer.lock generated
View File

@ -909,12 +909,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "6376bf39396292e9920b43f917d9e3dc307ef898" "reference": "be60abc6b39cbeca57a0b25f8e1a3d38e18307c0"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/6376bf39396292e9920b43f917d9e3dc307ef898", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/be60abc6b39cbeca57a0b25f8e1a3d38e18307c0",
"reference": "6376bf39396292e9920b43f917d9e3dc307ef898", "reference": "be60abc6b39cbeca57a0b25f8e1a3d38e18307c0",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -958,7 +958,7 @@
], ],
"description": "ThinkPHP v6.0 Development Library", "description": "ThinkPHP v6.0 Development Library",
"homepage": "http://framework.thinkadmin.top", "homepage": "http://framework.thinkadmin.top",
"time": "2020-01-16T03:30:15+00:00" "time": "2020-02-28T01:51:28+00:00"
}, },
{ {
"name": "zoujingli/wechat-developer", "name": "zoujingli/wechat-developer",

View File

@ -935,12 +935,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "6376bf39396292e9920b43f917d9e3dc307ef898" "reference": "be60abc6b39cbeca57a0b25f8e1a3d38e18307c0"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/6376bf39396292e9920b43f917d9e3dc307ef898", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/be60abc6b39cbeca57a0b25f8e1a3d38e18307c0",
"reference": "6376bf39396292e9920b43f917d9e3dc307ef898", "reference": "be60abc6b39cbeca57a0b25f8e1a3d38e18307c0",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -956,7 +956,7 @@
"ext-json": "*", "ext-json": "*",
"topthink/framework": "^6.0" "topthink/framework": "^6.0"
}, },
"time": "2020-01-16T03:30:15+00:00", "time": "2020-02-28T01:51:28+00:00",
"type": "library", "type": "library",
"extra": { "extra": {
"think": { "think": {

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php <?php
// This file is automatically generated at:2020-02-25 15:51:09 // This file is automatically generated at:2020-02-28 09:53:58
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'think\\app\\Service', 0 => 'think\\app\\Service',

View File

@ -197,14 +197,15 @@ abstract class Controller extends \stdClass
* @param boolean $display 是否渲染模板 * @param boolean $display 是否渲染模板
* @param boolean $total 集合分页记录数 * @param boolean $total 集合分页记录数
* @param integer $limit 集合每页记录数 * @param integer $limit 集合每页记录数
* @param string $template 模板文件名称
* @return array * @return array
* @throws DataNotFoundException * @throws DataNotFoundException
* @throws DbException * @throws DbException
* @throws ModelNotFoundException * @throws ModelNotFoundException
*/ */
protected function _page($dbQuery, $page = true, $display = true, $total = false, $limit = 0) protected function _page($dbQuery, $page = true, $display = true, $total = false, $limit = 0, $template = '')
{ {
return PageHelper::instance()->init($dbQuery, $page, $display, $total, $limit); return PageHelper::instance()->init($dbQuery, $page, $display, $total, $limit, $template);
} }
/** /**

View File

@ -67,10 +67,11 @@ abstract class Helper
/** /**
* 实例对象反射 * 实例对象反射
* @param array $args
* @return static * @return static
*/ */
public static function instance(): Helper public static function instance(...$args): Helper
{ {
return Container::getInstance()->invokeClass(static::class); return Container::getInstance()->invokeClass(static::class, $args);
} }
} }

View File

@ -33,20 +33,20 @@ class Library extends Service
*/ */
public function register() public function register()
{ {
// 读取中文语言 // 加载中文语言
$this->app->lang->load(__DIR__ . '/lang/zh-cn.php', 'zh-cn'); $this->app->lang->load(__DIR__ . '/lang/zh-cn.php', 'zh-cn');
$this->app->lang->load(__DIR__ . '/lang/en-us.php', 'en-us'); $this->app->lang->load(__DIR__ . '/lang/en-us.php', 'en-us');
// 判断访问模式 // 判断访问模式,兼容 CLI 访问控制器
if ($this->app->request->isCli()) { if ($this->app->request->isCli()) {
if (empty($_SERVER['REQUEST_URI']) && isset($_SERVER['argv'][1])) { if (empty($_SERVER['REQUEST_URI']) && isset($_SERVER['argv'][1])) {
$this->app->request->setPathinfo($_SERVER['argv'][1]); $this->app->request->setPathinfo($_SERVER['argv'][1]);
} }
} else { } else {
// 注册会话中间键 // 注册会话初始化中间键
if ($this->app->request->request('not_init_session', 0) == 0) { if ($this->app->request->request('not_init_session', 0) == 0) {
$this->app->middleware->add(SessionInit::class); $this->app->middleware->add(SessionInit::class);
} }
// 注册访问中间键 // 注册访问处理中间键
$this->app->middleware->add(function (Request $request, \Closure $next) { $this->app->middleware->add(function (Request $request, \Closure $next) {
$header = []; $header = [];
if (($origin = $request->header('origin', '*')) !== '*') { if (($origin = $request->header('origin', '*')) !== '*') {
@ -55,6 +55,11 @@ class Library extends Service
$header['Access-Control-Allow-Headers'] = 'Authorization,Content-Type,If-Match,If-Modified-Since,If-None-Match,If-Unmodified-Since,X-Requested-With'; $header['Access-Control-Allow-Headers'] = 'Authorization,Content-Type,If-Match,If-Modified-Since,If-None-Match,If-Unmodified-Since,X-Requested-With';
$header['Access-Control-Expose-Headers'] = 'User-Form-Token,User-Token,Token'; $header['Access-Control-Expose-Headers'] = 'User-Form-Token,User-Token,Token';
} }
// 未配置数据库,跳过所有检查
$host = $this->app->config->get('database.host', '[host]');
if (empty($host) || $host === '[host]') {
return $next($request)->header($header);
}
// 访问模式及访问权限检查 // 访问模式及访问权限检查
if ($request->isOptions()) { if ($request->isOptions()) {
return response()->code(204)->header($header); return response()->code(204)->header($header);
@ -68,8 +73,8 @@ class Library extends Service
}, 'route'); }, 'route');
} }
// 动态加入应用函数 // 动态加入应用函数
$syspath = "{$this->app->getAppPath()}*/sys.php"; $sysRule = "{$this->app->getAppPath()}*/sys.php";
foreach (glob($syspath) as $file) includeFile($file); foreach (glob($sysRule) as $file) includeFile($file);
} }
/** /**

View File

@ -52,10 +52,11 @@ abstract class Service
/** /**
* 静态实例对象 * 静态实例对象
* @param array $args
* @return static * @return static
*/ */
public static function instance(): Service public static function instance(...$args): Service
{ {
return Container::getInstance()->make(static::class); return Container::getInstance()->make(static::class, $args);
} }
} }

View File

@ -56,12 +56,13 @@ class PageHelper extends Helper
* @param boolean $display 是否渲染模板 * @param boolean $display 是否渲染模板
* @param boolean $total 集合分页记录数 * @param boolean $total 集合分页记录数
* @param integer $limit 集合每页记录数 * @param integer $limit 集合每页记录数
* @param string $template 模板文件名称
* @return array|mixed * @return array|mixed
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
*/ */
public function init($dbQuery, $page = true, $display = true, $total = false, $limit = 0) public function init($dbQuery, $page = true, $display = true, $total = false, $limit = 0, $template = '')
{ {
$this->page = $page; $this->page = $page;
$this->total = $total; $this->total = $total;
@ -108,7 +109,7 @@ class PageHelper extends Helper
$result = ['list' => $this->query->select()->toArray()]; $result = ['list' => $this->query->select()->toArray()];
} }
if (false !== $this->controller->callback('_page_filter', $result['list']) && $this->display) { if (false !== $this->controller->callback('_page_filter', $result['list']) && $this->display) {
return $this->controller->fetch('', $result); return $this->controller->fetch($template, $result);
} else { } else {
return $result; return $result;
} }

View File

@ -215,13 +215,14 @@ class QueryHelper extends Helper
* @param boolean $display 是否渲染模板 * @param boolean $display 是否渲染模板
* @param boolean $total 集合分页记录数 * @param boolean $total 集合分页记录数
* @param integer $limit 集合每页记录数 * @param integer $limit 集合每页记录数
* @param string $template 模板文件名称
* @return mixed * @return mixed
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException * @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
*/ */
public function page($page = true, $display = true, $total = false, $limit = 0) public function page($page = true, $display = true, $total = false, $limit = 0, $template = '')
{ {
return PageHelper::instance()->init($this->query, $page, $display, $total, $limit); return PageHelper::instance()->init($this->query, $page, $display, $total, $limit, $template);
} }
} }