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
@@ -29,6 +29,7 @@ RETURNING
platform_uid,
account_fingerprint,
display_name,
avatar_url,
health,
verified_at,
tags,
@@ -54,6 +55,7 @@ type ClearDesktopAccountDeleteRequestedRow struct {
PlatformUid string `json:"platform_uid"`
AccountFingerprint pgtype.Text `json:"account_fingerprint"`
DisplayName string `json:"display_name"`
AvatarUrl pgtype.Text `json:"avatar_url"`
Health string `json:"health"`
VerifiedAt pgtype.Timestamptz `json:"verified_at"`
Tags []byte `json:"tags"`
@@ -77,6 +79,7 @@ func (q *Queries) ClearDesktopAccountDeleteRequested(ctx context.Context, arg Cl
&i.PlatformUid,
&i.AccountFingerprint,
&i.DisplayName,
&i.AvatarUrl,
&i.Health,
&i.VerifiedAt,
&i.Tags,
@@ -100,6 +103,7 @@ SELECT
platform_uid,
account_fingerprint,
display_name,
avatar_url,
health,
verified_at,
tags,
@@ -129,6 +133,7 @@ type GetDesktopAccountByDesktopIDRow struct {
PlatformUid string `json:"platform_uid"`
AccountFingerprint pgtype.Text `json:"account_fingerprint"`
DisplayName string `json:"display_name"`
AvatarUrl pgtype.Text `json:"avatar_url"`
Health string `json:"health"`
VerifiedAt pgtype.Timestamptz `json:"verified_at"`
Tags []byte `json:"tags"`
@@ -152,6 +157,7 @@ func (q *Queries) GetDesktopAccountByDesktopID(ctx context.Context, arg GetDeskt
&i.PlatformUid,
&i.AccountFingerprint,
&i.DisplayName,
&i.AvatarUrl,
&i.Health,
&i.VerifiedAt,
&i.Tags,
@@ -175,6 +181,7 @@ SELECT
platform_uid,
account_fingerprint,
display_name,
avatar_url,
health,
verified_at,
tags,
@@ -207,6 +214,7 @@ type GetDesktopAccountByIdentityRow struct {
PlatformUid string `json:"platform_uid"`
AccountFingerprint pgtype.Text `json:"account_fingerprint"`
DisplayName string `json:"display_name"`
AvatarUrl pgtype.Text `json:"avatar_url"`
Health string `json:"health"`
VerifiedAt pgtype.Timestamptz `json:"verified_at"`
Tags []byte `json:"tags"`
@@ -230,6 +238,7 @@ func (q *Queries) GetDesktopAccountByIdentity(ctx context.Context, arg GetDeskto
&i.PlatformUid,
&i.AccountFingerprint,
&i.DisplayName,
&i.AvatarUrl,
&i.Health,
&i.VerifiedAt,
&i.Tags,
@@ -242,7 +251,7 @@ func (q *Queries) GetDesktopAccountByIdentity(ctx context.Context, arg GetDeskto
return i, err
}
const listDesktopAccountsByClient = `-- name: ListDesktopAccountsByClient :many
const listDesktopAccountsByUser = `-- name: ListDesktopAccountsByUser :many
SELECT
desktop_id,
tenant_id,
@@ -253,6 +262,7 @@ SELECT
platform_uid,
account_fingerprint,
display_name,
avatar_url,
health,
verified_at,
tags,
@@ -263,16 +273,17 @@ SELECT
updated_at
FROM platform_accounts
WHERE workspace_id = $1
AND client_id = $2
AND user_id = $2
AND deleted_at IS NULL
ORDER BY platform_id, display_name, created_at DESC
`
type ListDesktopAccountsByClientParams struct {
WorkspaceID int64 `json:"workspace_id"`
ClientID pgtype.UUID `json:"client_id"`
type ListDesktopAccountsByUserParams struct {
WorkspaceID int64 `json:"workspace_id"`
UserID int64 `json:"user_id"`
}
type ListDesktopAccountsByClientRow struct {
type ListDesktopAccountsByUserRow struct {
DesktopID pgtype.UUID `json:"desktop_id"`
TenantID int64 `json:"tenant_id"`
WorkspaceID int64 `json:"workspace_id"`
@@ -282,6 +293,7 @@ type ListDesktopAccountsByClientRow struct {
PlatformUid string `json:"platform_uid"`
AccountFingerprint pgtype.Text `json:"account_fingerprint"`
DisplayName string `json:"display_name"`
AvatarUrl pgtype.Text `json:"avatar_url"`
Health string `json:"health"`
VerifiedAt pgtype.Timestamptz `json:"verified_at"`
Tags []byte `json:"tags"`
@@ -292,15 +304,15 @@ type ListDesktopAccountsByClientRow struct {
UpdatedAt pgtype.Timestamptz `json:"updated_at"`
}
func (q *Queries) ListDesktopAccountsByClient(ctx context.Context, arg ListDesktopAccountsByClientParams) ([]ListDesktopAccountsByClientRow, error) {
rows, err := q.db.Query(ctx, listDesktopAccountsByClient, arg.WorkspaceID, arg.ClientID)
func (q *Queries) ListDesktopAccountsByUser(ctx context.Context, arg ListDesktopAccountsByUserParams) ([]ListDesktopAccountsByUserRow, error) {
rows, err := q.db.Query(ctx, listDesktopAccountsByUser, arg.WorkspaceID, arg.UserID)
if err != nil {
return nil, err
}
defer rows.Close()
var items []ListDesktopAccountsByClientRow
var items []ListDesktopAccountsByUserRow
for rows.Next() {
var i ListDesktopAccountsByClientRow
var i ListDesktopAccountsByUserRow
if err := rows.Scan(
&i.DesktopID,
&i.TenantID,
@@ -311,6 +323,7 @@ func (q *Queries) ListDesktopAccountsByClient(ctx context.Context, arg ListDeskt
&i.PlatformUid,
&i.AccountFingerprint,
&i.DisplayName,
&i.AvatarUrl,
&i.Health,
&i.VerifiedAt,
&i.Tags,
@@ -348,6 +361,7 @@ RETURNING
platform_uid,
account_fingerprint,
display_name,
avatar_url,
health,
verified_at,
tags,
@@ -373,6 +387,7 @@ type MarkDesktopAccountDeleteRequestedRow struct {
PlatformUid string `json:"platform_uid"`
AccountFingerprint pgtype.Text `json:"account_fingerprint"`
DisplayName string `json:"display_name"`
AvatarUrl pgtype.Text `json:"avatar_url"`
Health string `json:"health"`
VerifiedAt pgtype.Timestamptz `json:"verified_at"`
Tags []byte `json:"tags"`
@@ -396,6 +411,7 @@ func (q *Queries) MarkDesktopAccountDeleteRequested(ctx context.Context, arg Mar
&i.PlatformUid,
&i.AccountFingerprint,
&i.DisplayName,
&i.AvatarUrl,
&i.Health,
&i.VerifiedAt,
&i.Tags,
@@ -433,6 +449,7 @@ RETURNING
platform_uid,
account_fingerprint,
display_name,
avatar_url,
health,
verified_at,
tags,
@@ -464,6 +481,7 @@ type PatchDesktopAccountRow struct {
PlatformUid string `json:"platform_uid"`
AccountFingerprint pgtype.Text `json:"account_fingerprint"`
DisplayName string `json:"display_name"`
AvatarUrl pgtype.Text `json:"avatar_url"`
Health string `json:"health"`
VerifiedAt pgtype.Timestamptz `json:"verified_at"`
Tags []byte `json:"tags"`
@@ -496,6 +514,7 @@ func (q *Queries) PatchDesktopAccount(ctx context.Context, arg PatchDesktopAccou
&i.PlatformUid,
&i.AccountFingerprint,
&i.DisplayName,
&i.AvatarUrl,
&i.Health,
&i.VerifiedAt,
&i.Tags,
@@ -527,6 +546,7 @@ RETURNING
platform_uid,
account_fingerprint,
display_name,
avatar_url,
health,
verified_at,
tags,
@@ -553,6 +573,7 @@ type TombstoneDesktopAccountRow struct {
PlatformUid string `json:"platform_uid"`
AccountFingerprint pgtype.Text `json:"account_fingerprint"`
DisplayName string `json:"display_name"`
AvatarUrl pgtype.Text `json:"avatar_url"`
Health string `json:"health"`
VerifiedAt pgtype.Timestamptz `json:"verified_at"`
Tags []byte `json:"tags"`
@@ -576,6 +597,7 @@ func (q *Queries) TombstoneDesktopAccount(ctx context.Context, arg TombstoneDesk
&i.PlatformUid,
&i.AccountFingerprint,
&i.DisplayName,
&i.AvatarUrl,
&i.Health,
&i.VerifiedAt,
&i.Tags,
@@ -598,6 +620,7 @@ INSERT INTO platform_accounts (
platform_id,
platform_uid,
nickname,
avatar_url,
status,
metadata_json,
last_check_at,
@@ -621,10 +644,11 @@ VALUES (
$10,
$11,
$12,
$8::text,
$13,
$11,
$8::text,
$14,
$12,
$15,
1
)
ON CONFLICT (workspace_id, platform_id, platform_uid) WHERE deleted_at IS NULL
@@ -632,6 +656,7 @@ DO UPDATE SET
client_id = EXCLUDED.client_id,
user_id = EXCLUDED.user_id,
nickname = EXCLUDED.nickname,
avatar_url = COALESCE(EXCLUDED.avatar_url, platform_accounts.avatar_url),
status = EXCLUDED.status,
metadata_json = COALESCE(EXCLUDED.metadata_json, platform_accounts.metadata_json),
last_check_at = COALESCE(EXCLUDED.last_check_at, platform_accounts.last_check_at),
@@ -645,8 +670,8 @@ DO UPDATE SET
updated_at = now()
WHERE platform_accounts.workspace_id = EXCLUDED.workspace_id
AND (
$15::bigint IS NULL
OR platform_accounts.sync_version = $15::bigint
$16::bigint IS NULL
OR platform_accounts.sync_version = $16::bigint
)
RETURNING
desktop_id,
@@ -658,6 +683,7 @@ RETURNING
platform_uid,
account_fingerprint,
display_name,
avatar_url,
health,
verified_at,
tags,
@@ -677,6 +703,7 @@ type UpsertDesktopAccountParams struct {
PlatformID string `json:"platform_id"`
PlatformUid string `json:"platform_uid"`
DisplayName string `json:"display_name"`
AvatarUrl pgtype.Text `json:"avatar_url"`
LegacyStatus string `json:"legacy_status"`
MetadataJson []byte `json:"metadata_json"`
VerifiedAt pgtype.Timestamptz `json:"verified_at"`
@@ -696,6 +723,7 @@ type UpsertDesktopAccountRow struct {
PlatformUid string `json:"platform_uid"`
AccountFingerprint pgtype.Text `json:"account_fingerprint"`
DisplayName string `json:"display_name"`
AvatarUrl pgtype.Text `json:"avatar_url"`
Health string `json:"health"`
VerifiedAt pgtype.Timestamptz `json:"verified_at"`
Tags []byte `json:"tags"`
@@ -716,6 +744,7 @@ func (q *Queries) UpsertDesktopAccount(ctx context.Context, arg UpsertDesktopAcc
arg.PlatformID,
arg.PlatformUid,
arg.DisplayName,
arg.AvatarUrl,
arg.LegacyStatus,
arg.MetadataJson,
arg.VerifiedAt,
@@ -735,6 +764,7 @@ func (q *Queries) UpsertDesktopAccount(ctx context.Context, arg UpsertDesktopAcc
&i.PlatformUid,
&i.AccountFingerprint,
&i.DisplayName,
&i.AvatarUrl,
&i.Health,
&i.VerifiedAt,
&i.Tags,