Explorar el Código

fix: ValidateApplication sql first query condition record_id to id

luzhenqian hace 4 años
padre
commit
5cd5bd3075
Se han modificado 1 ficheros con 4 adiciones y 3 borrados
  1. 4 3
      services/registry/registry.go

+ 4 - 3
services/registry/registry.go

@@ -177,7 +177,7 @@ func (r *Registry) ValidateApplication(key string, reply *models.Application) er
 		app := cacheValue.(*models.Application)
 		setApplication(reply, app)
 	} else {
-		err = db.First(reply, id).Error
+		err = db.First(reply, "record_id = ?", id).Error
 		if err != nil {
 			return err
 		}
@@ -187,7 +187,7 @@ func (r *Registry) ValidateApplication(key string, reply *models.Application) er
 	}
 
 	if reply.AppKey != key {
-		return errors.New("app key not match.")
+		return errors.New("app key not match")
 	}
 
 	return nil
@@ -482,6 +482,7 @@ func (r *Registry) QueryRules(args *models.Rule, reply *[]models.Rule) error {
 
 	return nil
 }
+
 // CreateEvent create event
 func (r *Registry) CreateEvent(args *models.Event, reply *rpcs.ReplyEmptyResult) error {
 	db, err := getDB()
@@ -489,4 +490,4 @@ func (r *Registry) CreateEvent(args *models.Event, reply *rpcs.ReplyEmptyResult)
 		return err
 	}
 	return db.Save(args).Error
-}
+}