Repository navigation
feat(rate): 好评后自动向买家发送配置消息 - #332
Merged
zhinianboke merged 1 commit intoSep 19, 2026
Merged
Conversation
- AutoRateConfig 新增 thanks_enabled/thanks_content 配置,
自动评价配置弹窗内增加开关与消息内容输入
- 三条评价路径全部挂钩,订单级 is_thanks_sent 标记跨路径去重:
1. websocket 实时评价:复用当前会话直发,收件人优先取订单买家ID
(评价请求为系统卡片消息,send_user_id 不一定是买家)
2. scheduler 定时补评价:内部接口 create-chat + send-message
3. backend 批量补评价:同上
- 发送失败/被安全拦截仅记日志,不影响评价主流程;
wait_result 识别 CSI_FORBID 拦截,unknown 视为已发出防重复打扰
- init_database 支持新装 DDL 与老库自动加列
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
功能说明(#232)
「希望增加好评后自动发送指定内容给客户」——自动评价给买家好评成功后,自动把卖家配置的致谢/售后消息私聊发给买家(每个订单仅发送一次)。
配置入口:账号管理 → 自动评价配置 → 好评后自动发送消息(开关 + 消息内容,存于
AutoRateConfig.thanks_enabled/thanks_content,不新增表)。实现设计
三条评价路径全部挂钩,共用订单级
is_thanks_sent标记跨路径去重(沿用is_red_flower/is_rated既有模式):send_msg直发create-chat+send-message(与定时私信/补发货同模式)关键细节:
message_handler.py中此类消息send_user_name="系统"),其send_user_id不一定是买家,而send_msg会把它写入 LWPactualReceivers。websocket 路径优先取订单表中的权威buyer_id(新增get_order_buyer_id辅助),订单缺失时回退卡片发送者(与确认收货消息取值一致)。wait_result=True等待服务端结果,send_status=failed(如 CSI_FORBID 安全拦截)不标记去重、保留原因日志;unknown(超时未确认)视为已发出并标记,防止重复打扰买家(与dm_send_task语义一致)。init_database新装 DDL + 老库自动加列(xy_auto_rate_configs.thanks_enabled/thanks_content、xy_orders.is_thanks_sent),条目格式与既有迁移一致。websocket_client.send_message(其字段与内部接口不一致,fix: 修复 /api/v1/messages/send 无法把消息发送给买家 #326 正在修复,避免依赖冲突)。触发语义与已知边界
is_red_flower同级别风险,窗口极小)验证
py_compile全部通过;前端tsc --noEmit+vite build生产构建通过关联 #232