Merge branch 'feat-cjy-newTwoPlatform'
# Conflicts: # api/cast/cast.pb.go # api/cast/cast.pb.validate.go # pkg/service/cast/media.go
This commit is contained in:
commit
a3817266a8
File diff suppressed because it is too large
Load Diff
BIN
data/图文导入模板.xlsx
BIN
data/图文导入模板.xlsx
Binary file not shown.
Binary file not shown.
@ -24,7 +24,7 @@ func (w *Work) ExportExcelWorkList(data []*cast.WorkListResp_Info) (*excelize.Fi
|
|||||||
|
|
||||||
// 表头
|
// 表头
|
||||||
headers := []interface{}{
|
headers := []interface{}{
|
||||||
"艺人", "手机号", "用户编号", "作品标题", "脚本", "作品类型", "类型", "Ins", "Tiktok", "DM", "作品状态", "验收确认类型",
|
"艺人", "手机号", "用户编号", "作品标题", "脚本", "作品类型", "类型", "Ins", "Tiktok", "DM", "Youtube", "Bulesky", "作品状态", "验收确认类型",
|
||||||
"说明", "发布账号", "管理人", "上传时间", "待艺人确认时间", "验收确认通过时间", "发布成功时间",
|
"说明", "发布账号", "管理人", "上传时间", "待艺人确认时间", "验收确认通过时间", "发布成功时间",
|
||||||
}
|
}
|
||||||
if err := sw.SetRow("A1", headers); err != nil {
|
if err := sw.SetRow("A1", headers); err != nil {
|
||||||
@ -72,6 +72,8 @@ func (w *Work) ExportExcelWorkList(data []*cast.WorkListResp_Info) (*excelize.Fi
|
|||||||
modelCast.PlatformPublishStatusMM[cast.PublishStatusENUM(info.InsStatus)],
|
modelCast.PlatformPublishStatusMM[cast.PublishStatusENUM(info.InsStatus)],
|
||||||
modelCast.PlatformPublishStatusMM[cast.PublishStatusENUM(info.TiktokStatus)],
|
modelCast.PlatformPublishStatusMM[cast.PublishStatusENUM(info.TiktokStatus)],
|
||||||
modelCast.PlatformPublishStatusMM[cast.PublishStatusENUM(info.DmStatus)],
|
modelCast.PlatformPublishStatusMM[cast.PublishStatusENUM(info.DmStatus)],
|
||||||
|
modelCast.PlatformPublishStatusMM[cast.PublishStatusENUM(info.YoutubeStatus)],
|
||||||
|
modelCast.PlatformPublishStatusMM[cast.PublishStatusENUM(info.BlueskyStatus)],
|
||||||
modelCast.WorkStatusMM[int(info.WorkStatus)],
|
modelCast.WorkStatusMM[int(info.WorkStatus)],
|
||||||
modelCast.ConfirmTypeMM[int(info.ConfirmType)],
|
modelCast.ConfirmTypeMM[int(info.ConfirmType)],
|
||||||
info.Remark,
|
info.Remark,
|
||||||
|
|||||||
@ -16,17 +16,16 @@ const (
|
|||||||
|
|
||||||
var PlatformNameKv = map[uint32]string{
|
var PlatformNameKv = map[uint32]string{
|
||||||
1: "tiktok",
|
1: "tiktok",
|
||||||
|
2: "youtube",
|
||||||
3: "instagram",
|
3: "instagram",
|
||||||
4: "DM",
|
4: "DM",
|
||||||
|
5: "bluesky",
|
||||||
}
|
}
|
||||||
|
|
||||||
var NamePlatformIDKv = map[string]uint32{
|
var NamePlatformIDKv = map[string]uint32{
|
||||||
"tiktok": 1,
|
"tiktok": 1,
|
||||||
|
"youtube": 2,
|
||||||
"instagram": 3,
|
"instagram": 3,
|
||||||
"DM": 4,
|
"DM": 4,
|
||||||
}
|
"bluesky": 5,
|
||||||
var PlatformIDStrKv = map[string]uint8{
|
|
||||||
"TIKTOK": 1,
|
|
||||||
"INS": 2,
|
|
||||||
"DM": 4,
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -612,7 +612,7 @@ func ImportMediaAccount(ctx *gin.Context) {
|
|||||||
excelSetRemark(excelData, line, "艺人不存在")
|
excelSetRemark(excelData, line, "艺人不存在")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
var tiktokName, insName, dmName string
|
var tiktokName, insName, dmName, youtubeName, blueskyName string
|
||||||
if len(row) >= 3 {
|
if len(row) >= 3 {
|
||||||
tiktokName = strings.TrimSpace(row[2])
|
tiktokName = strings.TrimSpace(row[2])
|
||||||
}
|
}
|
||||||
@ -622,7 +622,13 @@ func ImportMediaAccount(ctx *gin.Context) {
|
|||||||
if len(row) >= 5 {
|
if len(row) >= 5 {
|
||||||
dmName = strings.TrimSpace(row[4])
|
dmName = strings.TrimSpace(row[4])
|
||||||
}
|
}
|
||||||
if tiktokName == "" && insName == "" && dmName == "" {
|
if len(row) >= 6 {
|
||||||
|
youtubeName = strings.TrimSpace(row[5])
|
||||||
|
}
|
||||||
|
if len(row) >= 7 {
|
||||||
|
blueskyName = strings.TrimSpace(row[6])
|
||||||
|
}
|
||||||
|
if tiktokName == "" && insName == "" && dmName == "" && youtubeName == "" && blueskyName == "" {
|
||||||
excelSetRemark(excelData, line, "请填写账号")
|
excelSetRemark(excelData, line, "请填写账号")
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -641,6 +647,16 @@ func ImportMediaAccount(ctx *gin.Context) {
|
|||||||
excelSetRemark(excelData, line, fmt.Sprintf("%s:%s", dmName, err.Error()))
|
excelSetRemark(excelData, line, fmt.Sprintf("%s:%s", dmName, err.Error()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if youtubeName != "" {
|
||||||
|
if err = updateMediaAccount(youtubeName, cast.PlatformIDENUM_YOUTUBE, subInfoResp, loginInfo); err != nil {
|
||||||
|
excelSetRemark(excelData, line, fmt.Sprintf("%s:%s", youtubeName, err.Error()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if blueskyName != "" {
|
||||||
|
if err = updateMediaAccount(blueskyName, cast.PlatformIDENUM_BULESKY, subInfoResp, loginInfo); err != nil {
|
||||||
|
excelSetRemark(excelData, line, fmt.Sprintf("%s:%s", blueskyName, err.Error()))
|
||||||
|
}
|
||||||
|
}
|
||||||
_ = CheckAsProfile(subInfoResp)
|
_ = CheckAsProfile(subInfoResp)
|
||||||
}
|
}
|
||||||
// 保存Excel文件到磁盘
|
// 保存Excel文件到磁盘
|
||||||
@ -665,14 +681,14 @@ func ImportMediaAccount(ctx *gin.Context) {
|
|||||||
// 记录需要删除的行(从后往前删除,避免行号变化)
|
// 记录需要删除的行(从后往前删除,避免行号变化)
|
||||||
rowsToDelete := make([]int, 0)
|
rowsToDelete := make([]int, 0)
|
||||||
for line := 1; line < len(rows); line++ { // 从第2行开始(跳过表头)
|
for line := 1; line < len(rows); line++ { // 从第2行开始(跳过表头)
|
||||||
remarkCell := fmt.Sprintf("F%d", line+1)
|
remarkCell := fmt.Sprintf("H%d", line+1) // 备注列已移动到H列
|
||||||
remark, _ := excelData.GetCellValue("Sheet1", remarkCell)
|
remark, _ := excelData.GetCellValue("Sheet1", remarkCell)
|
||||||
if remark == "" {
|
if remark == "" {
|
||||||
// F列没有数据,表示成功
|
// H列没有数据,表示成功
|
||||||
successCount++
|
successCount++
|
||||||
rowsToDelete = append(rowsToDelete, line+1)
|
rowsToDelete = append(rowsToDelete, line+1)
|
||||||
} else {
|
} else {
|
||||||
// F列有值,表示失败
|
// H列有值,表示失败
|
||||||
failCount++
|
failCount++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -705,11 +721,11 @@ func ImportMediaAccount(ctx *gin.Context) {
|
|||||||
|
|
||||||
func excelSetRemark(excelData *excelize.File, line int, remark string) {
|
func excelSetRemark(excelData *excelize.File, line int, remark string) {
|
||||||
zap.L().Info("设置备注", zap.Int("line", line), zap.String("remark", remark))
|
zap.L().Info("设置备注", zap.Int("line", line), zap.String("remark", remark))
|
||||||
oldRemark, _ := excelData.GetCellValue("Sheet1", fmt.Sprintf("%s%d", "F", line+1))
|
oldRemark, _ := excelData.GetCellValue("Sheet1", fmt.Sprintf("%s%d", "H", line+1))
|
||||||
if oldRemark != "" {
|
if oldRemark != "" {
|
||||||
remark = fmt.Sprintf("%s\n;%s", oldRemark, remark)
|
remark = fmt.Sprintf("%s\n;%s", oldRemark, remark)
|
||||||
}
|
}
|
||||||
excelData.SetCellValue("Sheet1", fmt.Sprintf("%s%d", "F", line+1), remark)
|
excelData.SetCellValue("Sheet1", fmt.Sprintf("%s%d", "H", line+1), remark)
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateMediaAccount(platformName string, platformId cast.PlatformIDENUM, subInfoResp *accountFiee.UserInfoResponse, loginInfo login.Info) error {
|
func updateMediaAccount(platformName string, platformId cast.PlatformIDENUM, subInfoResp *accountFiee.UserInfoResponse, loginInfo login.Info) error {
|
||||||
|
|||||||
@ -623,6 +623,29 @@ func PostAS(workUuid string) error {
|
|||||||
ThumbNail: "",
|
ThumbNail: "",
|
||||||
Visibility: "",
|
Visibility: "",
|
||||||
}
|
}
|
||||||
|
case cast.PlatformIDENUM_YOUTUBE:
|
||||||
|
// YouTube 发布选项配置
|
||||||
|
postReq.YouTubeOptions = &aryshare.YouTubeOptions{
|
||||||
|
Title: workDetail.Title,
|
||||||
|
Visibility: "public", // 可见性设置:public/unlisted/private
|
||||||
|
Tags: nil,
|
||||||
|
// CategoryId: 0, // YouTube 分类 ID(例如:24 = Entertainment)
|
||||||
|
MadeForKids: false,
|
||||||
|
ThumbNail: coverUrl,
|
||||||
|
PlaylistId: "",
|
||||||
|
NotifySubscribers: true,
|
||||||
|
Shorts: false,
|
||||||
|
ContainsSyntheticMedia: false,
|
||||||
|
PublishAt: "",
|
||||||
|
SubTitleUrl: "",
|
||||||
|
SubTitleLanguage: "",
|
||||||
|
SubTitleName: "",
|
||||||
|
}
|
||||||
|
case cast.PlatformIDENUM_BULESKY: // BLUESKY
|
||||||
|
// Bluesky 发布选项配置
|
||||||
|
postReq.BlueskyOptions = &aryshare.BlueskyOptions{
|
||||||
|
AltText: nil, // 图片或视频的替代文本数组(用于屏幕阅读器的无障碍功能)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
zap.L().Info("post 6", zap.Any("workUuid", workUuid), zap.Any("platformID", platformID))
|
zap.L().Info("post 6", zap.Any("workUuid", workUuid), zap.Any("platformID", platformID))
|
||||||
zap.L().Info("Publish Ayrshare PostReq", zap.Any("workUuid", workDetail.WorkUuid), zap.Any("postReq", postReq), zap.Any("workDetail", workDetail))
|
zap.L().Info("Publish Ayrshare PostReq", zap.Any("workUuid", workDetail.WorkUuid), zap.Any("postReq", postReq), zap.Any("workDetail", workDetail))
|
||||||
@ -704,6 +727,10 @@ func PostAS(workUuid string) error {
|
|||||||
pid = 1
|
pid = 1
|
||||||
case "instagram":
|
case "instagram":
|
||||||
pid = 3
|
pid = 3
|
||||||
|
case "youtube":
|
||||||
|
pid = 2
|
||||||
|
case "bluesky":
|
||||||
|
pid = 5
|
||||||
}
|
}
|
||||||
publishStatus := cast.PublishStatusENUM_PublishMediaStatus_NO
|
publishStatus := cast.PublishStatusENUM_PublishMediaStatus_NO
|
||||||
if postInfo.Status == "success" {
|
if postInfo.Status == "success" {
|
||||||
@ -1284,8 +1311,8 @@ func ImportWorkBatch(ctx *gin.Context) {
|
|||||||
temp.ArtistPhone = subInfoResp.TelNum
|
temp.ArtistPhone = subInfoResp.TelNum
|
||||||
temp.ArtistPhoneAreaCode = subInfoResp.TelAreaCode
|
temp.ArtistPhoneAreaCode = subInfoResp.TelAreaCode
|
||||||
}
|
}
|
||||||
if len(row) > 5 {
|
if len(row) > 7 {
|
||||||
temp.Title = utils.CleanString(row[5])
|
temp.Title = utils.CleanString(row[7])
|
||||||
ok, _err := check.SecurityText(temp.Title)
|
ok, _err := check.SecurityText(temp.Title)
|
||||||
if _err != nil {
|
if _err != nil {
|
||||||
temp.Remark = _err.Error()
|
temp.Remark = _err.Error()
|
||||||
@ -1298,8 +1325,8 @@ func ImportWorkBatch(ctx *gin.Context) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(row) > 6 {
|
if len(row) > 8 {
|
||||||
temp.Content = utils.CleanString(row[6])
|
temp.Content = utils.CleanString(row[8])
|
||||||
if temp.Content != "" {
|
if temp.Content != "" {
|
||||||
ok, _err := check.SecurityText(temp.Content)
|
ok, _err := check.SecurityText(temp.Content)
|
||||||
if _err != nil {
|
if _err != nil {
|
||||||
@ -1314,8 +1341,7 @@ func ImportWorkBatch(ctx *gin.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 图片
|
for i := 10; i <= 20; i++ {
|
||||||
for i := 8; i <= 18; i++ {
|
|
||||||
if len(row) > i {
|
if len(row) > i {
|
||||||
if utils.CleanString(row[i]) != "" {
|
if utils.CleanString(row[i]) != "" {
|
||||||
ok, _err := check.SecurityFile(row[i])
|
ok, _err := check.SecurityFile(row[i])
|
||||||
@ -1325,7 +1351,7 @@ func ImportWorkBatch(ctx *gin.Context) {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
if !ok {
|
if !ok {
|
||||||
temp.Remark = fmt.Sprintf("图片%d黄反审核未通过", i-7)
|
temp.Remark = fmt.Sprintf("图片%d黄反审核未通过", i-9)
|
||||||
req.ImageWorks = append(req.ImageWorks, temp)
|
req.ImageWorks = append(req.ImageWorks, temp)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -1416,6 +1442,60 @@ func ImportWorkBatch(ctx *gin.Context) {
|
|||||||
temp.MediaAccountNames = append(temp.MediaAccountNames, utils.CleanString(row[4]))
|
temp.MediaAccountNames = append(temp.MediaAccountNames, utils.CleanString(row[4]))
|
||||||
temp.MediaAccountUuids = append(temp.MediaAccountUuids, mediaInfoResp.Info.MediaAccountUuid)*/
|
temp.MediaAccountUuids = append(temp.MediaAccountUuids, mediaInfoResp.Info.MediaAccountUuid)*/
|
||||||
}
|
}
|
||||||
|
// YouTube账号(第F列,row[5])
|
||||||
|
if len(row) > 5 && utils.CleanString(row[5]) != "" {
|
||||||
|
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]) != "" {
|
||||||
|
mediaInfoResp, err = service.CastProvider.MediaInfo(context.Background(), &cast.MediaInfoReq{
|
||||||
|
ArtistUuid: temp.ArtistUuid,
|
||||||
|
PlatformID: cast.PlatformIDENUM_BULESKY,
|
||||||
|
PlatformUserName: utils.CleanString(row[6]),
|
||||||
|
})
|
||||||
|
if err != nil || mediaInfoResp.Info.MediaAccountUuid == "" {
|
||||||
|
temp.Remark = fmt.Sprintf("Bluesky账号名不存在")
|
||||||
|
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_BULESKY)
|
||||||
|
temp.MediaAccountNames = append(temp.MediaAccountNames, utils.CleanString(row[6]))
|
||||||
|
temp.MediaAccountUuids = append(temp.MediaAccountUuids, mediaInfoResp.Info.MediaAccountUuid)
|
||||||
|
}
|
||||||
if artistNum == "" {
|
if artistNum == "" {
|
||||||
temp.Remark = "艺人编号不能为空"
|
temp.Remark = "艺人编号不能为空"
|
||||||
req.ImageWorks = append(req.ImageWorks, temp)
|
req.ImageWorks = append(req.ImageWorks, temp)
|
||||||
@ -1446,6 +1526,12 @@ func ImportWorkBatch(ctx *gin.Context) {
|
|||||||
req.ImageWorks = append(req.ImageWorks, temp)
|
req.ImageWorks = append(req.ImageWorks, temp)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
// 判断图片数量是否超过4
|
||||||
|
if len(temp.Images) > 4 {
|
||||||
|
temp.Remark = "Bluesky 图片数量不能超过4"
|
||||||
|
req.ImageWorks = append(req.ImageWorks, temp)
|
||||||
|
continue
|
||||||
|
}
|
||||||
req.ImageWorks = append(req.ImageWorks, temp)
|
req.ImageWorks = append(req.ImageWorks, temp)
|
||||||
}
|
}
|
||||||
if len(req.ImageWorks) == 0 {
|
if len(req.ImageWorks) == 0 {
|
||||||
@ -1464,7 +1550,7 @@ func ImportWorkBatch(ctx *gin.Context) {
|
|||||||
for _, v := range resp.ImageWorks {
|
for _, v := range resp.ImageWorks {
|
||||||
if !v.Success {
|
if !v.Success {
|
||||||
rowNum := int(v.LineNo) + 1
|
rowNum := int(v.LineNo) + 1
|
||||||
excelData.SetCellValue("Sheet1", fmt.Sprintf("H%d", rowNum), v.Remark)
|
excelData.SetCellValue("Sheet1", fmt.Sprintf("J%d", rowNum), v.Remark)
|
||||||
hasValueRows[rowNum] = true
|
hasValueRows[rowNum] = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user