平台字典新增 Shopify(SHOPIFY)

- platformCode.js:预设编码加 SHOPIFY(名称 Shopify),别名 shopify / 独立站 → SHOPIFY
- 前端 constants/platform.ts 同步(平台下拉、订单列表名称展示同源)
- dxm 订单报文的 platform=shopify 不再落到 OTHER,重拉后 platform_type / source_platform_code = SHOPIFY
- 测试:预设表 17→18,补 shopify 解析用例;dxm 单测平台编码断言同步
- 文档 5.0 补平台编码口径
- 本地已验证:重拉 60 单后 59 张待审核单 source_platform_code=SHOPIFY(name=Shopify),orders 60 行 platform_type=SHOPIFY

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
liufumingren 2026-11-24 03:08:07 +08:00
parent 266866f739
commit 72c886bca6
6 changed files with 15 additions and 5 deletions

View File

@ -20,6 +20,7 @@ const PLATFORM_PRESETS = [
{ code: 'OFFLINE', name: '线下' }, { code: 'OFFLINE', name: '线下' },
{ code: 'OTHER', name: '其他' }, { code: 'OTHER', name: '其他' },
{ code: 'PDD', name: '拼多多' }, { code: 'PDD', name: '拼多多' },
{ code: 'SHOPIFY', name: 'Shopify' },
{ code: 'SPH', name: '视频号' }, { code: 'SPH', name: '视频号' },
{ code: 'TB', name: '淘宝' }, { code: 'TB', name: '淘宝' },
{ code: 'TGC', name: '淘工厂' }, { code: 'TGC', name: '淘工厂' },
@ -85,6 +86,9 @@ const PLATFORM_ALIASES = {
pdd: 'PDD', pdd: 'PDD',
pinduoduo: 'PDD', pinduoduo: 'PDD',
拼多多: 'PDD', 拼多多: 'PDD',
// Shopify(店小秘等跨境平台的 platform=shopify)
shopify: 'SHOPIFY',
独立站: 'SHOPIFY',
// 视频号 // 视频号
sph: 'SPH', sph: 'SPH',
wxvideo: 'SPH', wxvideo: 'SPH',

View File

@ -886,7 +886,7 @@ class DxmService extends PrintPlatformService {
contact_phone: '', contact_phone: '',
status: deleted || expired ? 0 : 1, status: deleted || expired ? 0 : 1,
status_label: deleted ? '已删除' : expired ? '授权过期' : '正常', status_label: deleted ? '已删除' : expired ? '授权过期' : '正常',
// 平台原始标识(如 shopify)与系统预设编码(跨境平台多为 OTHER),名字优先用平台给的中文名 // 平台原始标识(如 shopify)与系统预设编码(跨境平台见 platformCode.js),名字优先用平台给的中文名
platform: String(data.platform || platform.platform || ''), platform: String(data.platform || platform.platform || ''),
platform_code: preset.code, platform_code: preset.code,
platform_name: platform.platformName || preset.name, platform_name: platform.platformName || preset.name,

View File

@ -5,10 +5,10 @@ const { resolvePlatform, resolvePlatformCode, platformNameOf, PLATFORM_PRESETS }
const DgjService = require('../../../app/lib/printPlatform/dgj'); const DgjService = require('../../../app/lib/printPlatform/dgj');
describe('platformCode 预设平台编码', () => { describe('platformCode 预设平台编码', () => {
it('预设编码表覆盖 17 个平台且编码唯一', () => { it('预设编码表覆盖 18 个平台且编码唯一', () => {
const codes = PLATFORM_PRESETS.map(item => item.code); const codes = PLATFORM_PRESETS.map(item => item.code);
assert.strictEqual(codes.length, 17); assert.strictEqual(codes.length, 18);
assert.strictEqual(new Set(codes).size, 17); assert.strictEqual(new Set(codes).size, 18);
}); });
it('店管家 PlatformType 映射到预设编码', () => { it('店管家 PlatformType 映射到预设编码', () => {
@ -37,6 +37,9 @@ describe('platformCode 预设平台编码', () => {
assert.strictEqual(resolvePlatformCode('拼多多'), 'PDD'); assert.strictEqual(resolvePlatformCode('拼多多'), 'PDD');
assert.strictEqual(resolvePlatformCode('抖音小店'), 'DYXD'); assert.strictEqual(resolvePlatformCode('抖音小店'), 'DYXD');
assert.strictEqual(resolvePlatformCode('视频号'), 'SPH'); assert.strictEqual(resolvePlatformCode('视频号'), 'SPH');
// 店小秘等跨境平台:platform=shopify
assert.strictEqual(resolvePlatformCode('shopify'), 'SHOPIFY');
assert.deepStrictEqual(resolvePlatform('shopify'), { code: 'SHOPIFY', name: 'Shopify' });
}); });
it('未知平台落到 OTHER(其他)', () => { it('未知平台落到 OTHER(其他)', () => {

View File

@ -362,7 +362,7 @@ describe('printPlatform/dxm listOrders', () => {
assert.strictEqual(order.external_shop_id, '9139394'); assert.strictEqual(order.external_shop_id, '9139394');
assert.strictEqual(order.external_shop_name, 'c1eqfe-0a'); assert.strictEqual(order.external_shop_name, 'c1eqfe-0a');
assert.strictEqual(order.platform_status, 'allocated_has'); assert.strictEqual(order.platform_status, 'allocated_has');
assert.strictEqual(order.platform_code, 'OTHER'); assert.strictEqual(order.platform_code, 'SHOPIFY');
// 物流商(agentProviderName)→ 快递公司字典编码,渠道名原样留痕 // 物流商(agentProviderName)→ 快递公司字典编码,渠道名原样留痕
assert.strictEqual(order.logistics_code, 'KJKYSD'); assert.strictEqual(order.logistics_code, 'KJKYSD');
assert.strictEqual(order.logistics_name, '跨源速递'); assert.strictEqual(order.logistics_name, '跨源速递');

View File

@ -22,6 +22,7 @@ export const PLATFORM_PRESETS: PlatformPreset[] = [
{ code: 'OFFLINE', name: '线下' }, { code: 'OFFLINE', name: '线下' },
{ code: 'OTHER', name: '其他' }, { code: 'OTHER', name: '其他' },
{ code: 'PDD', name: '拼多多' }, { code: 'PDD', name: '拼多多' },
{ code: 'SHOPIFY', name: 'Shopify' },
{ code: 'SPH', name: '视频号' }, { code: 'SPH', name: '视频号' },
{ code: 'TB', name: '淘宝' }, { code: 'TB', name: '淘宝' },
{ code: 'TGC', name: '淘工厂' }, { code: 'TGC', name: '淘工厂' },

View File

@ -211,6 +211,8 @@ OMS 实现(`dxm.js#listOrders`):
`zip`→`zip_code`、`email`→`email`; `zip`→`zip_code`、`email`→`email`;
**跨境单没有区县/街道,`area`/`town` 用 `-` 占位**(下游必填项、面单打印都需要有值),不做中英文转换; **跨境单没有区县/街道,`area`/`town` 用 `-` 占位**(下游必填项、面单打印都需要有值),不做中英文转换;
- 明细跳过 `cancelFlag=true` 的行; - 明细跳过 `cancelFlag=true` 的行;
- 平台编码取报文 `platform`(如 `shopify`)→ `platformCode.resolvePlatform`,`shopify` 已收录为预设
`SHOPIFY`(名称 `Shopify`);未收录的平台仍落 `OTHER`(其他);
- **订单明细只给平台规格ID**(`productId`/`vid`/`stockProductId` 都是规格ID),不给平台商品ID, - **订单明细只给平台规格ID**(`productId`/`vid`/`stockProductId` 都是规格ID),不给平台商品ID,
因此明细的 `outer_item_id` 留空,由 `lib/shopProductMatch` 按「规格ID 在店铺内唯一命中」匹配店铺商品, 因此明细的 `outer_item_id` 留空,由 `lib/shopProductMatch` 按「规格ID 在店铺内唯一命中」匹配店铺商品,
落库时再回填 `outer_item_id`(取匹配到的店铺商品)。 落库时再回填 `outer_item_id`(取匹配到的店铺商品)。