Files
customer-server/controller/archive_controller.go
2026-03-14 10:02:49 +08:00

30 lines
754 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// Package controller - 归档控制器
// 功能手动触发对话记录从MongoDB归档到Elasticsearch
package controller
import (
"context"
"customer-server/model/dto"
"customer-server/service"
)
var Archive = new(archive)
type archive struct{}
// RunNow 手动触发归档
// 参数: req - 归档请求(可选参数)
// 返回: res - 归档执行结果信息
// 功能: 手动触发月度归档任务将MongoDB对话记录迁移到Elasticsearch
// 路由: POST /archive/run
func (c *archive) RunNow(ctx context.Context, req *dto.ArchiveRunReq) (res *dto.ArchiveRunRes, err error) {
err = service.ArchiveService.RunNow(ctx)
if err != nil {
return
}
res = &dto.ArchiveRunRes{
Message: "归档任务执行完成",
}
return
}