This commit is contained in:
2026-06-24 10:04:03 +08:00
parent b103192fac
commit 0f961789dc
538 changed files with 128210 additions and 128008 deletions
+62 -62
View File
@@ -1,62 +1,62 @@
package controllers
import (
"server/services"
beego "github.com/beego/beego/v2/server/web"
)
type StorageMigrationController struct {
beego.Controller
}
// MigrateToQiniu 迁移文件到七牛云
// POST /platform/storage/migrateToQiniu
func (c *StorageMigrationController) MigrateToQiniu() {
// 这里简化处理,实际应该使用异步任务
// 可以使用 goroutine + 进度查询接口实现
// 获取租户ID(从token或参数)
tid := uint64(1) // 示例,实际应从认证信息获取
progress, err := services.MigrateLocalToQiniu(tid)
if err != nil {
c.Data["json"] = map[string]interface{}{
"code": 500,
"msg": "迁移失败: " + err.Error(),
"data": progress,
}
_ = c.ServeJSON()
return
}
c.Data["json"] = map[string]interface{}{
"code": 200,
"msg": "迁移完成",
"data": map[string]interface{}{
"total": progress.Total,
"success": progress.Success,
"failed": progress.Failed,
"errors": progress.Errors,
},
}
_ = c.ServeJSON()
}
// GetMigrationProgress 获取迁移进度
// GET /platform/storage/migrationProgress
func (c *StorageMigrationController) GetMigrationProgress() {
// 这里需要实现进度查询逻辑
// 可以使用全局变量或Redis存储进度信息
c.Data["json"] = map[string]interface{}{
"code": 200,
"msg": "success",
"data": map[string]interface{}{
"total": 0,
"success": 0,
"failed": 0,
"current": "",
},
}
_ = c.ServeJSON()
}
package controllers
import (
"server/services"
beego "github.com/beego/beego/v2/server/web"
)
type StorageMigrationController struct {
beego.Controller
}
// MigrateToQiniu 迁移文件到七牛云
// POST /platform/storage/migrateToQiniu
func (c *StorageMigrationController) MigrateToQiniu() {
// 这里简化处理,实际应该使用异步任务
// 可以使用 goroutine + 进度查询接口实现
// 获取租户ID(从token或参数)
tid := uint64(1) // 示例,实际应从认证信息获取
progress, err := services.MigrateLocalToQiniu(tid)
if err != nil {
c.Data["json"] = map[string]interface{}{
"code": 500,
"msg": "迁移失败: " + err.Error(),
"data": progress,
}
_ = c.ServeJSON()
return
}
c.Data["json"] = map[string]interface{}{
"code": 200,
"msg": "迁移完成",
"data": map[string]interface{}{
"total": progress.Total,
"success": progress.Success,
"failed": progress.Failed,
"errors": progress.Errors,
},
}
_ = c.ServeJSON()
}
// GetMigrationProgress 获取迁移进度
// GET /platform/storage/migrationProgress
func (c *StorageMigrationController) GetMigrationProgress() {
// 这里需要实现进度查询逻辑
// 可以使用全局变量或Redis存储进度信息
c.Data["json"] = map[string]interface{}{
"code": 200,
"msg": "success",
"data": map[string]interface{}{
"total": 0,
"success": 0,
"failed": 0,
"current": "",
},
}
_ = c.ServeJSON()
}