feat(desktop): drop parked review flow, add publish management

SaaS 侧人工审核后才创建 publish job,desktop 不再做二次审核:移除
manual/waiting_user/parked/from_parked 状态机与 LeaseFromParked 查询,
desktop client 只执行发布并新增"发布管理"页(待发布队列 / 历史 / 再次
发送)。同时抽离 @geo/publisher-platforms 共享适配器包、新增 Redis-based
desktop_presence 与 publish_record_support,刷新 admin-web 发布弹窗与
媒体库;plan A / spec 文档同步口径。
This commit is contained in:
2026-04-20 09:52:48 +08:00
parent b16e9f0bd1
commit a617d39a4a
93 changed files with 5519 additions and 3594 deletions
@@ -46,7 +46,6 @@ type DesktopTask struct {
ActiveAttemptID *uuid.UUID
LeaseExpiresAt *time.Time
Attempts int
ParkedReason *string
Result []byte
Error []byte
CreatedAt time.Time
@@ -65,7 +64,6 @@ type CreateDesktopTaskParams struct {
Payload []byte
Status string
DedupKey *string
ParkedReason *string
}
type DesktopTaskLeaseParams struct {
@@ -104,9 +102,7 @@ type DesktopTaskRepository interface {
GetByDesktopID(ctx context.Context, desktopID uuid.UUID, workspaceID int64) (*DesktopTask, error)
LeaseNextQueued(ctx context.Context, clientID uuid.UUID, kind *string, params DesktopTaskLeaseParams) (*DesktopTask, error)
LeaseQueuedByDesktopID(ctx context.Context, desktopID, clientID uuid.UUID, params DesktopTaskLeaseParams) (*DesktopTask, error)
LeaseParked(ctx context.Context, desktopID, clientID uuid.UUID, params DesktopTaskLeaseParams) (*DesktopTask, error)
ExtendLease(ctx context.Context, desktopID uuid.UUID, leaseTokenHash []byte) (*DesktopTask, error)
Park(ctx context.Context, desktopID uuid.UUID, leaseTokenHash []byte, parkedReason string) (*DesktopTask, error)
Complete(ctx context.Context, desktopID uuid.UUID, leaseTokenHash []byte, status string, resultJSON, errorJSON []byte) (*DesktopTask, error)
CancelByLease(ctx context.Context, desktopID uuid.UUID, leaseTokenHash []byte, errorJSON []byte) (*DesktopTask, error)
CancelByClient(ctx context.Context, desktopID, clientID uuid.UUID, errorJSON []byte) (*DesktopTask, error)
@@ -154,7 +150,6 @@ func (r *desktopTaskRepository) CreateTask(ctx context.Context, params CreateDes
Payload: params.Payload,
Status: params.Status,
DedupKey: pgText(params.DedupKey),
ParkedReason: pgText(params.ParkedReason),
})
if err != nil {
return nil, err
@@ -199,19 +194,6 @@ func (r *desktopTaskRepository) LeaseQueuedByDesktopID(ctx context.Context, desk
return desktopTaskFromGenerated(row), nil
}
func (r *desktopTaskRepository) LeaseParked(ctx context.Context, desktopID, clientID uuid.UUID, params DesktopTaskLeaseParams) (*DesktopTask, error) {
row, err := r.q.LeaseParkedDesktopTask(ctx, generated.LeaseParkedDesktopTaskParams{
AttemptID: pgUUID(params.AttemptID),
LeaseTokenHash: params.LeaseTokenHash,
DesktopID: pgUUID(desktopID),
ClientID: pgUUID(clientID),
})
if err != nil {
return nil, err
}
return desktopTaskFromGenerated(row), nil
}
func (r *desktopTaskRepository) ExtendLease(ctx context.Context, desktopID uuid.UUID, leaseTokenHash []byte) (*DesktopTask, error) {
row, err := r.q.ExtendDesktopTaskLease(ctx, generated.ExtendDesktopTaskLeaseParams{
DesktopID: pgUUID(desktopID),
@@ -223,18 +205,6 @@ func (r *desktopTaskRepository) ExtendLease(ctx context.Context, desktopID uuid.
return desktopTaskFromGenerated(row), nil
}
func (r *desktopTaskRepository) Park(ctx context.Context, desktopID uuid.UUID, leaseTokenHash []byte, parkedReason string) (*DesktopTask, error) {
row, err := r.q.ParkDesktopTask(ctx, generated.ParkDesktopTaskParams{
ParkedReason: pgText(&parkedReason),
DesktopID: pgUUID(desktopID),
LeaseTokenHash: leaseTokenHash,
})
if err != nil {
return nil, err
}
return desktopTaskFromGenerated(row), nil
}
func (r *desktopTaskRepository) Complete(ctx context.Context, desktopID uuid.UUID, leaseTokenHash []byte, status string, resultJSON, errorJSON []byte) (*DesktopTask, error) {
row, err := r.q.CompleteDesktopTask(ctx, generated.CompleteDesktopTaskParams{
Status: status,
@@ -359,7 +329,6 @@ func desktopTaskFromGenerated(row generated.DesktopTask) *DesktopTask {
ActiveAttemptID: nullableUUID(row.ActiveAttemptID),
LeaseExpiresAt: optionalTime(row.LeaseExpiresAt),
Attempts: int(row.Attempts),
ParkedReason: nullableText(row.ParkedReason),
Result: row.Result,
Error: row.Error,
CreatedAt: timeFromTimestamp(row.CreatedAt),