30 lines
754 B
Go
30 lines
754 B
Go
// 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
|
||
}
|