ComposerUpdate

This commit is contained in:
Anyon 2019-12-30 18:31:55 +08:00
parent 9811eb1d01
commit b7adec7423
21 changed files with 330 additions and 63 deletions

View File

@ -217,6 +217,8 @@ return array(
'library\\queue\\WorkQueue' => $vendorDir . '/zoujingli/think-library/src/queue/WorkQueue.php',
'library\\service\\AdminService' => $vendorDir . '/zoujingli/think-library/src/service/AdminService.php',
'library\\service\\CaptchaService' => $vendorDir . '/zoujingli/think-library/src/service/CaptchaService.php',
'library\\service\\JsonRpcClientService' => $vendorDir . '/zoujingli/think-library/src/service/JsonRpcClientService.php',
'library\\service\\JsonRpcServerService' => $vendorDir . '/zoujingli/think-library/src/service/JsonRpcServerService.php',
'library\\service\\MenuService' => $vendorDir . '/zoujingli/think-library/src/service/MenuService.php',
'library\\service\\NodeService' => $vendorDir . '/zoujingli/think-library/src/service/NodeService.php',
'library\\service\\ProcessService' => $vendorDir . '/zoujingli/think-library/src/service/ProcessService.php',

View File

@ -318,6 +318,8 @@ class ComposerStaticInitbf5dd43c242f2a86b1513b16fb281176
'library\\queue\\WorkQueue' => __DIR__ . '/..' . '/zoujingli/think-library/src/queue/WorkQueue.php',
'library\\service\\AdminService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/AdminService.php',
'library\\service\\CaptchaService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/CaptchaService.php',
'library\\service\\JsonRpcClientService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/JsonRpcClientService.php',
'library\\service\\JsonRpcServerService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/JsonRpcServerService.php',
'library\\service\\MenuService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/MenuService.php',
'library\\service\\NodeService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/NodeService.php',
'library\\service\\ProcessService' => __DIR__ . '/..' . '/zoujingli/think-library/src/service/ProcessService.php',

View File

@ -177,8 +177,8 @@
},
{
"name": "symfony/options-resolver",
"version": "v3.4.35",
"version_normalized": "3.4.35.0",
"version": "v3.4.36",
"version_normalized": "3.4.36.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/options-resolver.git",
@ -502,12 +502,12 @@
"source": {
"type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "133208dd758a04629de74e740878fa94a71bf4ec"
"reference": "bc3a7d6203955f36f401e8286884a9aa7e6a4133"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/133208dd758a04629de74e740878fa94a71bf4ec",
"reference": "133208dd758a04629de74e740878fa94a71bf4ec",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/bc3a7d6203955f36f401e8286884a9aa7e6a4133",
"reference": "bc3a7d6203955f36f401e8286884a9aa7e6a4133",
"shasum": "",
"mirrors": [
{
@ -527,7 +527,7 @@
"qiniu/php-sdk": "^7.2",
"topthink/framework": "5.1.*"
},
"time": "2019-11-29T02:10:05+00:00",
"time": "2019-12-30T09:51:14+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {

21
vendor/zoujingli/think-library/LICENSE vendored Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 邹景立
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -59,7 +59,7 @@ abstract class Controller extends \stdClass
* 表单CSRF验证失败提示消息
* @var string
*/
public $csrf_message = '表单令牌验证失败,请刷新页面再试!';
public $csrf_message = '';
/**
* Controller constructor.
@ -114,6 +114,9 @@ abstract class Controller extends \stdClass
*/
protected function initialize()
{
if (empty($this->csrf_message)) {
$this->csrf_message = lang('think_library_csrf_error');
}
}
/**

View File

@ -47,24 +47,25 @@ abstract class Service
{
$this->app = $app;
$this->request = $request;
$this->initialize();
}
/**
* 初始化服务
* @return $this
*/
public function initialize()
protected function initialize()
{
return $this;
}
/**
* 静态实例对象
* @return $this
* @return static
*/
public static function instance()
{
return Container::getInstance()->make(static::class)->initialize();
return Container::getInstance()->make(static::class);
}
}

View File

@ -13,16 +13,16 @@
// | github 仓库地址 https://github.com/zoujingli/ThinkLibrary
// +----------------------------------------------------------------------
use library\service\TokenService;
use library\tools\Crypt;
use library\tools\Csrf;
use library\tools\Data;
use library\tools\Emoji;
use library\tools\Http;
use library\tools\Node;
use think\Console;
use think\Db;
use think\db\Query;
use think\facade\Cache;
use think\facade\Lang;
use think\facade\Middleware;
use think\Request;
@ -105,7 +105,7 @@ if (!function_exists('systoken')) {
*/
function systoken($node = null)
{
$csrf = Csrf::buildFormToken(Node::get($node));
$csrf = TokenService::instance()->buildFormToken($node);
return $csrf['token'];
}
}
@ -270,6 +270,10 @@ if (class_exists('think\Console')) {
]);
}
// 加载对应的语言包
Lang::load(__DIR__ . '/lang/zh-cn.php', 'zh-cn');
Lang::load(__DIR__ . '/lang/en-us.php', 'en-us');
// 动态加载模块配置
if (function_exists('think\__include_file')) {
$root = rtrim(str_replace('\\', '/', env('app_path')), '/');

View File

@ -123,8 +123,9 @@ class Local extends File
{
if ($this->has($name, $safe) && is_string($file = $this->path($name, $safe))) {
return ['file' => $file, 'hash' => md5_file($file), 'url' => $this->base($name), 'key' => "upload/{$name}"];
} else {
return null;
}
return null;
}
/**
@ -137,8 +138,9 @@ class Local extends File
{
if ($this->has($name, $safe) && is_string($file = $this->path($name, $safe))) {
return @unlink($file);
} else {
return true;
}
return true;
}
}

View File

@ -78,9 +78,9 @@ class DeleteHelper extends Helper
}
// 回复前端结果
if ($result !== false) {
$this->controller->success('数据删除成功!', '');
$this->controller->success(lang('think_library_delete_success'), '');
} else {
$this->controller->error('数据删除失败, 请稍候再试!');
$this->controller->error(lang('think_library_delete_error'));
}
}
}

View File

@ -62,7 +62,7 @@ class FormHelper extends Helper
* @param string $field 指定数据主键
* @param array $where 额外更新条件
* @param array $data 表单扩展数据
* @return array|boolean
* @return array|mixed
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
@ -84,8 +84,9 @@ class FormHelper extends Helper
$data = array_merge($data, $this->data);
if (false !== $this->controller->callback('_form_filter', $data)) {
return $this->controller->fetch($this->template, ['vo' => $data]);
} else {
return $data;
}
return $data;
}
// POST请求, 数据自动存库处理
if ($this->app->request->isPost()) {
@ -93,8 +94,11 @@ class FormHelper extends Helper
if (false !== $this->controller->callback('_form_filter', $data, $this->where)) {
$result = data_save($this->query, $data, $this->field, $this->where);
if (false !== $this->controller->callback('_form_result', $result, $data)) {
if ($result !== false) $this->controller->success('恭喜, 数据保存成功!', '');
$this->controller->error('数据保存失败, 请稍候再试!');
if ($result !== false) {
$this->controller->success(lang('think_library_form_success'), '');
} else {
$this->controller->error(lang('think_library_form_error'));
}
}
return $result;
}

View File

@ -57,7 +57,7 @@ class PageHelper extends Helper
* @param boolean $display 是否渲染模板
* @param boolean $total 集合分页记录数
* @param integer $limit 集合每页记录数
* @return array
* @return array|mixed
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
@ -90,17 +90,19 @@ class PageHelper extends Helper
$url = url('@admin') . '#' . $this->controller->request->baseUrl() . '?' . urldecode(http_build_query($query));
array_push($rows, "<option data-num='{$num}' value='{$url}' {$selected}>{$num}</option>");
}
$select = "<select onchange='location.href=this.options[this.selectedIndex].value' data-auto-none>" . join('', $rows) . "</select>";
$html = "<div class='pagination-container nowrap'><span>共 {$page->total()} 条记录,每页显示 {$select} 条,共 {$page->lastPage()} 页当前显示第 {$page->currentPage()} 页。</span>{$page->render()}</div>";
$this->controller->assign('pagehtml', preg_replace('|href="(.*?)"|', 'data-open="$1" onclick="return false" href="$1"', $html));
$selects = "<select onchange='location.href=this.options[this.selectedIndex].value' data-auto-none>" . join('', $rows) . "</select>";
$pagetext = lang('think_library_page_html', [$page->total(), $selects, $page->lastPage(), $page->currentPage()]);
$pagehtml = "<div class='pagination-container nowrap'><span>{$pagetext}</span>{$page->render()}</div>";
$this->controller->assign('pagehtml', preg_replace('|href="(.*?)"|', 'data-open="$1" onclick="return false" href="$1"', $pagehtml));
$result = ['page' => ['limit' => intval($limit), 'total' => intval($page->total()), 'pages' => intval($page->lastPage()), 'current' => intval($page->currentPage())], 'list' => $page->items()];
} else {
$result = ['list' => $this->query->select()];
}
if (false !== $this->controller->callback('_page_filter', $result['list']) && $this->display) {
return $this->controller->fetch('', $result);
} else {
return $result;
}
return $result;
}
/**
@ -116,19 +118,20 @@ class PageHelper extends Helper
if (preg_match('/^_\d{1,}$/', $key) && preg_match('/^\d{1,}$/', $value)) {
list($where, $update) = [['id' => trim($key, '_')], ['sort' => $value]];
if (false === Db::table($this->query->getTable())->where($where)->update($update)) {
return $this->controller->error('排序失败, 请稍候再试!');
return $this->controller->error(lang('think_library_sort_error'));
}
}
}
return $this->controller->success('排序成功, 正在刷新页面!', '');
return $this->controller->success(lang('think_library_sort_success'), '');
case 'sort':
$where = $this->controller->request->post();
$sort = intval($this->controller->request->post('sort'));
unset($where['action'], $where['sort']);
if (Db::table($this->query->getTable())->where($where)->update(['sort' => $sort]) !== false) {
return $this->controller->success('排序参数修改成功!', '');
return $this->controller->success(lang('think_library_sort_success'), '');
} else {
return $this->controller->error(lang('think_library_sort_error'));
}
return $this->controller->error('排序参数修改失败,请稍候再试!');
}
}

View File

@ -82,9 +82,9 @@ class SaveHelper extends Helper
}
// 回复前端结果
if ($result !== false) {
$this->controller->success('数据更新成功!', '');
$this->controller->success(lang('think_library_save_success'), '');
} else {
$this->controller->error('数据更新失败, 请稍候再试!');
$this->controller->error(lang('think_library_save_error'));
}
}
}

View File

@ -0,0 +1,29 @@
<?php
// +----------------------------------------------------------------------
// | Library for ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2020 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/zoujingli/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/zoujingli/ThinkLibrary
// | github 仓库地址 https://github.com/zoujingli/ThinkLibrary
// +----------------------------------------------------------------------
return [
'think_library_not_auth' => 'Sorry, no permission to access the operation.',
'think_library_not_login' => 'Sorry, requiring login to obtain view permission.',
'think_library_delete_success' => 'Data deletion completed.',
'think_library_delete_error' => 'Sorry, data deletion failed, please try again later.',
'think_library_form_success' => 'Data saving completed.',
'think_library_form_error' => 'Sorry, data saving failed, please try again later.',
'think_library_save_success' => 'Data update completed.',
'think_library_save_error' => 'Sorry, Data update failed, please try again later.',
'think_library_sort_success' => 'Modification of list sort completed.',
'think_library_sort_error' => 'Sorry, modification of list sort failed, please try again later.',
'think_library_page_html' => 'Total %s records, display %s per page, total %s page current display %s page.',
'think_library_csrf_error' => 'Form token validation failed, please refresh and try again later.',
];

View File

@ -0,0 +1,29 @@
<?php
// +----------------------------------------------------------------------
// | Library for ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2020 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: https://gitee.com/zoujingli/ThinkLibrary
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/zoujingli/ThinkLibrary
// | github 仓库地址 https://github.com/zoujingli/ThinkLibrary
// +----------------------------------------------------------------------
return [
'think_library_not_auth' => '抱歉,没有访问该操作的权限!',
'think_library_not_login' => '抱歉,需要登录获取访问权限!',
'think_library_delete_success' => '恭喜, 数据删除成功!',
'think_library_delete_error' => '抱歉,数据删除失败, 请稍候再试!',
'think_library_form_success' => '恭喜, 数据保存成功!',
'think_library_form_error' => '抱歉,数据保存失败, 请稍候再试!',
'think_library_save_success' => '恭喜,数据更新成功!',
'think_library_save_error' => '抱歉,数据更新失败, 请稍候再试!',
'think_library_sort_success' => '恭喜,列表排序成功!',
'think_library_sort_error' => '抱歉,列表排序失败,请稍候再试!',
'think_library_page_html' => '共 %s 条记录,每页显示 %s 条,共 %s 页当前显示第 %s 页。',
'think_library_csrf_error' => '表单令牌验证失败,请刷新页面再试!',
];

View File

@ -56,7 +56,6 @@ class ListenQueue extends Command
while (true) {
foreach (Db::name('SystemQueue')->where([['status', 'eq', '1'], ['time', '<=', time()]])->order('time asc')->select() as $item) {
try {
Db::name('SystemQueue')->where(['id' => $item['id']])->update(['status' => '2', 'start_at' => date('Y-m-d H:i:s')]);
if ($process->query($command = $process->think("xtask:_work {$item['id']} -"))) {
$output->comment("正在执行 -> [{$item['id']}] {$item['title']}");
} else {

View File

@ -63,38 +63,51 @@ class WorkQueue extends Command
*/
protected function execute(Input $input, Output $output)
{
try {
$this->id = trim($input->getArgument('id')) ?: 0;
if (empty($this->id)) throw new Exception("执行任务需要指定任务编号!");
$queue = Db::name('SystemQueue')->where(['id' => $this->id, 'status' => '2'])->find();
if (empty($queue)) throw new Exception("执行任务{$this->id}的信息或状态异常!");;
// 设置进程标题
if (($process = ProcessService::instance())->iswin() && function_exists('cli_set_process_title')) {
cli_set_process_title("ThinkAdmin {$process->version()} 执行任务 - {$queue['title']}");
}
// 执行任务内容
if (class_exists($queue['preload'])) {
if (method_exists($class = new $queue['preload'], 'execute')) {
$data = json_decode($queue['data'], true);
if (isset($class->jobid)) $class->jobid = $this->id;
if (isset($class->title)) $class->title = $queue['title'];
$this->update('3', $class->execute($input, $output, is_array($data) ? $data : []));
} else {
throw new Exception("任务处理类 {$queue['preload']} 未定义 execute 入口!");
}
$this->id = trim($input->getArgument('id'));
if (empty($this->id)) {
$this->output->error("执行任务需要指定任务编号!");
} else try {
$queue = Db::name('SystemQueue')->where(['id' => $this->id, 'status' => '1'])->find();
if (empty($queue)) {
// 这里不做任何处理(该任务可能在其它地方已经在执行)
$this->output->warning("执行任务{$this->id}的信息或状态异常!");
} else {
$attr = explode(' ', trim(preg_replace('|\s+|', ' ', $queue['command'])));
$this->update('3', Console::call(array_shift($attr), $attr, 'console'));
// 锁定任务状态
Db::name('SystemQueue')->where(['id' => $queue['id']])->update(['status' => '2', 'start_at' => date('Y-m-d H:i:s')]);
// 设置进程标题
if (($process = ProcessService::instance())->iswin() && function_exists('cli_set_process_title')) {
cli_set_process_title("ThinkAdmin {$process->version()} 执行任务 - {$queue['title']}");
}
// 执行任务内容
if (class_exists($queue['preload'])) {
// 自定义文件,支持返回消息(支持异常结束,异常码可选择 3|4 设置任务状态)
if (method_exists($class = new $queue['preload'], 'execute')) {
$data = json_decode($queue['data'], true);
if (isset($class->jobid)) $class->jobid = $this->id;
if (isset($class->title)) $class->title = $queue['title'];
$this->update('3', $class->execute($input, $output, is_array($data) ? $data : []));
} else {
throw new Exception("任务处理类 {$queue['preload']} 未定义 execute 入口!");
}
} else {
// 自定义指令,不支持返回消息(支持异常结束,异常码可选择 3|4 设置任务状态)
$attr = explode(' ', trim(preg_replace('|\s+|', ' ', $queue['command'])));
$this->update('3', Console::call(array_shift($attr), $attr, 'console'));
}
}
} catch (\Exception $e) {
$this->update('4', $e->getMessage());
if (in_array($e->getCode(), ['3', '4'])) {
$this->update($e->getCode(), $e->getMessage());
} else {
$this->update('4', $e->getMessage());
}
}
}
/**
* 修改当前任务状态
* @param integer $status 任务状态
* @param string $message 消息内容
* @param mixed $status 任务状态
* @param mixed $message 消息内容
* @return boolean
* @throws \think\Exception
* @throws \think\exception\PDOException

View File

@ -0,0 +1,89 @@
<?php
// +----------------------------------------------------------------------
// | Library for ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/zoujingli/ThinkLibrary
// | github 仓库地址 https://github.com/zoujingli/ThinkLibrary
// +----------------------------------------------------------------------
namespace library\service;
use library\Service;
use library\tools\Data;
/**
* JsonRpc 客户端服务
* Class JsonRpcClientService
* @package library\service
*/
class JsonRpcClientService extends Service
{
/**
* 服务端地址
* @var string
*/
private $proxy;
/**
* 请求ID
* @var integer
*/
private $requestid;
/**
* 创建连接对象
* @param string $proxy
* @return $this
*/
public function create($proxy)
{
$this->requestid = Data::randomCode(16, 3);
$this->proxy = $proxy;
return $this;
}
/**
* 执行 JsonRpc 请求
* @param string $method
* @param array $params
* @return mixed
* @throws \think\Exception
*/
public function __call($method, $params)
{
// Performs the HTTP POST
$options = [
'http' => [
'method' => 'POST',
'header' => 'Content-type: application/json',
'content' => json_encode([
'jsonrpc' => '2.0', 'method' => $method, 'params' => $params, 'id' => $this->requestid,
], JSON_UNESCAPED_UNICODE),
],
];
if ($fp = fopen($this->proxy, 'r', false, stream_context_create($options))) {
$response = '';
while ($row = fgets($fp)) $response .= trim($row) . "\n";
fclose($fp);
$response = json_decode($response, true);
} else {
throw new \think\Exception("无法连接到 {$this->proxy}");
}
// Final checks and return
if ($response['id'] != $this->requestid) {
throw new \think\Exception("错误的响应标记 (请求标记: {$this->requestid}, 响应标记: {$response['id']}");
}
if (is_null($response['error'])) {
return $response['result'];
} else {
throw new \think\Exception("请求错误:[{$response['error']['code']}] {$response['error']['message']}");
}
}
}

View File

@ -0,0 +1,66 @@
<?php
// +----------------------------------------------------------------------
// | Library for ThinkAdmin
// +----------------------------------------------------------------------
// | 版权所有 2014~2019 广州楚才信息科技有限公司 [ http://www.cuci.cc ]
// +----------------------------------------------------------------------
// | 官方网站: http://demo.thinkadmin.top
// +----------------------------------------------------------------------
// | 开源协议 ( https://mit-license.org )
// +----------------------------------------------------------------------
// | gitee 仓库地址 https://gitee.com/zoujingli/ThinkLibrary
// | github 仓库地址 https://github.com/zoujingli/ThinkLibrary
// +----------------------------------------------------------------------
namespace library\service;
use library\Service;
use think\exception\HttpResponseException;
/**
* JsonRpc 服务端服务
* Class JsonRpcServerService
* @package library\service
*/
class JsonRpcServerService extends Service
{
/**
* 设置监听对象
* @param mixed $object
*/
public function handle($object)
{
// Checks if a JSON-RCP request has been received
if ($this->app->request->method() !== "POST" || $this->app->request->contentType() != 'application/json') {
echo "<h2>" . get_class($object) . "</h2>";
foreach (get_class_methods($object) as $method) {
if ($method[0] !== '_') echo "<p>method {$method}()</p>";
}
} else {
// Reads the input data
$request = json_decode(file_get_contents('php://input'), true);
if (empty($request)) {
$error = ['code' => '-32700', 'message' => '语法解析错误', 'meaning' => '服务端接收到无效的JSON'];
$response = ['jsonrpc' => '2.0', 'id' => $request['id'], 'result' => null, 'error' => $error];
} elseif (!isset($request['id']) || !isset($request['method']) || !isset($request['params'])) {
$error = ['code' => '-32600', 'message' => '无效的请求', 'meaning' => '发送的JSON不是一个有效的请求对象'];
$response = ['jsonrpc' => '2.0', 'id' => $request['id'], 'result' => null, 'error' => $error];
} else try {
// Executes the task on local object
if ($result = @call_user_func_array([$object, $request['method']], $request['params'])) {
$response = ['jsonrpc' => '2.0', 'id' => $request['id'], 'result' => $result, 'error' => null];
} else {
$error = ['code' => '-32601', 'message' => '找不到方法', 'meaning' => '该方法不存在或无效'];
$response = ['jsonrpc' => '2.0', 'id' => $request['id'], 'result' => null, 'error' => $error];
}
} catch (\Exception $e) {
$error = ['code' => $e->getCode(), 'message' => $e->getMessage()];
$response = ['jsonrpc' => '2.0', 'id' => $request['id'], 'result' => null, 'error' => $error];
}
// Output the response
throw new HttpResponseException(json($response)->contentType('text/javascript'));
}
}
}

View File

@ -49,7 +49,7 @@ class NodeService extends Service
$prefix = $this->request->module();
$middle = '\\' . $this->nameTolower($this->app->request->controller());
$suffix = ($type === 'controller') ? '' : ('\\' . $this->app->request->action());
return strtr($prefix . $middle . $suffix, '\\', '/');
return strtolower(strtr($prefix . $middle . $suffix, '\\', '/'));
}
/**
@ -61,10 +61,10 @@ class NodeService extends Service
{
if (empty($node)) return $this->getCurrent();
if (count($attrs = explode('/', $node)) === 1) {
return $this->getCurrent('controller') . "/{$node}";
return strtolower($this->getCurrent('controller') . "/{$node}");
} else {
$attrs[1] = $this->nameTolower($attrs[1]);
return join('/', $attrs);
return strtolower(join('/', $attrs));
}
}

View File

@ -48,7 +48,7 @@ class ProcessService extends Service
/**
* 创建异步进程
* @param string $command 任务指令
* @return ProcessService
* @return $this
*/
public function create($command)
{

View File

@ -30,7 +30,7 @@ class TokenService extends Service
*/
public function getInputToken()
{
return $this->app->request->header('User-Token-Csrf', input('_token_', ''));
return $this->app->request->header('user-token-csrf', input('_token_', ''));
}
/**
@ -53,7 +53,7 @@ class TokenService extends Service
/**
* 清理表单CSRF信息
* @param string $token
* @return TokenService
* @return $this
*/
public function clearFormToken($token = null)
{