Bladeren bron

add wbw analyses mq

visuddhinanda 2 jaren geleden
bovenliggende
commit
c76a1199b3
2 gewijzigde bestanden met toevoegingen van 8 en 1 verwijderingen
  1. 2 1
      app/Console/Commands/TestMq.php
  2. 6 0
      app/Http/Controllers/WbwController.php

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

@@ -40,7 +40,8 @@ class TestMq extends Command
     public function handle()
     {
         //一对一
-		Mq::publish('hello','ok');
+		Mq::publish('wbw-analyses',[13607982709477376]);
+		//Mq::publish('hello','hello world');
 
         //一对多
         /*

+ 6 - 0
app/Http/Controllers/WbwController.php

@@ -14,6 +14,7 @@ use App\Tools\Tools;
 use App\Http\Api\AuthApi;
 use App\Http\Api\ShareApi;
 use App\Http\Api\ChannelApi;
+use App\Http\Api\Mq;
 
 class WbwController extends Controller
 {
@@ -132,6 +133,7 @@ class WbwController extends Controller
         }
 
         $count=0;
+        $wbwId = array();
         foreach ($request->get('data') as $row) {
             $wbw = Wbw::where('block_uid',$wbwBlockId)
                         ->where('wid',$row['sn'])
@@ -146,9 +148,13 @@ class WbwController extends Controller
                 $wbw->data = $wbwData;
                 $wbw->status = 5;
                 $wbw->save();
+                $wbwId[] = $wbw->id;
                 $count++;
             }
         }
+        if(count($wbwId)>0){
+            Mq::publish('wbw-analyses',$wbwId);
+        }
 
         return $this->ok(['rows'=>[],"count"=>$count]);
     }