瀏覽代碼

ComposerUpdate

邹景立 3 年之前
父節點
當前提交
9e41e91010

+ 4 - 13
app/wechat/service/WechatService.php

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

+ 4 - 4
vendor/composer/installed.json

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

+ 3 - 3
vendor/composer/installed.php

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

+ 1 - 1
vendor/services.php

@@ -1,5 +1,5 @@
 <?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);
 return array (
   0 => 'think\\admin\\Library',

+ 1 - 1
vendor/zoujingli/think-library/src/extend/JsonRpcClient.php

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

+ 5 - 2
vendor/zoujingli/think-library/src/extend/JsonRpcServer.php

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