ComposerUpdate

This commit is contained in:
邹景立 2021-06-25 13:24:09 +08:00
parent 04d0cd8563
commit 9e41e91010
6 changed files with 18 additions and 24 deletions

View File

@ -110,20 +110,11 @@ class WechatService extends Service
[$appid, $appkey] = [sysconf('wechat.thr_appid'), sysconf('wechat.thr_appkey')]; [$appid, $appkey] = [sysconf('wechat.thr_appid'), sysconf('wechat.thr_appkey')];
$data = ['class' => $name, 'appid' => $appid, 'time' => time(), 'nostr' => uniqid()]; $data = ['class' => $name, 'appid' => $appid, 'time' => time(), 'nostr' => uniqid()];
$data['sign'] = md5("{$data['class']}#{$appid}#{$appkey}#{$data['time']}#{$data['nostr']}"); $data['sign'] = md5("{$data['class']}#{$appid}#{$appkey}#{$data['time']}#{$data['nostr']}");
// 创建远程连接,默认使用 JSON RPC 方式
$token = enbase64url(json_encode($data, JSON_UNESCAPED_UNICODE)); $token = enbase64url(json_encode($data, JSON_UNESCAPED_UNICODE));
$location = "https://open.cuci.cc/service/api.client/_TYPE_?not_init_session=1&token={$token}"; $client = new JsonRpcClient("https://open.cuci.cc/service/api.client/jsonrpc?not_init_session=1&token={$token}");
if (class_exists('Yar_Client')) { if (is_numeric(stripos($client->__call('_get_class_name_', []), 'Exception'))) {
$client = new \Yar_Client(str_replace('_TYPE_', 'yar', $location)); throw new \think\admin\Exception($client->getMessage(), $client->getCode());
} else {
$client = new JsonRpcClient(str_replace('_TYPE_', 'jsonrpc', $location));
}
try {
$exception = new \think\admin\Exception($client->getMessage(), $client->getCode());
} catch (\Exception $exception) {
$exception = null;
}
if ($exception instanceof \Exception) {
throw $exception;
} }
return $client; return $client;
} }

View File

@ -853,12 +853,12 @@
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/zoujingli/ThinkLibrary.git", "url": "https://github.com/zoujingli/ThinkLibrary.git",
"reference": "b36df3ae241b81fe15f4c155fbfba5aab2431970" "reference": "b77d3be5faf647d05827c831a069509175126d13"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/b36df3ae241b81fe15f4c155fbfba5aab2431970", "url": "https://api.github.com/repos/zoujingli/ThinkLibrary/zipball/b77d3be5faf647d05827c831a069509175126d13",
"reference": "b36df3ae241b81fe15f4c155fbfba5aab2431970", "reference": "b77d3be5faf647d05827c831a069509175126d13",
"shasum": "", "shasum": "",
"mirrors": [ "mirrors": [
{ {
@ -875,7 +875,7 @@
"ext-mbstring": "*", "ext-mbstring": "*",
"topthink/framework": "^6.0" "topthink/framework": "^6.0"
}, },
"time": "2021-06-23T06:30:26+00:00", "time": "2021-06-25T04:07:35+00:00",
"default-branch": true, "default-branch": true,
"type": "library", "type": "library",
"extra": { "extra": {

View File

@ -5,7 +5,7 @@
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
'reference' => '435de923eecb411bc7a10fb8dab55122b87d5466', 'reference' => '04d0cd8563af49737965f1567d8d569e800a9eeb',
'name' => 'zoujingli/thinkadmin', 'name' => 'zoujingli/thinkadmin',
'dev' => false, 'dev' => false,
), ),
@ -144,7 +144,7 @@
'aliases' => array( 'aliases' => array(
0 => '9999999-dev', 0 => '9999999-dev',
), ),
'reference' => 'b36df3ae241b81fe15f4c155fbfba5aab2431970', 'reference' => 'b77d3be5faf647d05827c831a069509175126d13',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'zoujingli/thinkadmin' => array( 'zoujingli/thinkadmin' => array(
@ -153,7 +153,7 @@
'type' => 'project', 'type' => 'project',
'install_path' => __DIR__ . '/../../', 'install_path' => __DIR__ . '/../../',
'aliases' => array(), 'aliases' => array(),
'reference' => '435de923eecb411bc7a10fb8dab55122b87d5466', 'reference' => '04d0cd8563af49737965f1567d8d569e800a9eeb',
'dev_requirement' => false, 'dev_requirement' => false,
), ),
'zoujingli/wechat-developer' => array( 'zoujingli/wechat-developer' => array(

2
vendor/services.php vendored
View File

@ -1,5 +1,5 @@
<?php <?php
// This file is automatically generated at:2021-06-23 14:34:11 // This file is automatically generated at:2021-06-25 12:08:14
declare (strict_types = 1); declare (strict_types = 1);
return array ( return array (
0 => 'think\\admin\\Library', 0 => 'think\\admin\\Library',

View File

@ -55,7 +55,7 @@ class JsonRpcClient
* @return mixed * @return mixed
* @throws Exception * @throws Exception
*/ */
public function __call(string $method, array $params) public function __call(string $method, array $params = [])
{ {
// Performs the HTTP POST // Performs the HTTP POST
$options = [ $options = [

View File

@ -75,8 +75,10 @@ class JsonRpcServer
$error = ['code' => '-32600', 'message' => '无效的请求', 'meaning' => '发送的JSON不是一个有效的请求对象']; $error = ['code' => '-32600', 'message' => '无效的请求', 'meaning' => '发送的JSON不是一个有效的请求对象'];
$response = ['jsonrpc' => '2.0', 'id' => $request['id'] ?? '0', 'result' => null, 'error' => $error]; $response = ['jsonrpc' => '2.0', 'id' => $request['id'] ?? '0', 'result' => null, 'error' => $error];
} else try { } else try {
// Executes the task on local object if (strtolower($request['method']) === '_get_class_name_') {
if (method_exists($object, $request['method'])) { $response = ['jsonrpc' => '2.0', 'id' => $request['id'], 'result' => get_class($object), 'error' => null];
} elseif (method_exists($object, $request['method'])) {
// Executes the task on local object
$result = call_user_func_array([$object, $request['method']], $request['params']); $result = call_user_func_array([$object, $request['method']], $request['params']);
$response = ['jsonrpc' => '2.0', 'id' => $request['id'], 'result' => $result, 'error' => null]; $response = ['jsonrpc' => '2.0', 'id' => $request['id'], 'result' => $result, 'error' => null];
} else { } else {
@ -102,6 +104,7 @@ class JsonRpcServer
$object = new ReflectionClass($object); $object = new ReflectionClass($object);
echo "<h2>" . $object->getName() . "</h2><hr>"; echo "<h2>" . $object->getName() . "</h2><hr>";
foreach ($object->getMethods(ReflectionMethod::IS_PUBLIC) as $method) { foreach ($object->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
if (stripos($method->getName(), '_') === 0) continue;
$params = []; $params = [];
foreach ($method->getParameters() as $parameter) { foreach ($method->getParameters() as $parameter) {
$type = $parameter->getType(); $type = $parameter->getType();