调整 wechat_ipad 适配器目录规划
- 将多版本适配方案调整为每个 provider 使用独立目录管理 - 移除 855 继续复用现有 client 的建议,避免新旧协议继续耦合 - 明确阶段一优先迁移 855 所需最小能力到独立 provider 目录
This commit is contained in:
@@ -129,8 +129,8 @@ Gateway 不负责:
|
||||
建议新增:
|
||||
|
||||
- `wechat_ipad/provider_base.py`
|
||||
- `wechat_ipad/providers/legacy_855.py`
|
||||
- `wechat_ipad/providers/server_864.py`
|
||||
- `wechat_ipad/providers/legacy_855/`
|
||||
- `wechat_ipad/providers/server_864/`
|
||||
|
||||
职责:
|
||||
|
||||
@@ -140,8 +140,9 @@ Gateway 不负责:
|
||||
|
||||
说明:
|
||||
|
||||
- 855 provider 内部可以继续复用现有 `wechat_ipad/client/`
|
||||
- 864 provider 不建议强行复用旧 client,建议独立实现
|
||||
- 不再要求 855 继续复用现有 `wechat_ipad/client/`
|
||||
- 更推荐每个 provider 自带独立目录,内部自行管理登录、消息、联系人、群信息等协议实现
|
||||
- 这样可以把不同 server 的协议差异彻底隔离,避免为了兼容新版本继续污染旧 client
|
||||
|
||||
## 5. 为什么要把“运行模型”抽出来
|
||||
|
||||
@@ -293,10 +294,18 @@ wechat_ipad/
|
||||
├── gateway.py
|
||||
├── provider_base.py
|
||||
├── providers/
|
||||
│ ├── legacy_855.py
|
||||
│ └── server_864.py
|
||||
├── client/
|
||||
│ └── ... # 当前 855/859 协议实现,暂时保留
|
||||
│ ├── legacy_855/
|
||||
│ │ ├── __init__.py
|
||||
│ │ ├── provider.py
|
||||
│ │ ├── login.py
|
||||
│ │ ├── message.py
|
||||
│ │ └── contact.py
|
||||
│ └── server_864/
|
||||
│ ├── __init__.py
|
||||
│ ├── provider.py
|
||||
│ ├── login.py
|
||||
│ ├── message.py
|
||||
│ └── contact.py
|
||||
└── models/
|
||||
```
|
||||
|
||||
@@ -304,9 +313,9 @@ wechat_ipad/
|
||||
|
||||
- `gateway.py`:对 `Robot` 提供统一入口
|
||||
- `provider_base.py`:定义最小约定
|
||||
- `providers/legacy_855.py`:封装旧版实现
|
||||
- `providers/server_864.py`:独立实现 864 协议适配
|
||||
- `client/`:作为旧版协议工具层保留
|
||||
- `providers/legacy_855/`:855/859 风格协议的独立实现目录
|
||||
- `providers/server_864/`:864 风格协议的独立实现目录
|
||||
- 每个 provider 目录内按登录、消息、联系人等维度分文件,但只在本 provider 内部使用,不向外暴露协议细节
|
||||
|
||||
## 10. 推荐推进路线
|
||||
|
||||
@@ -315,14 +324,15 @@ wechat_ipad/
|
||||
目标:
|
||||
|
||||
- 让 `Robot` 依赖 Gateway
|
||||
- 但底层仍然走当前 855/859 的 `WechatAPIClient`
|
||||
- 但底层行为先只对齐当前 855/859,保证现有能力不受影响
|
||||
|
||||
建议步骤:
|
||||
|
||||
1. 新增 `gateway.py`
|
||||
2. 新增 `provider_base.py`
|
||||
3. 新增 `providers/legacy_855.py`
|
||||
4. 把 `robot.py` 中直接依赖 `WechatAPIClient` 的位置改成依赖 Gateway
|
||||
3. 新增 `providers/legacy_855/` 目录与 `provider.py`
|
||||
4. 把当前 855 所需的登录、消息、联系人能力逐步迁入该目录
|
||||
5. 把 `robot.py` 中直接依赖 `WechatAPIClient` 的位置改成依赖 Gateway
|
||||
|
||||
阶段结果:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user