fix: 完善多云同步验证与实例统计

- 修复华为云签名、账单字段与区域映射缓存
- 按真实云实例更新账号服务器数并补充并发测试
This commit is contained in:
Logan.Li committed 2026-07-29 06:35:54 +08:00
1 parent 132fe9ba97
commit 9b895efee3
6 files changed
+226 -64

No files matched your search

-18
View File
@@ -33,24 +33,6 @@ func NewCloudAccountHandler(db *gorm.DB) *CloudAccountHandler {
func (h *CloudAccountHandler) ListCloudAccounts(c *gin.Context) {
var accounts []model.CloudAccount
h.db.Find(&accounts)
// 服务器数来自真实云账号关联,避免重复导入后被“本次新增数”覆盖。 // Logan.Li
type accountServerCount struct {
CloudAccountID uint
Total int
}
var serverCounts []accountServerCount
h.db.Model(&model.Server{}).
Select("cloud_account_id, COUNT(*) AS total").
Where("cloud_account_id IS NOT NULL").Group("cloud_account_id").Scan(&serverCounts)
countByAccount := make(map[uint]int, len(serverCounts))
for _, item := range serverCounts {
countByAccount[item.CloudAccountID] = item.Total
}
for index := range accounts {
if total, ok := countByAccount[accounts[index].ID]; ok {
accounts[index].ServerCount = total
}
}
c.JSON(http.StatusOK, model.Response{
Code: 200,