Merge branch 'dev' of https://gitea-net.fontree.cn/fiee/fonchain-fiee into dev
This commit is contained in:
commit
8169a3ece8
@ -1447,28 +1447,32 @@ func ImportWorkBatch(ctx *gin.Context) {
|
||||
}
|
||||
// YouTube账号(第F列,row[5])
|
||||
if len(row) > 5 && utils.CleanString(row[5]) != "" {
|
||||
mediaInfoResp, err = service.CastProvider.MediaInfo(context.Background(), &cast.MediaInfoReq{
|
||||
ArtistUuid: temp.ArtistUuid,
|
||||
PlatformID: cast.PlatformIDENUM_YOUTUBE,
|
||||
PlatformUserName: utils.CleanString(row[5]),
|
||||
})
|
||||
if err != nil || mediaInfoResp.Info.MediaAccountUuid == "" {
|
||||
temp.Remark = fmt.Sprintf("YouTube账号名不存在")
|
||||
zap.L().Error("CastProvider.MediaInfo", zap.Error(err))
|
||||
req.ImageWorks = append(req.ImageWorks, temp)
|
||||
continue
|
||||
}
|
||||
temp.PublishConfig1 = &cast.PublishConfig{
|
||||
ForbidComment: 1,
|
||||
PublicType: 1,
|
||||
CanJoin: 1,
|
||||
CanQuote: 1,
|
||||
CanComment: 1,
|
||||
IsAI: 1,
|
||||
}
|
||||
temp.PlatformIDs = append(temp.PlatformIDs, cast.PlatformIDENUM_YOUTUBE)
|
||||
temp.MediaAccountNames = append(temp.MediaAccountNames, utils.CleanString(row[5]))
|
||||
temp.MediaAccountUuids = append(temp.MediaAccountUuids, mediaInfoResp.Info.MediaAccountUuid)
|
||||
temp.Remark = fmt.Sprintf("Youtube不能发图文")
|
||||
zap.L().Error("CastProvider.MediaInfo", zap.Error(err))
|
||||
req.ImageWorks = append(req.ImageWorks, temp)
|
||||
continue
|
||||
// mediaInfoResp, err = service.CastProvider.MediaInfo(context.Background(), &cast.MediaInfoReq{
|
||||
// ArtistUuid: temp.ArtistUuid,
|
||||
// PlatformID: cast.PlatformIDENUM_YOUTUBE,
|
||||
// PlatformUserName: utils.CleanString(row[5]),
|
||||
// })
|
||||
// if err != nil || mediaInfoResp.Info.MediaAccountUuid == "" {
|
||||
// temp.Remark = fmt.Sprintf("YouTube账号名不存在")
|
||||
// zap.L().Error("CastProvider.MediaInfo", zap.Error(err))
|
||||
// req.ImageWorks = append(req.ImageWorks, temp)
|
||||
// continue
|
||||
// }
|
||||
// temp.PublishConfig1 = &cast.PublishConfig{
|
||||
// ForbidComment: 1,
|
||||
// PublicType: 1,
|
||||
// CanJoin: 1,
|
||||
// CanQuote: 1,
|
||||
// CanComment: 1,
|
||||
// IsAI: 1,
|
||||
// }
|
||||
// temp.PlatformIDs = append(temp.PlatformIDs, cast.PlatformIDENUM_YOUTUBE)
|
||||
// temp.MediaAccountNames = append(temp.MediaAccountNames, utils.CleanString(row[5]))
|
||||
// temp.MediaAccountUuids = append(temp.MediaAccountUuids, mediaInfoResp.Info.MediaAccountUuid)
|
||||
}
|
||||
// Bluesky账号(第G列,row[6])
|
||||
if len(row) > 6 && utils.CleanString(row[6]) != "" {
|
||||
@ -1525,6 +1529,12 @@ func ImportWorkBatch(ctx *gin.Context) {
|
||||
req.ImageWorks = append(req.ImageWorks, temp)
|
||||
continue
|
||||
}
|
||||
// 判断图片数量是否超过4
|
||||
if len(temp.Images) > 4 {
|
||||
temp.Remark = "Bluesky 图片数量不能超过4"
|
||||
req.ImageWorks = append(req.ImageWorks, temp)
|
||||
continue
|
||||
}
|
||||
req.ImageWorks = append(req.ImageWorks, temp)
|
||||
}
|
||||
if len(req.ImageWorks) == 0 {
|
||||
|
||||
@ -118,6 +118,17 @@ func ExportExcelExecutionResult(c *gin.Context) {
|
||||
service.Error(c, errors.New("网络超时,请重试"))
|
||||
return
|
||||
}
|
||||
userListRes, err := service.AccountFieeProvider.UserList(context.Background(), &account.UserListRequest{
|
||||
Domain: "app",
|
||||
})
|
||||
if err != nil {
|
||||
service.Error(c, errors.New("用户查询失败"))
|
||||
return
|
||||
}
|
||||
idFindSubName := make(map[uint64]string)
|
||||
for _, v := range userListRes.UserList {
|
||||
idFindSubName[v.Id] = v.SubNum
|
||||
}
|
||||
|
||||
titleList := []string{
|
||||
"任务标题", "艺人编号", "艺人姓名", "内容类型", "内容标题", "执行结果", "原因",
|
||||
@ -126,7 +137,7 @@ func ExportExcelExecutionResult(c *gin.Context) {
|
||||
for _, task := range res.Data {
|
||||
data := []interface{}{
|
||||
task.TaskTitle,
|
||||
task.ArtistId,
|
||||
idFindSubName[uint64(task.ArtistId)],
|
||||
task.ArtistName,
|
||||
task.ContentTypeDescription,
|
||||
task.WorkTitle,
|
||||
@ -347,7 +358,7 @@ func readExcel(excelPath string) ([]excelData, error) {
|
||||
subName := getCellValue(f, sheetName, i, 0)
|
||||
name := getCellValue(f, sheetName, i, 1)
|
||||
data := excelData{
|
||||
Line: uint(i),
|
||||
Line: uint(i + 1),
|
||||
SubName: subName,
|
||||
Name: name,
|
||||
}
|
||||
|
||||
@ -107,8 +107,8 @@ func Delete(ctx *gin.Context) {
|
||||
nowYear := time.Now().Year()
|
||||
nowMonth := time.Now().Month()
|
||||
nowYearPath := fmt.Sprintf("/fiee/video/%d", nowYear)
|
||||
nowMonthPath := fmt.Sprintf("/fiee/video/%d/%d", nowYear, nowMonth)
|
||||
if path == nowYearPath || path == nowMonthPath || path == "/fiee" || path == "/fiee/video" {
|
||||
nowMonthPath := fmt.Sprintf("/fiee/video/%d/%d-%d", nowYear, nowYear, nowMonth)
|
||||
if path == nowYearPath || path == nowMonthPath || path == "/fiee" || path == "/fiee/video" || path == "/fiee/video/old" {
|
||||
service.Error(ctx, errors.New("无法删除该目录"))
|
||||
return
|
||||
}
|
||||
|
||||
@ -1,6 +1,9 @@
|
||||
package utils
|
||||
|
||||
import "strings"
|
||||
import (
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// CleanString 移除所有空白字符
|
||||
func CleanString(s string) string {
|
||||
@ -18,3 +21,23 @@ func TruncateString(s string, maxLen int) string {
|
||||
}
|
||||
return string(runes[:maxLen])
|
||||
}
|
||||
|
||||
// ExtractTags 从文本中提取标签,标签以 # 开头,后面不能直接跟空格
|
||||
func ExtractTags(s string) []string {
|
||||
if len(s) == 0 {
|
||||
return []string{}
|
||||
}
|
||||
re := regexp.MustCompile(`#[^\s#\p{P}]+`)
|
||||
matches := re.FindAllString(s, -1)
|
||||
|
||||
tags := make([]string, 0, len(matches))
|
||||
for _, match := range matches {
|
||||
// 去掉开头的 #,只保留标签内容
|
||||
tag := match[1:]
|
||||
if len(tag) > 0 {
|
||||
tags = append(tags, tag)
|
||||
}
|
||||
}
|
||||
|
||||
return tags
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user