瀏覽代碼

fix(flexCdn): 修复获取 cc ip list 时的排序问题

- 在查询 cloud_ip_items 表时添加了 Order("id desc") 方法
- 确保返回的 IP 列表按照 id 降序排列,以满足业务需求
fusu 2 周之前
父節點
當前提交
eb00aa3974
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      internal/repository/api/flexCdn/cciplist.go

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

@@ -33,7 +33,7 @@ func (r *ccIpListRepository) GetCcIpList(ctx context.Context, serverId int64) ([
 	if err != nil {
 		return nil, err
 	}
-	return req, r.DBWithName(ctx,"cdn").Table("cloud_ip_items").Where("listId = ? AND sourceCategory = ?", ipListId, "cc").Select("value,type, reason").Scan(&req).Error
+	return req, r.DBWithName(ctx,"cdn").Table("cloud_ip_items").Where("listId = ? AND sourceCategory = ?", ipListId, "cc").Order("id desc").Select("value,type, reason").Scan(&req).Error
 }
 
 func (r *ccIpListRepository) GetHttpWebId(ctx context.Context, serverId int64) (int64, error) {