From 7e77b6d585910747f400016a6f76f45fd17cc4cf Mon Sep 17 00:00:00 2001 From: daiyb <570956418@qq.com> Date: Tue, 3 Feb 2026 15:29:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=91=E5=B8=83=E6=9D=A5=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/cron/task.go | 4 +++- pkg/service/cast/test.go | 14 -------------- pkg/service/cast/work.go | 24 ++++++++++++++---------- 3 files changed, 17 insertions(+), 25 deletions(-) diff --git a/pkg/cron/task.go b/pkg/cron/task.go index b0bfbbe..4748cd4 100644 --- a/pkg/cron/task.go +++ b/pkg/cron/task.go @@ -238,6 +238,7 @@ func RefreshWorkAnalysisApprovalStatusTask() { } func ArtistAutoConfirmTask() { + //FIXME 再加一个定时确认 不完全依赖于队列 now := float64(time.Now().Unix()) opt := redis.ZRangeBy{ Min: fmt.Sprintf("%d", 0), @@ -386,7 +387,8 @@ func ScheduledPublishTask() { if len(publishBatch) > 0 { zap.L().Info("批量发布剩余作品", zap.Int("batch_size", len(publishBatch)), zap.Strings("work_uuids", publishBatch)) _ = serverCast.PublishWork(context.Background(), &cast.PublishReq{ - WorkUuids: publishBatch, + WorkUuids: publishBatch, + PublishSource: cast.PublishSourceENUM_RePublishType_SCHEDULED, }) zap.L().Info("剩余批次发布完成", zap.Int("published", len(publishBatch))) } diff --git a/pkg/service/cast/test.go b/pkg/service/cast/test.go index 1c5be1e..93b31f8 100644 --- a/pkg/service/cast/test.go +++ b/pkg/service/cast/test.go @@ -17,20 +17,6 @@ import ( func Test(ctx *gin.Context) { action := ctx.PostForm("action") if action == "" { - numKey := map[string]string{} - for _, v := range numKey { - resp, err := service.AyrshareProvider.UnlinkSocialNetwork(context.Background(), &aryshare.UnlinkSocialNetworkRequest{ - Platform: "bluesky", - ProfileKey: v, - }) - if err != nil { - service.Error(ctx, err) - return - } - fmt.Println(v) - fmt.Println(resp) - } - return } if action == "getPost" { diff --git a/pkg/service/cast/work.go b/pkg/service/cast/work.go index 97508af..58bf6d2 100644 --- a/pkg/service/cast/work.go +++ b/pkg/service/cast/work.go @@ -618,7 +618,7 @@ func PublishWork(ctx context.Context, req *cast.PublishReq) error { go func() { defer wg.Done() for workUuid := range jobs { - if err := PostAS(ctx, workUuid); err != nil { + if err := PostAS(ctx, workUuid, req.PublishSource); err != nil { errsMu.Lock() errs = append(errs, err) errsMu.Unlock() @@ -657,7 +657,7 @@ func PublishWork(ctx context.Context, req *cast.PublishReq) error { return nil } -func PostAS(ctx context.Context, workUuid string) error { +func PostAS(ctx context.Context, workUuid string, publishSource cast.PublishSourceENUM) error { var err error //检查封面 _ = CheckImage(workUuid) @@ -845,10 +845,11 @@ func PostAS(ctx context.Context, workUuid string) error { } if _err != nil { _, errS := service.CastProvider.UpdateWorkPublishLog(context.Background(), &cast.UpdateWorkPublishLogReq{ - WorkUuid: workUuid, - PlatformID: cast.PlatformIDENUM(platformID), - Action: "post", - Detail: _err.Error(), + WorkUuid: workUuid, + PlatformID: cast.PlatformIDENUM(platformID), + Action: "post", + Detail: _err.Error(), + PublishSource: publishSource, }) if errS != nil { zap.L().Error("PostAs UpdateWorkPublishLog err", zap.Error(errS), zap.Any("WorkUuid", workDetail.WorkUuid)) @@ -863,6 +864,7 @@ func PostAS(ctx context.Context, workUuid string) error { PublishMediaId: "", PublishMediaStatus: cast.PublishStatusENUM_PublishMediaStatus_EXCEPTION, Remark: "", + PublishSource: publishSource, }) zap.L().Info("UpdateWorkPlatformInfo", zap.Any("infoReq", infoReq)) _, errS = service.CastProvider.UpdateWorkPlatformInfo(context.Background(), infoReq) @@ -878,10 +880,11 @@ func PostAS(ctx context.Context, workUuid string) error { zap.L().Info("post 8", zap.Any("workUuid", workUuid), zap.Any("platformID", platformID)) postBytes, _ := json.Marshal(postResp) _, _ = service.CastProvider.UpdateWorkPublishLog(context.Background(), &cast.UpdateWorkPublishLogReq{ - PlatformID: cast.PlatformIDENUM(platformID), - WorkUuid: workUuid, - Action: "post", - Detail: string(postBytes), + PlatformID: cast.PlatformIDENUM(platformID), + WorkUuid: workUuid, + Action: "post", + Detail: string(postBytes), + PublishSource: publishSource, }) zap.L().Info("post 9", zap.Any("workUuid", workUuid), zap.Any("platformID", platformID)) zap.L().Info("PostAs", zap.Any("postResp", postResp), zap.Any("workDetail", workDetail)) @@ -925,6 +928,7 @@ func PostAS(ctx context.Context, workUuid string) error { PublishMediaId: postResp.Posts[0].Id, PublishMediaStatus: publishStatus, Remark: string(postData), + PublishSource: publishSource, }) } zap.L().Info("post 10", zap.Any("workUuid", workUuid), zap.Any("platformID", platformID))