浏览代码

rename send to publish

visuddhinanda 2 年之前
父节点
当前提交
99991e551d
共有 3 个文件被更改,包括 4 次插入4 次删除
  1. 1 1
      app/Console/Commands/TestMq.php
  2. 1 1
      app/Http/Api/Mq.php
  3. 2 2
      app/Http/Controllers/SentenceController.php

+ 1 - 1
app/Console/Commands/TestMq.php

@@ -40,7 +40,7 @@ class TestMq extends Command
     public function handle()
     {
         //一对一
-		Mq::send('hello','ok');
+		Mq::publish('hello','ok');
 
         //一对多
         /*

+ 1 - 1
app/Http/Api/Mq.php

@@ -3,7 +3,7 @@ namespace App\Http\Api;
 use PhpAmqpLib\Connection\AMQPStreamConnection;
 use PhpAmqpLib\Message\AMQPMessage;
 class Mq{
-    public static function send(string $channelName, $message){
+    public static function publish(string $channelName, $message){
                 //一对一
 		$connection = new AMQPStreamConnection(env("MQ_HOST"), env("MQ_PORT"), env("MQ_USERNAME"), env("MQ_PASSWORD"));
 		$channel = $connection->channel();

+ 2 - 2
app/Http/Controllers/SentenceController.php

@@ -268,7 +268,7 @@ class SentenceController extends Controller
             $this->saveHistory($row->uid,$user["user_uid"],$sent['content']);
         }
         if($sentFirst !== null){
-            Mq::send('progress',['book'=>$sentFirst['book_id'],
+            Mq::publish('progress',['book'=>$sentFirst['book_id'],
                                 'para'=>$sentFirst['paragraph'],
                                 'channel'=>$channel->uid,
                                 ]);
@@ -366,7 +366,7 @@ class SentenceController extends Controller
         Cache::forget("/sent/{$channelId}/{$currSentId}");
         //保存历史记录
         $this->saveHistory($sent->uid,$user["user_uid"],$request->get('content'));
-        Mq::send('progress',['book'=>$param[0],
+        Mq::publish('progress',['book'=>$param[0],
                             'para'=>$param[1],
                             'channel'=>$channelId,
                             ]);