mirror of
https://gitee.com/zoujingli/ThinkAdmin.git
synced 2025-09-06 16:19:46 +08:00
ComposerUpdate
This commit is contained in:
parent
c2f9f8ed6a
commit
5325601793
8
composer.lock
generated
8
composer.lock
generated
@ -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": "ca6df0b64b3d22c210260a218bb31134661c881d"
|
"reference": "1f0c1902fcab3cd7d257f79d607712619a4b660e"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/ca6df0b64b3d22c210260a218bb31134661c881d",
|
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/1f0c1902fcab3cd7d257f79d607712619a4b660e",
|
||||||
"reference": "ca6df0b64b3d22c210260a218bb31134661c881d",
|
"reference": "1f0c1902fcab3cd7d257f79d607712619a4b660e",
|
||||||
"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": "2019-12-16T03:27:06+00:00"
|
"time": "2019-12-17T10:24:30+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "zoujingli/wechat-developer",
|
"name": "zoujingli/wechat-developer",
|
||||||
|
8
vendor/composer/installed.json
vendored
8
vendor/composer/installed.json
vendored
@ -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": "ca6df0b64b3d22c210260a218bb31134661c881d"
|
"reference": "1f0c1902fcab3cd7d257f79d607712619a4b660e"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/ca6df0b64b3d22c210260a218bb31134661c881d",
|
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/1f0c1902fcab3cd7d257f79d607712619a4b660e",
|
||||||
"reference": "ca6df0b64b3d22c210260a218bb31134661c881d",
|
"reference": "1f0c1902fcab3cd7d257f79d607712619a4b660e",
|
||||||
"shasum": "",
|
"shasum": "",
|
||||||
"mirrors": [
|
"mirrors": [
|
||||||
{
|
{
|
||||||
@ -956,7 +956,7 @@
|
|||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"topthink/framework": "^6.0"
|
"topthink/framework": "^6.0"
|
||||||
},
|
},
|
||||||
"time": "2019-12-16T03:27:06+00:00",
|
"time": "2019-12-17T10:24:30+00:00",
|
||||||
"type": "library",
|
"type": "library",
|
||||||
"extra": {
|
"extra": {
|
||||||
"think": {
|
"think": {
|
||||||
|
2
vendor/services.php
vendored
2
vendor/services.php
vendored
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
// This file is automatically generated at:2019-12-16 11:42:37
|
// This file is automatically generated at:2019-12-17 18:30:13
|
||||||
declare (strict_types = 1);
|
declare (strict_types = 1);
|
||||||
return array (
|
return array (
|
||||||
0 => 'think\\app\\Service',
|
0 => 'think\\app\\Service',
|
||||||
|
@ -52,10 +52,11 @@ class Install extends Command
|
|||||||
*/
|
*/
|
||||||
protected $bind = [
|
protected $bind = [
|
||||||
'admin' => [
|
'admin' => [
|
||||||
'rules' => [
|
'rules' => ['think', 'app/admin'],
|
||||||
'think',
|
'ignore' => [],
|
||||||
'app/admin',
|
],
|
||||||
],
|
'wechat' => [
|
||||||
|
'rules' => ['app/wechat'],
|
||||||
'ignore' => [],
|
'ignore' => [],
|
||||||
],
|
],
|
||||||
'static' => [
|
'static' => [
|
||||||
|
@ -166,10 +166,9 @@ class InstallService extends Service
|
|||||||
foreach ($local as $t) $_local[$t['name']] = $t;
|
foreach ($local as $t) $_local[$t['name']] = $t;
|
||||||
unset($serve, $local);
|
unset($serve, $local);
|
||||||
// 线上数据差异计算
|
// 线上数据差异计算
|
||||||
foreach ($_serve as $t) if (isset($_local[$t['name']])) array_push($_new, [
|
foreach ($_serve as $t) isset($_local[$t['name']]) ? array_push($_new, [
|
||||||
'type' => $t['hash'] === $_local[$t['name']]['hash'] ? null : 'mod', 'name' => $t['name'],
|
'type' => $t['hash'] === $_local[$t['name']]['hash'] ? null : 'mod', 'name' => $t['name'],
|
||||||
]);
|
]) : array_push($_new, ['type' => 'add', 'name' => $t['name']]);
|
||||||
else array_push($_new, ['type' => 'add', 'name' => $t['name']]);
|
|
||||||
// 本地数据增量计算
|
// 本地数据增量计算
|
||||||
foreach ($_local as $t) if (!isset($_serve[$t['name']])) array_push($_new, ['type' => 'del', 'name' => $t['name']]);
|
foreach ($_local as $t) if (!isset($_serve[$t['name']])) array_push($_new, ['type' => 'del', 'name' => $t['name']]);
|
||||||
unset($_serve, $_local);
|
unset($_serve, $_local);
|
||||||
|
@ -44,35 +44,28 @@ class JsonRpcClientService extends Service
|
|||||||
*/
|
*/
|
||||||
public function create($proxy)
|
public function create($proxy)
|
||||||
{
|
{
|
||||||
$this->proxy = $proxy;
|
|
||||||
$this->requestid = CodeExtend::uniqidNumber();
|
$this->requestid = CodeExtend::uniqidNumber();
|
||||||
|
$this->proxy = $proxy;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行 JsonRCP 请求
|
* 执行 JsonRpc 请求
|
||||||
* @param string $method
|
* @param string $method
|
||||||
* @param array $params
|
* @param array $params
|
||||||
* @return array|boolean
|
* @return mixed
|
||||||
* @throws \think\Exception
|
* @throws \think\Exception
|
||||||
*/
|
*/
|
||||||
public function __call($method, $params)
|
public function __call($method, $params)
|
||||||
{
|
{
|
||||||
// check
|
// Performs the HTTP POST
|
||||||
if (!is_scalar($method)) {
|
|
||||||
throw new \think\Exception('Method name has no scalar value');
|
|
||||||
}
|
|
||||||
// check
|
|
||||||
if (is_array($params)) {
|
|
||||||
$params = array_values($params);
|
|
||||||
} else {
|
|
||||||
throw new \think\Exception('Params must be given as array');
|
|
||||||
}
|
|
||||||
// performs the HTTP POST
|
|
||||||
$options = [
|
$options = [
|
||||||
'http' => [
|
'http' => [
|
||||||
'method' => 'POST', 'header' => 'Content-type: application/json',
|
'method' => 'POST',
|
||||||
'content' => json_encode(['method' => $method, 'params' => $params, 'id' => $this->requestid], JSON_UNESCAPED_UNICODE),
|
'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))) {
|
if ($fp = fopen($this->proxy, 'r', false, stream_context_create($options))) {
|
||||||
@ -81,16 +74,16 @@ class JsonRpcClientService extends Service
|
|||||||
fclose($fp);
|
fclose($fp);
|
||||||
$response = json_decode($response, true);
|
$response = json_decode($response, true);
|
||||||
} else {
|
} else {
|
||||||
throw new \think\Exception("Unable to connect to {$this->proxy}");
|
throw new \think\Exception("无法连接到 {$this->proxy}");
|
||||||
}
|
}
|
||||||
// final checks and return
|
// Final checks and return
|
||||||
if ($response['id'] != $this->requestid) {
|
if ($response['id'] != $this->requestid) {
|
||||||
throw new \think\Exception("Incorrect response id (request id: {$this->requestid}, response id: {$response['id']})");
|
throw new \think\Exception("错误的响应标记 (请求标记: {$this->requestid}, 响应标记: {$response['id']})");
|
||||||
}
|
}
|
||||||
if (is_null($response['error'])) {
|
if (is_null($response['error'])) {
|
||||||
return $response['result'];
|
return $response['result'];
|
||||||
} else {
|
} else {
|
||||||
throw new \think\Exception("Request error: {$response['error']}");
|
throw new \think\Exception("请求错误:[{$response['error']['code']}] {$response['error']['message']}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -28,7 +28,6 @@ class JsonRpcServerService extends Service
|
|||||||
/**
|
/**
|
||||||
* 设置监听对象
|
* 设置监听对象
|
||||||
* @param mixed $object
|
* @param mixed $object
|
||||||
* @throws \think\Exception
|
|
||||||
*/
|
*/
|
||||||
public function handle($object)
|
public function handle($object)
|
||||||
{
|
{
|
||||||
@ -41,18 +40,23 @@ class JsonRpcServerService extends Service
|
|||||||
} else {
|
} else {
|
||||||
// Reads the input data
|
// Reads the input data
|
||||||
$request = json_decode(file_get_contents('php://input'), true);
|
$request = json_decode(file_get_contents('php://input'), true);
|
||||||
if (empty($request['id'])) {
|
if (empty($request)) {
|
||||||
throw new \think\Exception('JsonRpc Request id cannot be empty');
|
$error = ['code' => '-32700', 'message' => '语法解析错误', 'meaning' => '服务端接收到无效的JSON'];
|
||||||
}
|
$response = ['jsonrpc' => '2.0', 'id' => $request['id'], 'result' => null, 'error' => $error];
|
||||||
// Executes the task on local object
|
} elseif (!isset($request['id']) || !isset($request['method']) || !isset($request['params'])) {
|
||||||
try {
|
$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'])) {
|
if ($result = @call_user_func_array([$object, $request['method']], $request['params'])) {
|
||||||
$response = ['id' => $request['id'], 'result' => $result, 'error' => null];
|
$response = ['jsonrpc' => '2.0', 'id' => $request['id'], 'result' => $result, 'error' => null];
|
||||||
} else {
|
} else {
|
||||||
$response = ['id' => $request['id'], 'result' => null, 'error' => 'unknown method or incorrect parameters'];
|
$error = ['code' => '-32601', 'message' => '找不到方法', 'meaning' => '该方法不存在或无效'];
|
||||||
|
$response = ['jsonrpc' => '2.0', 'id' => $request['id'], 'result' => null, 'error' => $error];
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$response = ['id' => $request['id'], 'result' => null, 'error' => $e->getMessage()];
|
$error = ['code' => $e->getCode(), 'message' => $e->getMessage()];
|
||||||
|
$response = ['jsonrpc' => '2.0', 'id' => $request['id'], 'result' => null, 'error' => $error];
|
||||||
}
|
}
|
||||||
// Output the response
|
// Output the response
|
||||||
throw new HttpResponseException(json($response)->contentType('text/javascript'));
|
throw new HttpResponseException(json($response)->contentType('text/javascript'));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user