Sfoglia il codice sorgente

fix(internal/repository): 修复全球限流中状态值错误

-将查询条件中的状态值从0 修改为 false,以匹配布尔类型的 state 字段
- 此修改确保了查询条件的正确性,避免了潜在的错误和性能问题
fusu 3 settimane fa
parent
commit
9384eb2c71
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      internal/repository/globallimit.go

+ 1 - 1
internal/repository/globallimit.go

@@ -62,7 +62,7 @@ func (r *globalLimitRepository) UpdateGlobalLimitByHostId(ctx context.Context, r
 
 func (r *globalLimitRepository) IsGlobalLimitExistByHostId(ctx context.Context, hostId int64) (bool, error) {
 	var count int64
-	err := r.DB(ctx).Model(&model.GlobalLimit{}).Where("host_id = ? AND state = 0", hostId).Count(&count).Error
+	err := r.DB(ctx).Model(&model.GlobalLimit{}).Where("host_id = ? AND state = false", hostId).Count(&count).Error
 
 	if err != nil {
 		return false, err