后端能力: - 接入店管家订单接口(/NewOrder/List),明细归一化后按店铺商品匹配系统商品/组合商品 - 新增 service/externalPrintOrder:手动与定时拉单共用入库逻辑,同时写入待审核状态分表 - 新增 schedule/fetchExternalShopOrders:按店铺配置的间隔自动拉单(最小 3 分钟,起点重叠 10 分钟) - 新增 lib/orderItemExpand + service/orderItemResolve:平台行与最小单位行互转; 绑定组合商品时按「数量 = 平台数量 x 组合内数量、单价取子商品零售价」拆成子商品行,解绑可还原 - 明细新增 platform_snapshot,保留平台原样(编码/名称/规格/图片/原行号/原数量/原单价) - 店铺商品列表支持 has_unbound_order 筛选,订单列表支持 exclude_unbound(均已同步导出定义) - 店铺商品只读化:移除新增/编辑/删除动作,仅保留查询与绑定; 同步商品时平台已不存在的商品自动清理(未绑定且未被订单引用直接删除,已绑定或被引用仅下架) - 新增 scripts/rebuild-order-items 存量明细重建脚本,新增 orderItemExpand 单测(8 项) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
30 lines
1.1 KiB
JavaScript
30 lines
1.1 KiB
JavaScript
'use strict';
|
||
|
||
/**
|
||
* 店铺增加「最近拉取订单」状态,用于定时拉单判断间隔与前端展示。
|
||
*
|
||
* - last_order_sync_at:最近一次成功发起拉单的时间(含手动与定时)
|
||
* - last_order_sync_msg:最近一次拉单结果/失败原因
|
||
*/
|
||
module.exports = {
|
||
async up(queryInterface, Sequelize) {
|
||
await queryInterface.addColumn('shops', 'last_order_sync_at', {
|
||
type: Sequelize.DATE,
|
||
allowNull: true,
|
||
comment: '最近一次拉取订单时间',
|
||
});
|
||
await queryInterface.addColumn('shops', 'last_order_sync_msg', {
|
||
type: Sequelize.STRING(255),
|
||
allowNull: true,
|
||
comment: '最近一次拉取订单结果/失败原因',
|
||
});
|
||
await queryInterface.addIndex('shops', [ 'type', 'auto_fetch_order' ], { name: 'idx_shops_type_auto_fetch' });
|
||
},
|
||
|
||
async down(queryInterface) {
|
||
await queryInterface.removeIndex('shops', 'idx_shops_type_auto_fetch');
|
||
await queryInterface.removeColumn('shops', 'last_order_sync_msg');
|
||
await queryInterface.removeColumn('shops', 'last_order_sync_at');
|
||
},
|
||
};
|