更新密码找回uniapp
This commit is contained in:
1 parent
7f9a66da0f
commit
3fdda89833
1304 files changed
+3503
-26132
No files matched your search
@@ -10,7 +10,6 @@ import (
|
||||
"server/models"
|
||||
)
|
||||
|
||||
// MigrationProgress 迁移进度
|
||||
type MigrationProgress struct {
|
||||
Total int
|
||||
Success int
|
||||
@@ -21,21 +20,18 @@ type MigrationProgress struct {
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
// AddSuccess 增加成功计数
|
||||
func (p *MigrationProgress) AddSuccess() {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
p.Success++
|
||||
}
|
||||
|
||||
// AddSkipped 增加跳过计数
|
||||
func (p *MigrationProgress) AddSkipped() {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
p.Skipped++
|
||||
}
|
||||
|
||||
// AddFailed 增加失败计数
|
||||
func (p *MigrationProgress) AddFailed(err string) {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
@@ -43,28 +39,24 @@ func (p *MigrationProgress) AddFailed(err string) {
|
||||
p.Errors = append(p.Errors, err)
|
||||
}
|
||||
|
||||
// SetCurrent 设置当前处理的文件
|
||||
func (p *MigrationProgress) SetCurrent(filename string) {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
p.Current = filename
|
||||
}
|
||||
|
||||
// GetProgress 获取进度信息
|
||||
func (p *MigrationProgress) GetProgress() (int, int, int, string) {
|
||||
p.mu.Lock()
|
||||
defer p.mu.Unlock()
|
||||
return p.Total, p.Success, p.Failed, p.Current
|
||||
}
|
||||
|
||||
// StorageMigration 存储迁移服务
|
||||
type StorageMigration struct {
|
||||
fromService StorageService
|
||||
toService StorageService
|
||||
progress *MigrationProgress
|
||||
}
|
||||
|
||||
// NewStorageMigration 创建存储迁移服务
|
||||
func NewStorageMigration(from, to StorageService) *StorageMigration {
|
||||
return &StorageMigration{
|
||||
fromService: from,
|
||||
@@ -75,7 +67,6 @@ func NewStorageMigration(from, to StorageService) *StorageMigration {
|
||||
}
|
||||
}
|
||||
|
||||
// TargetKey 计算某条文件记录改造后的新 key
|
||||
func TargetKey(f *models.SystemFile) string {
|
||||
source := f.Source
|
||||
if source == "" {
|
||||
@@ -114,7 +105,6 @@ func (m *StorageMigration) MigrateFile(file *models.SystemFile) error {
|
||||
return fmt.Errorf("移动文件失败: %w", err)
|
||||
}
|
||||
} else {
|
||||
// 跨存储:仅支持 本地 → 七牛
|
||||
localFrom, ok := m.fromService.(*LocalStorage)
|
||||
if !ok {
|
||||
return fmt.Errorf("暂不支持从 %s 迁出到 %s", m.fromService.Type(), m.toService.Type())
|
||||
@@ -165,7 +155,6 @@ func (m *StorageMigration) MigrateFile(file *models.SystemFile) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// MigrateAll 迁移所有文件
|
||||
func (m *StorageMigration) MigrateAll(tid uint64) error {
|
||||
var files []models.SystemFile
|
||||
qs := models.Orm.QueryTable(new(models.SystemFile)).Filter("delete_time__isnull", true)
|
||||
@@ -199,12 +188,10 @@ func (m *StorageMigration) MigrateAll(tid uint64) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetProgress 获取迁移进度
|
||||
func (m *StorageMigration) GetProgress() *MigrationProgress {
|
||||
return m.progress
|
||||
}
|
||||
|
||||
// MigrateLocalToQiniu 从本地存储迁移到七牛云
|
||||
func MigrateLocalToQiniu(tid uint64) (*MigrationProgress, error) {
|
||||
cfg, err := models.GetStorageConfig()
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user