oms/backend/database/migrations/20261104050100-backfill-external-send-status.js
liufumingren e1e3bb638f feat(order): 拉单任务、外部发货同步与取号记录
- 拉单任务:新增 order_sync_tasks 异步任务池,按店铺逐店拉取外部打单平台订单,前端轮询进度
- 外部发货同步:配送后把发货结果同步回店管家,提供数量统计与批量重试(externalSendSync)
- 取号:新增 waybill_fetch_records 记录取号过程,外部快递接口补充菜鸟授权信息
- 补齐相关迁移、订单页同步入口/状态展示,并新增对接说明文档

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-11-04 20:53:35 +08:00

21 lines
807 B
JavaScript
Raw 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.

'use strict';
/**
* 回填历史配送单的外部发货同步状态。
*
* 新增 `external_send_status` 时默认值是 0(待同步),但历史配送单的发货结果早已同步过
* (或者本来就不需要同步),如果不回填,定时任务会把**存量订单全部重新通知平台发货**,
* 造成误发货。这里把当前存量统一标记为「已同步」,只有上线之后新流转到配送的订单才会自动同步。
*/
module.exports = {
async up(queryInterface) {
await queryInterface.sequelize.query(
'UPDATE `order_status_delivery` SET `external_send_status` = 1, `external_sent_at` = NOW() WHERE `external_send_status` = 0'
);
},
async down() {
// 回填不可逆(也无法区分哪些是历史数据),无需回退
},
};