---
Created: 2024-09-03 Tue
Updated: 2024-12-11 09:36 Wed
---

## 2.0 Todo

1. [x] 定义各渠道hook ✅ 2024-09-25
2. [x] 顾问邮件: 何时回复附带; 何时新邮件 ✅ 2024-09-25
3. [?] 支持定时发送
4. [?] 支持保存草稿
5. [x] 发送状态: 失败后**重发**; 重新编辑后重发 ✅ 2024-11-10
6. [?] 顾问有多个邮箱和客人联系，同时还有 WABA、WA、语音三种方式。系统如何确定会话是哪个顾问和客人的
7. [I] 系统配置: 配置默认Email账户, WABA;
   1. [I] `会话标签`: 不管理. 新增自动设置, 无关联则删除. 参考微信标签
8. ~ #优化
9. [-] 修改chat路由; 使用会话ID
10. [x] 订单下的WhatsApp号码没有关联当前订单 ✅ 2024-10-29
11. [x] reaction消息丢失原文和引用 ✅ 2024-11-10
12. [x] 回复邮件: 重新获取原文, 推送内容应无原文 ✅ 2024-11-10
13. ["] 历史记录: 没有Email消息
14. [x] 订单邮箱匹配 ✅ 2024-11-10
    1. 订单OPI_SN & Email list:`[{ [opi]: [email] }]`
15. ["] 收件乱码; 阿里邮箱出现, 腾讯不会
    1. ["] 正文不乱; 签名仍然乱码
16. [x] 贴图使用网络地址 ✅ 2024-11-21
17. [?] 抄送, 多个收件人的会话, 跟帖需要在同一个会话
18. [/] 分别处理置顶的会话和普通排序的会话
19. [ ] 置顶下的分页, 获取不到下一页
20. [ ] 原邮件含复杂嵌套表格, 回复引用后排版乱了

### 2024-11-22 内部演示

> [!attention] 2024-11-25至30 内部测试

1. ["] 导入一部分邮件记录到平台; 类似导salesmarty的记录
2. [x] 发送邮件, 需要`coli_sn` ✅ 2024-11-27
3. [x] 订单页面进入, 没有新建会话 ✅ 2024-11-29
4. [x] 新建会话: 排前面 ✅ 2024-11-27
5. [x] 供应商邮件详情 ✅ 2024-11-28
6. [ ] Email Builder
7. [x] 邮件快速编辑纯文本 ✅ 2024-11-29
8. [x] 转发邮件还存在当前窗口吗? 还是新建会话
   1. [x] 新建 ✅ 2024-12-09
9. 编辑器
   1. [ ] 截图上传
   2. [ ] 嵌套表格
   3. [x] 在form中使用, 修改格式触发form提交 ✅ 2024-12-06
10. [?]  多个商业号同时与一个客人联系, 收到消息时, 匹配会话不正确. 目前仅按时间和客人号码匹配, 没匹配商业号
    1. [ ] 回复是否需要用客人发送的商业号? 使用最近的消息的号码
       1. [x] 引用消息回复时, 使用相应的号码, 但是没有更新到全局 ✅ 2024-12-03
11. ~ 移动端
    1. [ ] 无法打开图文集; 支付链接
    2. [x] 会话筛选刷新了两次; ✅ 2024-12-02
12. [ ] 供应商邮件需要放大, 搜索
13. [x] 邮件推送信息的接收, msg_source, 规范结构 ✅ 2024-12-03
14. [x] 失败邮件重新编辑, 发件人错误 ✅ 2024-12-05
15. [x] 定时收件: 后台线程运行 ✅ 2024-12-09
16. [x] 右侧切换订单号为`全部`时, 导致显示为无关联订单 ✅ 2024-12-11
17. [x] 邮件绑定订单 ✅ 2024-12-13
18. ["] 测试库和生产环境数据ID一样, 导致数据被更新
    1. 通过curl 地址与externalID区分环境
19. ["] 邮件失败, 重发没有状态
    1. ["] 重发请求之后, 推送状态`accepted`
20. [!] 邮件功能: 仅部分人使用, 第一批使用人员：王露加`*599*,601,602`，张巧慧`415,*639*,640,641`， 刘金燕`654`，李汉超`*513*,577`
    1. [x] 不主动收件 ✅ 2024-12-06
    2. [x] 邮件输入Tab, 显示"敬请期待" ✅ 2024-12-06
21. [!] 缓存清除策略
    1. [ ] 安装文件
    2. [ ] websocket数据日志
    3. [ ] 阿里云资源文件
22. ["] 收到`email.updated`的推送, 不要增加未读数量✅
23. [ ] 打开消息筛选, 点击邮件, 再打开筛选窗口, 邮件窗口消失
24. [-] 邮件已支持的格式样式, 放在生成邮件正文的头部
	1. 部分邮件客户端不兼容, 会删掉
25. [I] 纯文本邮件, 粘贴/添加文件作为附件
26. [x] 发送多个附件, 只收到一个 ✅ 
27. [-] 消息列表收到推送提示key重复✅ 
	1. 气泡组件的meetingLink的按钮没有key
28. [ ] 邮件修改绑定, 邮件更新成功, 消息表的没有
29. [x] 邮件引用原文的格式要保留完全 ✅ 2024-12-13
30. [x] 纯文本邮件丢失换行, 应需要设置contentType`text/plain` ✅ 2024-12-17
31. [x] WhatsApp字段为空, 发不出消息的检测和提示 ✅ 2024-12-13
32. [?] 会话列表 pageSize 20太小? 导入邮件后, 邮件都在置顶, 导致WhatsApp渠道页码增加, 难以查找
33. [?] page-spy 导致页面卡死
    1. [ ] max file size


> [!warning] 备注
>
> 1. 会话多个订单, 仅考虑分销逻辑, 右侧查询/切换客人订单. 暂无支持供应商逻辑, 无关联供应商与客人订单

### 测试账号

`GLOBAL_SALES_LOGIN_USER`

> [!info]- 404
>
> ```json
> {"userId":"404","userIdStr":"404","emailList":[{"opi_sn":404,"mat_sn":763,"email":"yoyo@chinahighlights.com","default":false,"backup":false},{"opi_sn":404,"mat_sn":764,"email":"yoyo@chinahighlights.net","default":false,"backup":false}],"whatsAppBusiness":"+8617607730395","whatsAppNo":"8613557032060","username":"雷元廷OT","avatarUrl":"https://static-legacy.dingtalk.com/media/lALPDfmVTxPSmNPNAyDNAyA_800_800.png","mobile":"+86-13557032060","email":"lyt@hainatravel.com","openId":"Z1v8OdYXOC4GMcbIkKCdAwiEiE","accountList":[{"OPI_SN":404,"OPI_Code":"LYT","OPI_NameCN":"雷元廷","OPI_DEI_SN":30,"OPI_NameEN":"yoyo"}]}
> ```

> [!info]- 383
>
> ```json
> {"userId":"383","userIdStr":"383,609","emailList":[{"opi_sn":383,"mat_sn":760,"email":"lyj@asiahighlights.com","default":false,"backup":false},{"opi_sn":383,"mat_sn":759,"email":"lyj@chinahighlights.com","default":false,"backup":false},{"opi_sn":383,"mat_sn":758,"email":"lyj@hainatravel.com","default":false,"backup":false},{"opi_sn":383,"mat_sn":761,"email":"lyj@chinahighlights.net","default":true,"backup":false},{"opi_sn":383,"mat_sn":762,"email":"beautifuljourney@chinahighlights.com","default":false,"backup":false}],"username":"廖一军","avatarUrl":"https://static-legacy.dingtalk.com/media/lALPBDDrhXr716HNAoDNAoA_640_640.png","mobile":"+86-18777396951","email":"lyj@hainatravel.com","whatsAppBusiness":"8617458471254","openId":"iioljiPmZ4RPoOYpkFiSn7IKAiEiE","accountList":[{"OPI_SN":383,"OPI_Code":"LYJ","OPI_NameCN":"廖一军","OPI_DEI_SN":7,"OPI_NameEN":"Jimmy Liow"},{"OPI_SN":609,"OPI_Code":"LYJAH","OPI_NameCN":"廖一军（ah）","OPI_DEI_SN":28,"OPI_NameEN":"Jimmy Liow"}]}
> ```

> [!info]- 495黄雪荣
> ```json
>{"userId":"495","userIdStr":"495,503,583","emailList":[{"opi_sn":503,"mat_sn":624,"email":"sharon@asiahighlights.com","default":true,"backup":false},{"opi_sn":495,"mat_sn":615,"email":"Sharon@chinahighlights.com","default":true,"backup":false}],"whatsAppBusiness":"+8617607730395","username":"黄雪荣","mobile":"+86-13097735982","email":"sharon@hainatravel.com","openId":"AsGx45KjA0BBaPARITzEOwiEiE","accountList":[{"OPI_SN":495,"OPI_Code":"H","OPI_NameCN":"黄雪荣","OPI_DEI_SN":1,"OPI_NameEN":"Sharon Huang"},{"OPI_SN":503,"OPI_Code":"HXY","OPI_NameCN":"黄雪荣(AH)","OPI_DEI_SN":28,"OPI_NameEN":"Sharon Huang"},{"OPI_SN":583,"OPI_Code":"HXRGH","OPI_NameCN":"黄雪荣(GH)","OPI_DEI_SN":33,"OPI_NameEN":"Sharon Huang"}]}
> ```

> [!NOTE]- 451莫才菊
>
> ```json
> { "userId": "451", "userIdStr": "451,489,551", "username": "莫才菊", "mobile": "+86-18707839550", "email": "monica@hainatravel.com", "openId": "yaDgnNpCTLFBaPARITzEOwiEiE", "accountList": [ { "OPI_SN": 451, "OPI_Code": "MCJ", "OPI_NameCN": "莫才菊", "OPI_DEI_SN": 1, "OPI_NameEN": "Monica Mo" }, { "OPI_SN": 489, "OPI_Code": "MCJAH", "OPI_NameCN": "莫才菊(AH)", "OPI_DEI_SN": 28, "OPI_NameEN": "Monica Mo" }, { "OPI_SN": 551, "OPI_Code": "MCJGH", "OPI_NameCN": "莫才菊(GH)", "OPI_DEI_SN": 33, "OPI_NameEN": "Monica Mo" } ] }
> ```

> [!info]- 143Simon
>
> ```json
> {"userId":"143","userIdStr":"143,590,591","emailList":[{"opi_sn":590,"mat_sn":673,"email":"simon@asiahighlights.com","default":true,"backup":false},{"opi_sn":143,"mat_sn":59,"email":"simon@chinahighlights.com","default":true,"backup":false},{"opi_sn":143,"mat_sn":465,"email":"simon@globalhighlights.com","default":false,"backup":true},{"opi_sn":591,"mat_sn":674,"email":"simon@globalhighlights.com","default":true,"backup":false}],"whatsAppBusiness":"+8617607730395","username":"黄荔军","avatarUrl":"https://static-legacy.dingtalk.com/media/lADPD4BhsWVrmhTNAv_NAv8_767_767.jpg","mobile":"+86-13707832821","email":"simon@hainatravel.com","openId":"9TiixMl3SmH9vRWqUMhzDSgiEiE","accountList":[{"OPI_SN":143,"OPI_Code":"SI","OPI_NameCN":"黄荔军","OPI_DEI_SN":1,"OPI_NameEN":"Simon"},{"OPI_SN":590,"OPI_Code":"SIah","OPI_NameCN":"黄荔军(Ah)","OPI_DEI_SN":28,"OPI_NameEN":"Simon Huang"},{"OPI_SN":591,"OPI_Code":"SIgh","OPI_NameCN":"黄荔军(GH)","OPI_DEI_SN":33,"OPI_NameEN":"Simon"}]}
> ```

### 统计

#### Kim Kim

##### 定义

**turn**: 回合. 每次连续的有回复的消息. 如2turns=发送一条, 收到回复一条. 连续发送3条, 收到回复1条, 也为2 turns

---

> [!example] Not done
>
> ```tasks
> not done
> path includes Haina
> heading includes CRM
> (filter by function task.status.type === 'TODO')
> sort by path reverse
> sort by heading
> ```

### 2024-10-25 前端演示

#### 邮件: 使用场景; 操作习惯

1. [?] 邮件管理器: 往来记录通知销售平台
2. 工作留痕: 沟通往来, 阶段性留痕
3. 订单流程的节点, 都有模板邮件要发送
   1. 报价信
   2. 确认信

#### 优化

1. [-] 切换渠道: `商业号`
2. [-] 收件人: 快捷输入

## Email

### 选型

- [Quill](https://quilljs.com/docs/installation)
- [Tiptap](https://tiptap.dev/docs/editor/extensions/nodes/mention)
- [lexical](https://lexical.dev/docs/intro)
- [TinyMCE](https://www.tiny.cloud/docs/tinymce/latest/getting-started/)
  - [.CN](http://tinymce.ax-z.cn/)
- [react-simple-wysiwyg](https://github.com/megahertz/react-simple-wysiwyg#readme)
- [react-page](https://github.com/react-page/react-page/)
- [Yoopta](https://github.com/Darginec05/Yoopta-Editor)
- [Jodit Editor - XDSoft.net](https://xdsoft.net/jodit/)

> [npm trends](https://npmtrends.com/@editorjs/editorjs-vs-ckeditor5-vs-draft-js-vs-froala-editor-vs-prosemirror-model-vs-quill-vs-slate-vs-tinymce-vs-tiptap)

### 顾问签名

通过链接获取, 如龙方伟
[龙方伟](http://202.103.68.35/CustomerManager/english/mailsign.asp?WL_SN=587&LGC=1)

### 附件

1. [?] 存102, 兼容邮件管理器. 无法外网直接访问  `[202.103.68.102:8888](http://202.103.68.102:8888)`
2.

## WhatsApp 数据获取备份和分析

- [Baileys](https://github.com/WhiskeySockets/Baileys)
  - 使用WhatsApp 多设备接口, 使同时登录以获取消息记录
  - websocket直连, 不需要模拟浏览器, 支持客户端模式登录(账号密码主设备)
  - 存储和分析以及其他需求自行开发
  - 免费
  - 有风险. 这个方法属于是WhatsApp的逆向工程\
    *WhatsApp要卖自己的商务服务, 按会话收费, 基于此的二次开发仓库都被要求删库, 社区目前还是积极的*
- [WADesk](https://wadesk.io/)
- [wwebjs](https://wwebjs.dev/guide/)
