- Add browser_automation.py: HTTP→Headless Browser adapter
- 6 platform default browser scripts (douyin/bilibili/kuaishou/xiaohongshu/toutiao/channels)
- {{variable}} substitution for content fields
- configurable browser_endpoint in extra_config
- engine.py: route browser-only platforms to browser_execute()
- platfoms.py: remove NotImplementedError stubs
86 lines
3.5 KiB
SQL
86 lines
3.5 KiB
SQL
-- ============================================
|
||
-- 内容发布模块 (Publisher) — 4 tables
|
||
-- ============================================
|
||
|
||
-- ./publisher_platform (发布平台配置)
|
||
drop table if exists publisher_platform;
|
||
CREATE TABLE publisher_platform
|
||
(
|
||
`id` VARCHAR(32) comment 'id',
|
||
`name` VARCHAR(200) comment '平台名称',
|
||
`platform_code` VARCHAR(50) comment '平台代码: douyin/kuaishou/bilibili/weibo/wechat/xiaohongshu/toutiao/youtube/twitter',
|
||
`api_endpoint` VARCHAR(500) comment 'API 端点',
|
||
`app_key` VARCHAR(500) comment 'App Key',
|
||
`app_secret` VARCHAR(500) comment 'App Secret(加密)',
|
||
`access_token` VARCHAR(2000) comment 'Access Token',
|
||
`refresh_token` VARCHAR(500) comment 'Refresh Token',
|
||
`token_expires` VARCHAR(50) comment 'Token 过期时间',
|
||
`extra_config` TEXT comment '额外配置 JSON: browser_endpoint, browser_script, uid, open_id 等',
|
||
`enabled` VARCHAR(1) DEFAULT '1' comment '是否启用',
|
||
`created_at` VARCHAR(50) comment '创建时间'
|
||
,primary key(id)
|
||
)
|
||
engine=innodb default charset=utf8 comment '发布平台配置'
|
||
;
|
||
|
||
-- ./publisher_content (待发布内容)
|
||
drop table if exists publisher_content;
|
||
CREATE TABLE publisher_content
|
||
(
|
||
`id` VARCHAR(32) comment 'id',
|
||
`title` VARCHAR(500) comment '标题',
|
||
`content_type` VARCHAR(20) comment '类型: article/video/audio/image',
|
||
`body` TEXT comment '正文/描述',
|
||
`media_urls` TEXT comment '媒体文件URL列表 JSON',
|
||
`cover_url` VARCHAR(2000) comment '封面图URL',
|
||
`tags` VARCHAR(500) comment '标签',
|
||
`category` VARCHAR(100) comment '分类',
|
||
`status` VARCHAR(20) DEFAULT 'draft' comment '状态: draft/ready/publishing/published/failed',
|
||
`created_at` VARCHAR(50) comment '创建时间',
|
||
`updated_at` VARCHAR(50) comment '更新时间'
|
||
,primary key(id)
|
||
)
|
||
engine=innodb default charset=utf8 comment '发布内容'
|
||
;
|
||
|
||
-- ./publisher_task (发布任务 — 内容 × 平台的关联)
|
||
drop table if exists publisher_task;
|
||
CREATE TABLE publisher_task
|
||
(
|
||
`id` VARCHAR(32) comment 'id',
|
||
`content_id` VARCHAR(32) comment '内容ID',
|
||
`platform_id` VARCHAR(32) comment '平台ID',
|
||
`schedule_at` VARCHAR(50) comment '定时发布时间',
|
||
`status` VARCHAR(20) DEFAULT 'pending' comment '状态: pending/running/success/failed/cancelled',
|
||
`external_id` VARCHAR(500) comment '平台返回的内容ID',
|
||
`external_url` VARCHAR(2000) comment '平台返回的链接',
|
||
`retry_count` INT DEFAULT 0 comment '重试次数',
|
||
`created_at` VARCHAR(50) comment '创建时间',
|
||
`executed_at` VARCHAR(50) comment '执行时间'
|
||
,primary key(id)
|
||
)
|
||
engine=innodb default charset=utf8 comment '发布任务'
|
||
;
|
||
CREATE INDEX publisher_task_content_idx ON publisher_task(content_id);
|
||
CREATE INDEX publisher_task_platform_idx ON publisher_task(platform_id);
|
||
CREATE INDEX publisher_task_status_idx ON publisher_task(status);
|
||
|
||
-- ./publisher_log (发布执行日志)
|
||
drop table if exists publisher_log;
|
||
CREATE TABLE publisher_log
|
||
(
|
||
`id` VARCHAR(32) comment 'id',
|
||
`task_id` VARCHAR(32) comment '任务ID',
|
||
`action` VARCHAR(50) comment '操作: publish/update/delete',
|
||
`status` VARCHAR(20) comment '状态: success/failed',
|
||
`duration_ms` INT DEFAULT 0 comment '耗时(毫秒)',
|
||
`error_code` VARCHAR(100) comment '错误码',
|
||
`error_detail` TEXT comment '错误详情',
|
||
`platform_response` TEXT comment '平台原始响应 JSON',
|
||
`executed_at` VARCHAR(50) comment '执行时间'
|
||
,primary key(id)
|
||
)
|
||
engine=innodb default charset=utf8 comment '发布日志'
|
||
;
|
||
CREATE INDEX publisher_log_task_idx ON publisher_log(task_id);
|