world_sync/skill/SKILL.md

40 lines
1.6 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
name: world_sync
description: world_sync 模块技能文档。
---
# world_sync 模块
## 概述
世界数据同步模块,管理世界数据的导入/导出/合并同步记录与执行。依赖 world 模块world 表、appbaseappcodes 字典 sync_type/sync_status。通过 load_world_sync() 挂载。
## 数据模型
### 表 world_syncmodels/world_sync.json
| 字段 | 类型 | 说明 |
|------|------|------|
| id | str(32) | 主键 |
| world_id | str(32) | 所属世界→world.id |
| sync_type | str(16) | 同步类型0导入/1导出/2合并 |
| source | str(255) | 数据来源 |
| status | str(16) | 状态appcodes sync_status |
| result_json | text | 同步结果 JSON |
| sync_date | date | 同步日期(业务日期) |
| created_at | timestamp | 创建时间 |
- 主键:["id"]索引idx_sync_world(world_id)
- 字典world_id→world、sync_type→appcodes_kv(parentid='sync_type')、status→appcodes_kv(parentid='sync_status')
## 关键接口
- list_world_syncs / get_world_sync / create_world_sync / update_world_sync / delete_world_sync / execute_world_sync
- wwwroot/api/world_sync.dspy同步契约、create/world_sync_update/world_sync_delete.dspy、get_search_*.dspy
## 陷阱
- 库名不硬编码:.py 用 ServerEnv().get_module_dbname('world_sync').dspy 用 get_sor_context(request._run_ns,'world_sync')
- dspy 无 import
- create/execute 必须设置 created_at、sync_date否则 sor.C 静默丢记录
- update 剔除 _text 后缀
- codes.table 引用 world 不用 module.table 点号
## 依赖
- world、appbase、rbac