修改任务名称
This commit is contained in:
parent
3c57d024d0
commit
cecf48c37c
@ -418,7 +418,7 @@ func TaskStatus() {
|
|||||||
}
|
}
|
||||||
var excelUrl string
|
var excelUrl string
|
||||||
if allDone {
|
if allDone {
|
||||||
excelUrl, err = serverCast.PublishTaskExcel(extraData.WorkUuids, true)
|
excelUrl, err = serverCast.PublishTaskExcel(extraData.WorkUuids, true, v.Action)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
zap.L().Error("生成发布任务Excel失败", zap.Error(err))
|
zap.L().Error("生成发布任务Excel失败", zap.Error(err))
|
||||||
continue
|
continue
|
||||||
|
|||||||
@ -5,3 +5,9 @@ type PublishTaskDto struct {
|
|||||||
MediaAccountUuids []string
|
MediaAccountUuids []string
|
||||||
PlatformIds []string
|
PlatformIds []string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var TaskActionName = map[string]string{
|
||||||
|
"importWorkBatch": "批量导入图文",
|
||||||
|
"publishBatch1": "批量发布",
|
||||||
|
"publishBatch2": "多账号同步",
|
||||||
|
}
|
||||||
|
|||||||
@ -76,7 +76,7 @@ func DownloadTaskFile(ctx *gin.Context) {
|
|||||||
if resp.Data.ExtraData != "" {
|
if resp.Data.ExtraData != "" {
|
||||||
_ = json.Unmarshal([]byte(resp.Data.ExtraData), &taskInfo)
|
_ = json.Unmarshal([]byte(resp.Data.ExtraData), &taskInfo)
|
||||||
}
|
}
|
||||||
exportUrl, err := PublishTaskExcel(taskInfo.WorkUuids, false)
|
exportUrl, err := PublishTaskExcel(taskInfo.WorkUuids, false, resp.Data.Action)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
service.Error(ctx, err)
|
service.Error(ctx, err)
|
||||||
return
|
return
|
||||||
@ -86,7 +86,7 @@ func DownloadTaskFile(ctx *gin.Context) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func PublishTaskExcel(workUuids []string, uploadOss bool) (string, error) {
|
func PublishTaskExcel(workUuids []string, uploadOss bool, action string) (string, error) {
|
||||||
// 创建Excel文件
|
// 创建Excel文件
|
||||||
f := excelize.NewFile()
|
f := excelize.NewFile()
|
||||||
sheetName := "Sheet1"
|
sheetName := "Sheet1"
|
||||||
@ -178,7 +178,11 @@ func PublishTaskExcel(workUuids []string, uploadOss bool) (string, error) {
|
|||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
filename := fmt.Sprintf("任务_%s.xlsx", time.Now().Format("20060102150405"))
|
TaskActionName, ok := modelCast.TaskActionName[action]
|
||||||
|
if !ok {
|
||||||
|
TaskActionName = "未知任务"
|
||||||
|
}
|
||||||
|
filename := fmt.Sprintf("%s_%s.xlsx", TaskActionName, time.Now().Format("20060102150405"))
|
||||||
filePath := tempDir + "/" + filename
|
filePath := tempDir + "/" + filename
|
||||||
var exportUrl string = fmt.Sprintf("%s/api/fiee/static/%s", config.AppConfig.System.FieeHost, strings.Replace(filePath, "./runtime/", "", 1))
|
var exportUrl string = fmt.Sprintf("%s/api/fiee/static/%s", config.AppConfig.System.FieeHost, strings.Replace(filePath, "./runtime/", "", 1))
|
||||||
if err = f.SaveAs(filePath); err != nil {
|
if err = f.SaveAs(filePath); err != nil {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user