Selaa lähdekoodia

fix(internal/repository/api/flexCdn): 修复 ccIpList 查询语句中的参数绑定

- 将字符串参数 'cc' 用双引号括起来,确保正确的 SQL 语法
- 使用占位符 '?' 代替字符串插值,提高代码安全性和可维护性
fusu 2 viikkoa sitten
vanhempi
sitoutus
c1b0de2383
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1 1
      internal/repository/api/flexCdn/cciplist.go

+ 1 - 1
internal/repository/api/flexCdn/cciplist.go

@@ -30,7 +30,7 @@ func (r *ccIpListRepository) GetCcIpList(ctx context.Context, serverId int64) ([
 		return nil, err
 	}
 	var ips []string
-	return ips, r.DBWithName(ctx,"cdn").Table("cloud_ip_items").Where("listId = ? AND sourceCategory = cc", ipListId).Select("value").Scan(&ips).Error
+	return ips, r.DBWithName(ctx,"cdn").Table("cloud_ip_items").Where("listId = ? AND sourceCategory = ?", ipListId, "cc").Select("value").Scan(&ips).Error
 }
 
 func (r *ccIpListRepository) GetHttpWebId(ctx context.Context, serverId int64) (int64, error) {