瀏覽代碼

feature: 处理mqtt数据,有线离线,连接,接收消息处理

332777428@qq.com 5 月之前
父節點
當前提交
0977141302
共有 3 個文件被更改,包括 10 次插入12 次删除
  1. 1 0
      app.js
  2. 1 2
      pages/index/index.js
  3. 8 10
      utils/lexin/jump.js

+ 1 - 0
app.js

@@ -280,6 +280,7 @@ App({
       var publish = `/${DstDeviceName}/user/sub_control`;
       // {"type":"get_dev_info","DstDeviceName":"AIrSMArT_7cdfa1fd3af0","SrcDeviceName":"ALY_933625"}
       var dataString = `${JSON.stringify(data)}`;
+      console.log("gadfsqwerqewqrqr====" + dataString);
       that.globalData.client.publish(publish, dataString, (err) => {
         if (err) {
           console.log("发布消息失败");

+ 1 - 2
pages/index/index.js

@@ -343,7 +343,7 @@ Page({
   },
   // 回调
   mqttCallback(type, option) {
-    console.log("gadsfadsfadsfa==999===" + type + "====" + JSON.stringify(option));
+    // console.log("gadsfadsfadsfa==999===" + type + "====" + JSON.stringify(option));
     var that = this;
     let payloads = null;
     if (option && option.payload) {
@@ -464,7 +464,6 @@ Page({
   onTapChannelIndex(e) {
     var that = this;
     var index = e.currentTarget.dataset.index;
-    console.log("gadsfadsfadsfa==111==" + index);
     lexin_jump.toChannelIndex(index, function (i) {
       that.setData({
         actionIndex: i,

+ 8 - 10
utils/lexin/jump.js

@@ -9,19 +9,16 @@ function toChannelIndex(index, callback) {
   const route_util = require('../route_util');
   const route_constant = require('../route_constant');
   var isLogin = pages[0].getIsLogin();
-  console.log("gadsfadsfadsfa==222==");
   if (!isLogin) {
     route_util.jump(route_constant.login);
     return;
   }
 
-  console.log("gadsfadsfadsfa==333==");
   var actionIndex = pages[0].getActionIndex();
   if (actionIndex != null && index == actionIndex) {
     return;
   };
 
-  console.log("gadsfadsfadsfa==444==");
   var deviceList = pages[0].getDeviceList();
   var deviceListSelect = pages[0].getDeviceListSelect();
   if (deviceListSelect === null || deviceList.length <= deviceListSelect) {
@@ -32,10 +29,8 @@ function toChannelIndex(index, callback) {
     return;
   };
 
-  console.log("gadsfadsfadsfa==555==");
   callback(index);
 
-  console.log("gadsfadsfadsfa==666==");
   const app = getApp();
   const lexin_util = require('../lexin/util');
   var channelData = pages[0].getChannelData();
@@ -47,10 +42,11 @@ function toChannelIndex(index, callback) {
   var is_debug = app.globalData.is_debug;
 
   var deviceId = deviceList[deviceListSelect].deviceId;
+  /// 933625
   const other = {
     "url": "",
     "media_data": "",
-    "user_id": deviceUid,
+    "user_id": "933625",
     "timestamp": timestamp,
     "channel_id": channel_id,
     "order": "",
@@ -60,15 +56,17 @@ function toChannelIndex(index, callback) {
     "is_debug": is_debug,
   };
 
-  //other: {"url":"","media_data":"","user_id":1,"timestamp":1734423952,"channel_id":4,"order":"","resource_from":"","songAlbumID":"","version":3,"is_debug":2}
+  // {"url":"","media_data":"","user_id":"1","timestamp":1739514803,"channel_id":2,"order":"","resource_from":"","songAlbumID":"","version":3,"is_debug":1}
+
+  // 发送设备数据:true,/AIrSMArT_210052356337/user/sub_control, {"DstDeviceName":"AIrSMArT_210052356337","SrcDeviceName":"ALY_933625_Android","type":"play",
+  // "user_id":"933625","other"{"url":"","media_data":"","user_id":"933625","timestamp":"1726129883",
+  // "channel_id":9,"resource_from":"","categoryId":"","sort":0,"order":"2","version":3,"is_debug":1}}
   //deviceMacId: AIrSMArT_7cdfa1fd3af0
   var deviceMacId = lexin_util.getDeviceMacId(deviceId);
-  console.log("gadsfadsfadsfa==777==" + deviceMacId);
-  console.log("gadsfadsfadsfa==888==" + JSON.stringify(other));
   app.PubMsg({
     type: "play",
     DstDeviceName: deviceMacId,
-    other
+    other: other
   });
 };