发布来源

This commit is contained in:
戴育兵 2026-02-03 15:29:36 +08:00
parent 7f0d61b229
commit 7e77b6d585
3 changed files with 17 additions and 25 deletions

View File

@ -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)))
}

View File

@ -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" {

View File

@ -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))