liuxiulin 7 miesięcy temu
rodzic
commit
55ae97cd49

+ 3 - 4
services/emqx-agent/agent.go

@@ -355,7 +355,7 @@ func (a *Access) chunkUpgrade(params rpcs.ChunkUpgrade) error {
 		return err
 	}
 	if fileReply.File == nil {
-		return errors.New(fmt.Sprintf("文件:%s 获取失败", params.FileId))
+		return errors.New(fmt.Sprintf("文件:%d 获取失败", params.FileId))
 	}
 	start := params.Offset * int(params.Size)
 	stop := (params.Offset + 1) * int(params.Size)
@@ -365,17 +365,16 @@ func (a *Access) chunkUpgrade(params rpcs.ChunkUpgrade) error {
 	if stop < start {
 		start = stop
 	}
-	server.Log.Infof("文件截取位置------: start:%d,stop:%d", start, stop)
+	server.Log.Infof("<--------fileId:%d,offset:%d,文件截取位置------: start:%d,stop:%d", params.FileId, params.FileSize, start, stop)
 
 	data := fileReply.File[start:stop]
 
 	buf.Write(gbinary.BeEncodeUint16(gconv.Uint16(len(data))))
 	buf.Write(data)
-	server.Log.Infof("1----------填充文件:%2X", buf.Bytes())
 	var mCrc crc
 	checkSum := mCrc.reset().pushBytes(buf.Bytes()).value()
 	buf.Write([]byte{byte(checkSum), byte(checkSum >> 8)})
-	server.Log.Infof("2----------填充CRC:%2X", buf.Bytes())
+	server.Log.Infof("--------> %2X", buf.Bytes())
 	var SendByteArgs rpcs.ArgsSendByteData
 	SendByteArgs.DeviceId = params.DeviceId
 	SendByteArgs.Data = buf.Bytes()

+ 3 - 0
services/knowoapi/services/ota.go

@@ -60,6 +60,9 @@ func (a otaService) Upgrade(params models.OtaUpgradeParams) error {
 	}
 
 	devices, err := a.models.Device.Query(params.VendorId, params.ProductId, params.DeviceIDs)
+	if err != nil {
+		return err
+	}
 
 	client := ghttp.NewClient()
 	file := client.GetVar(fmt.Sprintf("%s%s", "https://app.yongxulvjian.com", ota.Url))