liuxiulin 7 months ago
parent
commit
26d8fcc7bc
2 changed files with 3 additions and 3 deletions
  1. 2 2
      pkg/models/ota.go
  2. 1 1
      services/knowoapi/model/ota.go

+ 2 - 2
pkg/models/ota.go

@@ -37,8 +37,8 @@ func (a *OtaUpgradeParams) Validate() error {
 	if a.FileId == "" {
 		return errors.New("非法参数:[file_id]")
 	}
-	if len(a.DeviceIDs) == 0 {
-		return errors.New("device_ids 不能为空")
+	if a.ProductId == "" && len(a.DeviceIDs) == 0 {
+		return errors.New("非法参数:[product_id,device_ids]")
 	}
 	return nil
 }

+ 1 - 1
services/knowoapi/model/ota.go

@@ -70,7 +70,7 @@ func (a *Ota) Delete(Ota *models.Ota) error {
 // Update update
 func (a *Ota) Update(Ota *models.Ota) (data models.Ota, err error) {
 	cache := getCache()
-	key := fmt.Sprintf("Sensor:%d", Ota.ID)
+	key := fmt.Sprintf("Ota:%d", Ota.ID)
 	if _, ok := cache.Get(key); ok {
 		cache.Delete(key)
 	}