tongshanglei 1 rok pred
rodič
commit
2355447c4b
1 zmenil súbory, kde vykonal 9 pridanie a 2 odobranie
  1. 9 2
      task_script/LIVESTOCK_MQTT_PUBLISH.php

+ 9 - 2
task_script/LIVESTOCK_MQTT_PUBLISH.php

@@ -87,7 +87,7 @@ function sendConfig($topic,$config)
     $res=$mqtt->publish(
         $topic,
         $config,
-        0
+        1
     );
     echo 'publish end'.PHP_EOL;
     $mqtt->loop(true,true);
@@ -125,6 +125,10 @@ while (1) {
         $config=[
             $data['type']=>$data['config']
         ];
+    }elseif($data['type']=='get'){
+        $config=[
+            $data['type']=>$data['config']
+        ];
     }else{
         $config=[
             $data['type']=>[
@@ -136,7 +140,10 @@ while (1) {
     $config_json=json_encode($config);
     // var_dump($config_json);
     $res=sendConfig($topic,$config_json);
-    updateSendResult($data['msgid']);
+    if(isset($data['msgid'])){
+        updateSendResult($data['msgid']);
+    }
+    
     // if($res){
         // Db::table('send_config_log')->where('id',$data['msgid'])->update(['result'=>'1']);
     // }