diff --git a/pkg/service/import/imageContentProcessor.go b/pkg/service/import/imageContentProcessor.go index d71c558..cda691d 100644 --- a/pkg/service/import/imageContentProcessor.go +++ b/pkg/service/import/imageContentProcessor.go @@ -297,35 +297,36 @@ func (p *BatchProcessor) submitTask(req *excelData) error { if !tiktokFound { return fmt.Errorf("未找到匹配的TikTok账号: %s", req.TikTok) } - - // 获取 Instagram 自媒体账号 - accountListIns, err := service.CastProvider.MediaUserList(context.Background(), &apiCast.MediaUserListReq{ - ArtistVal: req.ArtistName, - PlatformID: 3, - Page: 1, - PageSize: 10, - ArtistUuid: strconv.FormatUint(list.UserList[0].Id, 10), - }) - if err != nil { - return fmt.Errorf("获取 Instagram 账号失败: %s", err.Error()) - } - if accountListIns == nil || len(accountListIns.Data) == 0 { - return fmt.Errorf("ins自媒体账号数量为0") - } - // 查找 Instagram 账号 - insFound := false - for _, user := range accountListIns.Data { - if user.PlatformUserName == req.Instagram { - req.MediaAccountNames = append(req.MediaAccountNames, user.PlatformUserName) - req.MediaAccountUuids = append(req.MediaAccountUuids, user.MediaAccountUuid) - insFound = true - break + if req.Instagram != "" { + // 获取 Instagram 自媒体账号 + accountListIns, err := service.CastProvider.MediaUserList(context.Background(), &apiCast.MediaUserListReq{ + ArtistVal: req.ArtistName, + PlatformID: 3, + Page: 1, + PageSize: 10, + ArtistUuid: strconv.FormatUint(list.UserList[0].Id, 10), + }) + if err != nil { + return fmt.Errorf("获取 Instagram 账号失败: %s", err.Error()) + } + if accountListIns == nil || len(accountListIns.Data) == 0 { + return fmt.Errorf("ins自媒体账号数量为0") + } + // 查找 Instagram 账号 + insFound := false + for _, user := range accountListIns.Data { + if user.PlatformUserName == req.Instagram { + req.MediaAccountNames = append(req.MediaAccountNames, user.PlatformUserName) + req.MediaAccountUuids = append(req.MediaAccountUuids, user.MediaAccountUuid) + insFound = true + break + } + } + if !insFound { + return fmt.Errorf("未找到匹配的Instagram账号: %s", req.Instagram) } - } - if !insFound { - return fmt.Errorf("未找到匹配的Instagram账号: %s", req.Instagram) - } + } // 获取 Bluesky 自媒体账号 accountListBlueSky, err := service.CastProvider.MediaUserList(context.Background(), &apiCast.MediaUserListReq{ ArtistVal: req.ArtistName,