diff --git a/data/图文导入模板_old.xlsx b/data/图文导入模板_old.xlsx new file mode 100644 index 0000000..bc9c965 Binary files /dev/null and b/data/图文导入模板_old.xlsx differ diff --git a/pkg/service/cast/work.go b/pkg/service/cast/work.go index f1487ec..0378cc4 100644 --- a/pkg/service/cast/work.go +++ b/pkg/service/cast/work.go @@ -1035,14 +1035,14 @@ func ImportWorkBatch(ctx *gin.Context) { temp.ArtistPhone = subInfoResp.TelNum temp.ArtistPhoneAreaCode = subInfoResp.TelAreaCode } - if len(row) > 5 { - temp.Title = utils.CleanString(row[5]) + + if len(row) > 7 { + temp.Title = utils.CleanString(row[7]) } - if len(row) > 6 { - temp.Content = utils.CleanString(row[6]) + if len(row) > 8 { + temp.Content = utils.CleanString(row[8]) } - // 图片 - for i := 8; i <= 18; i++ { + for i := 10; i <= 20; i++ { if len(row) > i { if utils.CleanString(row[i]) != "" { ok, _err := check.ImageCheckUrlValid(row[i]) @@ -1052,7 +1052,7 @@ func ImportWorkBatch(ctx *gin.Context) { break } if !ok { - temp.Remark = fmt.Sprintf("图片%d黄反审核未通过", i-7) + temp.Remark = fmt.Sprintf("图片%d黄反审核未通过", i-9) req.ImageWorks = append(req.ImageWorks, temp) break } @@ -1143,6 +1143,56 @@ func ImportWorkBatch(ctx *gin.Context) { temp.MediaAccountNames = append(temp.MediaAccountNames, utils.CleanString(row[4])) temp.MediaAccountUuids = append(temp.MediaAccountUuids, mediaInfoResp.Info.MediaAccountUuid)*/ } + // 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) + } + // 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 == "" { temp.Remark = "艺人编号不能为空" req.ImageWorks = append(req.ImageWorks, temp) @@ -1192,7 +1242,7 @@ func ImportWorkBatch(ctx *gin.Context) { for _, v := range resp.ImageWorks { if !v.Success { 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 } }