fix: 修复账户代理ip编辑保存不生效的bug

This commit is contained in:
shaw
2025-12-25 21:58:09 +08:00
parent eeaff85e47
commit b31698b9f2

View File

@@ -638,6 +638,7 @@ func (s *adminServiceImpl) UpdateAccount(ctx context.Context, id int64, input *U
} }
if input.ProxyID != nil { if input.ProxyID != nil {
account.ProxyID = input.ProxyID account.ProxyID = input.ProxyID
account.Proxy = nil // 清除关联对象,防止 GORM Save 时根据 Proxy.ID 覆盖 ProxyID
} }
// 只在指针非 nil 时更新 Concurrency支持设置为 0 // 只在指针非 nil 时更新 Concurrency支持设置为 0
if input.Concurrency != nil { if input.Concurrency != nil {
@@ -662,7 +663,8 @@ func (s *adminServiceImpl) UpdateAccount(ctx context.Context, id int64, input *U
} }
} }
return account, nil // 重新查询以确保返回完整数据(包括正确的 Proxy 关联对象)
return s.accountRepo.GetByID(ctx, id)
} }
// BulkUpdateAccounts updates multiple accounts in one request. // BulkUpdateAccounts updates multiple accounts in one request.