Browse Source

系统消息

rkljw 1 ngày trước cách đây
mục cha
commit
e7df8a2a67
5 tập tin đã thay đổi với 674 bổ sung11 xóa
  1. 20 0
      app/Amqp/Producer/MqProducer.php
  2. 191 8
      app/JsonRpc/NewsService.php
  3. 3 2
      composer.json
  4. 418 1
      composer.lock
  5. 42 0
      config/autoload/amqp.php

+ 20 - 0
app/Amqp/Producer/MqProducer.php

@@ -0,0 +1,20 @@
+<?php
+
+declare (strict_types = 1);
+
+namespace App\Amqp\Producer;
+
+use Hyperf\Amqp\Annotation\Producer;
+use Hyperf\Amqp\Message\ProducerMessage;
+
+#[Producer(exchange: 'chatprod', routingKey: 'chatprod')]
+class MqProducer extends ProducerMessage
+{
+    public function __construct($data)
+    {
+//        $this->poolName = 'default';
+        var_dump($data, '生产者数据');
+
+        $this->payload = $data;
+    }
+}

+ 191 - 8
app/JsonRpc/NewsService.php

@@ -65,6 +65,12 @@ use Illuminate\Support\Facades\Cache;
 use App\Model\Company;
 use Hyperf\Paginator\Paginator;
 use App\Model\Project;    
+
+use Hyperf\Context\Context;
+use Hyperf\Context\ApplicationContext as ContextApplicationContext;
+use Hyperf\Amqp\Producer;
+
+use App\Amqp\Producer\MqProducer;
 #[RpcService(name: "NewsService", protocol: "jsonrpc-http", server: "jsonrpc-http")]
 class NewsService implements NewsServiceInterface
 {
@@ -489,7 +495,14 @@ class NewsService implements NewsServiceInterface
         // 截取 100 个字符
         $articleData['introduce'] = mb_substr($content, 0, 100);
       }
-
+      if($articleData['status']==0){
+        $this->sendMessage([
+          'talk_type'=>100,
+          'title'=>$articleData['title'],
+          'content'=>'提交了审核',
+          'messageType'=>2,
+        ]);
+      }
       $id = Article::insertGetId($articleData);
       $articleDataContent = [
         'article_id' => $id,
@@ -672,7 +685,13 @@ class NewsService implements NewsServiceInterface
         // 截取 100 个字符
         $articleData['introduce'] = mb_substr($content, 0, 100);
       }
-
+      if($articleData['status']==0){
+        $this->sendMessage([
+          'talk_type'=>100,
+          'title'=>$articleData['title'],
+          'content'=>'提交了审核',
+          'messageType'=>2,]);
+      }
       $id = Article::where(['id' => $data['id']])->update($articleData);
       $articleDataContent = [
         'content' => $data['content'],
@@ -751,6 +770,27 @@ class NewsService implements NewsServiceInterface
    */
   public function upArticleStatus(array $data): array
   {
+    $articleData = Article::where(['id' => $data['id']])->first();
+    if($data['status']==1){
+      $this->sendMessage([
+        'talk_type'=>101,
+        'title'=>$articleData['title'],
+        'content'=>'审核通过',
+        'messageType'=>2,
+        'user_id'=>$articleData['admin_user_id'],
+      ]);
+    }
+    if($data['status']==2){
+      $this->sendMessage([
+        'talk_type'=>101,
+        'title'=>$articleData['title'],
+        'content'=>'审核拒绝',
+        'messageType'=>2,
+        'user_id'=>$articleData['admin_user_id'],
+      ]);
+    }
+
+
     $result = Article::where(['id' => $data['id']])->update($data);
     if (isset($data['ignore_ids']) && !empty($data['ignore_ids'])) {
       //article_ignore  表插入数据  db操作
@@ -3607,8 +3647,14 @@ class NewsService implements NewsServiceInterface
       $data['description'] = mb_substr($cleaned, 0, 100, 'UTF-8');
       // $data['description'] = substr(preg_replace('/\s+/', '', strip_tags($data['detail'])), 0, 100);
     }
-
-
+    if($data['status']==1){
+      $this->sendMessage([
+        'talk_type'=>200,
+        'title'=>$data['name'],
+        'content'=>'提交了审核',
+        'messageType'=>3,
+      ]);
+    }
 
     $result = Good::insert($data);
     if (empty($result)) {
@@ -3654,7 +3700,14 @@ class NewsService implements NewsServiceInterface
       $cleaned = preg_replace('/\s+/', '', strip_tags(html_entity_decode($data['detail'], ENT_QUOTES, 'UTF-8')));
       $data['description'] = mb_substr($cleaned, 0, 100, 'UTF-8');
     }
-
+    if($data['status']==1){
+      $this->sendMessage([
+        'talk_type'=>200,
+        'title'=>$data['name'],
+        'content'=>'提交了审核',
+        'messageType'=>3,
+      ]);
+    }
 
     $result = Good::where('id', $data['id'])->update($data);
     if (empty($result)) {
@@ -3939,6 +3992,12 @@ class NewsService implements NewsServiceInterface
     $chat_ids = $user_id;
     $user_id = json_encode($user_id);
     $data['re_user_ids'] = $user_id;
+    $this->sendMessage([
+      'talk_type'=>700,
+      'title'=>$data['title'],
+      'content'=>'提交了审核',
+      'messageType'=>5,
+    ]);
     $result = Notice::insertGetId($data);
     if ($result && $data['is_group'] == 1) {
       //chat_group
@@ -4031,6 +4090,12 @@ class NewsService implements NewsServiceInterface
     $user_id = json_encode($user_id);
     $data['re_user_ids'] = $user_id;
     $data['updated_at'] = date('Y-m-d H:i:s');
+    $this->sendMessage([
+      'talk_type'=>700,
+      'title'=>$data['title'],
+      'content'=>'提交了审核',
+      'messageType'=>5,
+    ]);
     $result = Notice::where('id', $data['id'])->update($data);
     return Result::success($result);
   }
@@ -4220,6 +4285,12 @@ class NewsService implements NewsServiceInterface
     date_default_timezone_set('Asia/Shanghai');
     $data['created_at'] = date('Y-m-d H:i:s');
     $data['updated_at'] = date('Y-m-d H:i:s');
+    $this->sendMessage([
+      'talk_type'=>800,
+      'title'=>$data['title'],
+      'content'=>'提交了审核',
+      'messageType'=>6,
+    ]);
     $result = Complaint::create($data);
     return Result::success($result);
   }
@@ -4232,6 +4303,12 @@ class NewsService implements NewsServiceInterface
     $type_id = $data['type_id'] ?? 0;
     unset($data['user_id']);
     unset($data['type_id']);
+    $this->sendMessage([
+      'talk_type'=>800,
+      'title'=>$data['title'],
+      'content'=>'提交了审核',
+      'messageType'=>6,
+    ]);
     $result = Complaint::where('id', $data['id'])->update($data);
     return Result::success($result);
   }
@@ -4270,7 +4347,59 @@ class NewsService implements NewsServiceInterface
         return Result::error("处理人错误", 0);
       }
     }
-
+    $complaintInfo = Complaint::where('id', $data['id'])->first();
+    if($data['status']==2 && !isset($data['deal'])){
+      $this->sendMessage([
+        'talk_type'=>801,
+        'title'=>$complaintInfo['title'],
+        'content'=>'审核通过',
+        'messageType'=>6,
+        'user_id'=>$complaintInfo['user_id'],
+      ]);
+      $this->sendMessage([
+        'talk_type'=>802,
+        'title'=>$complaintInfo['title'],
+        'content'=>'待处理',
+        'messageType'=>6,
+        'user_id'=>$complaintInfo['re_user_ids'],
+      ]);
+    }
+    if($data['status']==3 && !isset($data['deal'])){
+      $this->sendMessage([
+        'talk_type'=>801,
+        'title'=>$complaintInfo['title'],
+        'content'=>'审核拒绝',
+        'messageType'=>6,
+        'user_id'=>$complaintInfo['user_id'],
+      ]);
+    }
+    if($data['status']==2 && isset($data['deal']) && $data['deal']==2){
+      $this->sendMessage([
+        'talk_type'=>802,
+        'title'=>$complaintInfo['title'],
+        'content'=>'处理中',
+        'messageType'=>6,
+        'user_id'=>$complaintInfo['re_user_ids'],
+      ]);
+    }
+    if($data['status']==2 && isset($data['deal']) && $data['deal']==4){
+      $this->sendMessage([
+        'talk_type'=>802,
+        'title'=>$complaintInfo['title'],
+        'content'=>'不予处理',
+        'messageType'=>6,
+        'user_id'=>$complaintInfo['re_user_ids'],
+      ]);
+    }
+    if($data['status']==2 && isset($data['deal']) && $data['deal']==3){
+      $this->sendMessage([
+        'talk_type'=>802,
+        'title'=>$complaintInfo['title'],
+        'content'=>'已完结',
+        'messageType'=>6,
+        'user_id'=>$complaintInfo['re_user_ids'],
+      ]);
+    }
     $result = complaint::where('id', $data['id'])->update($data);
     return Result::success($result);
   }
@@ -4280,7 +4409,25 @@ class NewsService implements NewsServiceInterface
     $type_id = $data['type_id'] ?? 0;
     unset($data['user_id']);
     unset($data['type_id']);
-
+    $goodInfo = Good::where('id', $data['id'])->first();
+    if($data['status']==2){
+      $this->sendMessage([
+        'talk_type'=>201,
+        'title'=>$goodInfo['name'],
+        'content'=>'审核通过',
+        'messageType'=>3,
+        'user_id'=>$goodInfo['user_id'],
+      ]);
+    }
+    if($data['status']==3){
+      $this->sendMessage([
+        'talk_type'=>201,
+        'title'=>$goodInfo['name'],
+        'content'=>'审核拒绝',
+        'messageType'=>3,
+        'user_id'=>$goodInfo['user_id'],
+      ]);
+    }
     $result = Good::where('id', $data['id'])->update($data);
     return Result::success($result);
   }
@@ -4300,6 +4447,25 @@ class NewsService implements NewsServiceInterface
     unset($data['user_id']);
     unset($data['type_id']);
     $result = Notice::where('id', $data['id'])->update($data);
+    $noticeInfo = Notice::where('id', $data['id'])->first();
+    if($data['status']==2){
+      $this->sendMessage([
+        'talk_type'=>701,
+        'title'=>$noticeInfo['title'],
+        'content'=>'审核通过',
+        'messageType'=>3,
+        'user_id'=>$noticeInfo['user_id'],
+      ]);
+    }
+    if($data['status']==3){
+      $this->sendMessage([
+        'talk_type'=>701,
+        'title'=>$noticeInfo['title'],
+        'content'=>'审核拒绝',
+        'messageType'=>3,
+        'user_id'=>$noticeInfo['user_id'],
+      ]);
+    }
     return Result::success($result);
   }
   public function getDUser(array $data): array
@@ -6793,5 +6959,22 @@ class NewsService implements NewsServiceInterface
         ];
         return Result::success($result);
     }
-
+    /**
+     * 发送消息
+     * @param array $messageData
+     * @return void
+     */
+    public function sendMessage($messageData){
+        $msg =[
+          'talk_type'=>$messageData['talk_type'],
+          'title'=>$messageData['title'],
+          'content'=>$messageData['content'],
+          'messageType'=>$messageData['messageType'],
+          'user_id'=>$messageData['user_id']??'',
+        ];
+        $message = new MqProducer($msg);
+        $producer = ContextApplicationContext::getContainer()->get(Producer::class);
+        $producer->produce($message);
+        
+    }
 }

+ 3 - 2
composer.json

@@ -15,6 +15,7 @@
         "php": ">=8.1",
         "doctrine/annotations": "^2.0",
         "fukuball/jieba-php": "^0.34.0",
+        "hyperf/amqp": "^3.1",
         "hyperf/cache": "~3.1.0",
         "hyperf/command": "~3.1.0",
         "hyperf/config": "~3.1.0",
@@ -40,8 +41,8 @@
         "hyperf/service-governance-nacos": "^3.1",
         "hyperf/snowflake": "^3.1",
         "hyperf/utils": "^3.1",
-        "ramsey/uuid": "^4.7",
-        "illuminate/cache": "^10.48"
+        "illuminate/cache": "^10.48",
+        "ramsey/uuid": "^4.7"
     },
     "require-dev": {
         "friendsofphp/php-cs-fixer": "^3.0",

+ 418 - 1
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
         "This file is @generated automatically"
     ],
-    "content-hash": "93d050353fc587b1b1fb188f0a8c068c",
+    "content-hash": "0202fb40b9469c4533981cf7fdd0ce92",
     "packages": [
         {
             "name": "brick/math",
@@ -1018,6 +1018,91 @@
             ],
             "time": "2025-03-27T12:30:47+00:00"
         },
+        {
+            "name": "hyperf/amqp",
+            "version": "v3.1.58",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/hyperf/amqp.git",
+                "reference": "15ed5c2e39d35e1b28be9afad635c3fd9f93841b"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/hyperf/amqp/zipball/15ed5c2e39d35e1b28be9afad635c3fd9f93841b",
+                "reference": "15ed5c2e39d35e1b28be9afad635c3fd9f93841b",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "doctrine/instantiator": "^1.2.0",
+                "hyperf/codec": "~3.1.0",
+                "hyperf/collection": "~3.1.0",
+                "hyperf/context": "~3.1.0",
+                "hyperf/contract": "~3.1.0",
+                "hyperf/coordinator": "~3.1.0",
+                "hyperf/coroutine": "~3.1.0",
+                "hyperf/engine": "^2.0",
+                "hyperf/pool": "~3.1.0",
+                "hyperf/process": "~3.1.0",
+                "hyperf/support": "~3.1.0",
+                "php": ">=8.1",
+                "php-amqplib/php-amqplib": "^3.5",
+                "psr/container": "^1.0 || ^2.0",
+                "psr/event-dispatcher": "^1.0",
+                "psr/log": "^1.0 || ^2.0 || ^3.0"
+            },
+            "suggest": {
+                "hyperf/di": "Required to use annotations.",
+                "hyperf/event": "Declare queue and start consumers automatically."
+            },
+            "type": "library",
+            "extra": {
+                "hyperf": {
+                    "config": "Hyperf\\Amqp\\ConfigProvider"
+                },
+                "branch-alias": {
+                    "dev-master": "3.1-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Hyperf\\Amqp\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "description": "A amqplib for hyperf.",
+            "homepage": "https://hyperf.io",
+            "keywords": [
+                "AMQP",
+                "hyperf",
+                "php"
+            ],
+            "support": {
+                "docs": "https://hyperf.wiki",
+                "issues": "https://github.com/hyperf/hyperf/issues",
+                "pull-request": "https://github.com/hyperf/hyperf/pulls",
+                "source": "https://github.com/hyperf/hyperf"
+            },
+            "funding": [
+                {
+                    "url": "https://hyperf.wiki/#/zh-cn/donate",
+                    "type": "custom"
+                },
+                {
+                    "url": "https://opencollective.com/hyperf",
+                    "type": "open_collective"
+                }
+            ],
+            "time": "2025-06-23T03:55:31+00:00"
+        },
         {
             "name": "hyperf/cache",
             "version": "v3.1.56",
@@ -5811,6 +5896,222 @@
             },
             "time": "2024-09-29T15:01:53+00:00"
         },
+        {
+            "name": "paragonie/constant_time_encoding",
+            "version": "v3.0.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/paragonie/constant_time_encoding.git",
+                "reference": "df1e7fde177501eee2037dd159cf04f5f301a512"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/paragonie/constant_time_encoding/zipball/df1e7fde177501eee2037dd159cf04f5f301a512",
+                "reference": "df1e7fde177501eee2037dd159cf04f5f301a512",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "php": "^8"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "^9",
+                "vimeo/psalm": "^4|^5"
+            },
+            "type": "library",
+            "autoload": {
+                "psr-4": {
+                    "ParagonIE\\ConstantTime\\": "src/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Paragon Initiative Enterprises",
+                    "email": "security@paragonie.com",
+                    "homepage": "https://paragonie.com",
+                    "role": "Maintainer"
+                },
+                {
+                    "name": "Steve 'Sc00bz' Thomas",
+                    "email": "steve@tobtu.com",
+                    "homepage": "https://www.tobtu.com",
+                    "role": "Original Developer"
+                }
+            ],
+            "description": "Constant-time Implementations of RFC 4648 Encoding (Base-64, Base-32, Base-16)",
+            "keywords": [
+                "base16",
+                "base32",
+                "base32_decode",
+                "base32_encode",
+                "base64",
+                "base64_decode",
+                "base64_encode",
+                "bin2hex",
+                "encoding",
+                "hex",
+                "hex2bin",
+                "rfc4648"
+            ],
+            "support": {
+                "email": "info@paragonie.com",
+                "issues": "https://github.com/paragonie/constant_time_encoding/issues",
+                "source": "https://github.com/paragonie/constant_time_encoding"
+            },
+            "time": "2024-05-08T12:36:18+00:00"
+        },
+        {
+            "name": "paragonie/random_compat",
+            "version": "v9.99.100",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/paragonie/random_compat.git",
+                "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a",
+                "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "php": ">= 7"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "4.*|5.*",
+                "vimeo/psalm": "^1"
+            },
+            "suggest": {
+                "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
+            },
+            "type": "library",
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Paragon Initiative Enterprises",
+                    "email": "security@paragonie.com",
+                    "homepage": "https://paragonie.com"
+                }
+            ],
+            "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
+            "keywords": [
+                "csprng",
+                "polyfill",
+                "pseudorandom",
+                "random"
+            ],
+            "support": {
+                "email": "info@paragonie.com",
+                "issues": "https://github.com/paragonie/random_compat/issues",
+                "source": "https://github.com/paragonie/random_compat"
+            },
+            "time": "2020-10-15T08:29:30+00:00"
+        },
+        {
+            "name": "php-amqplib/php-amqplib",
+            "version": "v3.6.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/php-amqplib/php-amqplib.git",
+                "reference": "76eee289e98b0b309a761787e65cbe1acbaf8c72"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/php-amqplib/php-amqplib/zipball/76eee289e98b0b309a761787e65cbe1acbaf8c72",
+                "reference": "76eee289e98b0b309a761787e65cbe1acbaf8c72",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "ext-mbstring": "*",
+                "ext-sockets": "*",
+                "php": "^7.2||^8.0",
+                "phpseclib/phpseclib": "^2.0|^3.0"
+            },
+            "conflict": {
+                "php": "7.4.0 - 7.4.1"
+            },
+            "replace": {
+                "videlalvaro/php-amqplib": "self.version"
+            },
+            "require-dev": {
+                "ext-curl": "*",
+                "nategood/httpful": "^0.2.20",
+                "phpunit/phpunit": "^7.5|^9.5",
+                "squizlabs/php_codesniffer": "^3.6"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "3.0-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "PhpAmqpLib\\": "PhpAmqpLib/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "LGPL-2.1-or-later"
+            ],
+            "authors": [
+                {
+                    "name": "Alvaro Videla",
+                    "role": "Original Maintainer"
+                },
+                {
+                    "name": "Raúl Araya",
+                    "email": "nubeiro@gmail.com",
+                    "role": "Maintainer"
+                },
+                {
+                    "name": "Luke Bakken",
+                    "email": "luke@bakken.io",
+                    "role": "Maintainer"
+                },
+                {
+                    "name": "Ramūnas Dronga",
+                    "email": "github@ramuno.lt",
+                    "role": "Maintainer"
+                }
+            ],
+            "description": "Formerly videlalvaro/php-amqplib.  This library is a pure PHP implementation of the AMQP protocol. It's been tested against RabbitMQ.",
+            "homepage": "https://github.com/php-amqplib/php-amqplib/",
+            "keywords": [
+                "message",
+                "queue",
+                "rabbitmq"
+            ],
+            "support": {
+                "issues": "https://github.com/php-amqplib/php-amqplib/issues",
+                "source": "https://github.com/php-amqplib/php-amqplib/tree/v3.6.1"
+            },
+            "time": "2024-02-07T17:21:26+00:00"
+        },
         {
             "name": "php-di/phpdoc-reader",
             "version": "2.2.1",
@@ -5940,6 +6241,122 @@
             ],
             "time": "2024-07-20T21:41:07+00:00"
         },
+        {
+            "name": "phpseclib/phpseclib",
+            "version": "3.0.43",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/phpseclib/phpseclib.git",
+                "reference": "709ec107af3cb2f385b9617be72af8cf62441d02"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/709ec107af3cb2f385b9617be72af8cf62441d02",
+                "reference": "709ec107af3cb2f385b9617be72af8cf62441d02",
+                "shasum": "",
+                "mirrors": [
+                    {
+                        "url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
+                        "preferred": true
+                    }
+                ]
+            },
+            "require": {
+                "paragonie/constant_time_encoding": "^1|^2|^3",
+                "paragonie/random_compat": "^1.4|^2.0|^9.99.99",
+                "php": ">=5.6.1"
+            },
+            "require-dev": {
+                "phpunit/phpunit": "*"
+            },
+            "suggest": {
+                "ext-dom": "Install the DOM extension to load XML formatted public keys.",
+                "ext-gmp": "Install the GMP (GNU Multiple Precision) extension in order to speed up arbitrary precision integer arithmetic operations.",
+                "ext-libsodium": "SSH2/SFTP can make use of some algorithms provided by the libsodium-php extension.",
+                "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.",
+                "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations."
+            },
+            "type": "library",
+            "autoload": {
+                "files": [
+                    "phpseclib/bootstrap.php"
+                ],
+                "psr-4": {
+                    "phpseclib3\\": "phpseclib/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Jim Wigginton",
+                    "email": "terrafrost@php.net",
+                    "role": "Lead Developer"
+                },
+                {
+                    "name": "Patrick Monnerat",
+                    "email": "pm@datasphere.ch",
+                    "role": "Developer"
+                },
+                {
+                    "name": "Andreas Fischer",
+                    "email": "bantu@phpbb.com",
+                    "role": "Developer"
+                },
+                {
+                    "name": "Hans-Jürgen Petrich",
+                    "email": "petrich@tronic-media.com",
+                    "role": "Developer"
+                },
+                {
+                    "name": "Graham Campbell",
+                    "email": "graham@alt-three.com",
+                    "role": "Developer"
+                }
+            ],
+            "description": "PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc.",
+            "homepage": "http://phpseclib.sourceforge.net",
+            "keywords": [
+                "BigInteger",
+                "aes",
+                "asn.1",
+                "asn1",
+                "blowfish",
+                "crypto",
+                "cryptography",
+                "encryption",
+                "rsa",
+                "security",
+                "sftp",
+                "signature",
+                "signing",
+                "ssh",
+                "twofish",
+                "x.509",
+                "x509"
+            ],
+            "support": {
+                "issues": "https://github.com/phpseclib/phpseclib/issues",
+                "source": "https://github.com/phpseclib/phpseclib/tree/3.0.43"
+            },
+            "funding": [
+                {
+                    "url": "https://github.com/terrafrost",
+                    "type": "github"
+                },
+                {
+                    "url": "https://www.patreon.com/phpseclib",
+                    "type": "patreon"
+                },
+                {
+                    "url": "https://tidelift.com/funding/github/packagist/phpseclib/phpseclib",
+                    "type": "tidelift"
+                }
+            ],
+            "time": "2024-12-14T21:12:59+00:00"
+        },
         {
             "name": "psr/cache",
             "version": "3.0.0",

+ 42 - 0
config/autoload/amqp.php

@@ -0,0 +1,42 @@
+<?php
+
+declare (strict_types = 1);
+use function Hyperf\Support\env;
+return [
+    'enable' => true,
+    'default' => [
+        'host' => env('AMQP_HOST', '192.168.1.127'),
+        'port' => (int) env('AMQP_PORT', 5672),
+        'user' => env('AMQP_USER', 'guest'),
+        'password' => env('AMQP_PASSWORD', 'guest'),
+        'vhost' => '/',
+        'concurrent' => [
+            'limit' => 1,
+        ],
+        'pool' => [
+            'min_connections' => 1,
+            'max_connections' => 1, // 限制最大连接数为1
+            'connect_timeout' => 1000.0,
+            'wait_timeout' => 3.0,
+            'heartbeat' => -1,
+            
+        ],
+        'params' => [
+            'insist' => false,
+            'login_method' => 'AMQPLAIN',
+            'login_response' => null,
+            'locale' => 'en_US',
+            'connection_timeout' => 3.0,
+            // 尽量保持是 heartbeat 数值的两倍
+            'read_write_timeout' => 6.0,
+            'context' => null,
+            'keepalive' => false,
+            // 尽量保证每个消息的消费时间小于心跳时间
+            'heartbeat' => 3,
+            'close_on_destruct' => false,
+        ],
+    ],
+    'pool2' => [
+
+    ],
+];