tongshanglei 1 年之前
父節點
當前提交
2355447c4b
共有 1 個文件被更改,包括 9 次插入2 次删除
  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']);
     // }