ming #1

Merged
liufumingren merged 558 commits from ming into main 2026-11-18 16:13:25 +08:00
31 changed files with 204 additions and 194 deletions
Showing only changes of commit 7854057244 - Show all commits

View File

@ -130,7 +130,7 @@ module.exports = appInfo => {
'audio/x-m4a': 'audio',
};
config.cors = {
origin: (ctx) => ctx.get('Origin'), // 动态返回请求源,配合 credentials: true 使用
origin: ctx => ctx.get('Origin'), // 动态返回请求源,配合 credentials: true 使用
allowMethods: 'GET,HEAD,PUT,POST,DELETE,PATCH,OPTIONS',
exposeHeaders: 'Authorization',
credentials: true, // 允许携带 cookie

View File

@ -10,7 +10,7 @@ const FK_NAME = 'wms_express_setting_ibfk_1';
* @param {import('sequelize').QueryInterface} queryInterface 查询接口。
* @param {string} tableName 表名。
* @param {string} indexName 索引名。
* @returns {Promise<boolean>} 索引是否存在。
* @return {Promise<boolean>} 索引是否存在。
*/
const hasIndex = async (queryInterface, tableName, indexName) => {
const [ rows ] = await queryInterface.sequelize.query(
@ -25,7 +25,7 @@ const hasIndex = async (queryInterface, tableName, indexName) => {
* @param {import('sequelize').QueryInterface} queryInterface 查询接口。
* @param {string} tableName 表名。
* @param {string} constraintName 约束名。
* @returns {Promise<boolean>} 外键是否存在。
* @return {Promise<boolean>} 外键是否存在。
*/
const hasForeignKey = async (queryInterface, tableName, constraintName) => {
const [ rows ] = await queryInterface.sequelize.query(
@ -47,7 +47,7 @@ module.exports = {
* 原 UNIQUE KEY `platform_code` ON (`express_code`, `warehouse_id`) 约束过紧,
* 且该索引被外键 `wms_express_setting_ibfk_1`(express_code → wms_express.code)依赖。
* @param {import('sequelize').QueryInterface} queryInterface 查询接口。
* @returns {Promise<void>} 无返回值。
* @return {Promise<void>} 无返回值。
*/
async up(queryInterface) {
// 1. 先删除依赖该索引的外键约束
@ -75,7 +75,7 @@ module.exports = {
/**
* 回滚迁移:恢复唯一索引与外键约束。
* @param {import('sequelize').QueryInterface} queryInterface 查询接口。
* @returns {Promise<void>} 无返回值。
* @return {Promise<void>} 无返回值。
*/
async down(queryInterface) {
// 1. 删除替代的普通索引

View File

@ -9,7 +9,7 @@ const PLAIN_INDEX_NAME = 'idx_warehouse_platform_shop_name';
* @param {import('sequelize').QueryInterface} queryInterface 查询接口。
* @param {string} tableName 表名。
* @param {string} indexName 索引名。
* @returns {Promise<boolean>} 索引是否存在。
* @return {Promise<boolean>} 索引是否存在。
*/
const hasIndex = async (queryInterface, tableName, indexName) => {
const [ rows ] = await queryInterface.sequelize.query(
@ -26,7 +26,7 @@ module.exports = {
* 触发 UNIQUE KEY `uk_warehouse_platform_shop_name` 约束冲突,导致 MySQL UPDATE 失败。
* 故将此唯一约束降为普通索引,仅保留查询性能。
* @param {import('sequelize').QueryInterface} queryInterface 查询接口。
* @returns {Promise<void>} 无返回值。
* @return {Promise<void>} 无返回值。
*/
async up(queryInterface) {
// 1. 删除唯一索引
@ -47,7 +47,7 @@ module.exports = {
/**
* 回滚迁移:恢复唯一约束。
* @param {import('sequelize').QueryInterface} queryInterface 查询接口。
* @returns {Promise<void>} 无返回值。
* @return {Promise<void>} 无返回值。
*/
async down(queryInterface) {
// 1. 删除普通索引

View File

@ -117,7 +117,7 @@ const ROLE_UPDATES = [
// 其他普工:排除设置模块(4-9,40,41,80,81,336,366,375)、财务、数据、测试、系统、敏感API、仓库管理API、视频
permissions: '[1,11,12,13,14,15,17,18,19,20,21,22,24,25,26,27,29,30,38,39,43,44,45,46,48,49,50,54,55,57,58,61,62,63,64,65,66,67,68,69,70,71,72,74,75,76,77,78,79,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,108,244,254,255,256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,281,283,290,291,292,293,294,295,296,297,298,299,300,303,304,305,306,307,309,333,334,335,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,357,358,361,364,365,370,373,374,376,377,379,380,381,382,383,384]',
old: '[4-121]',
}
},
];
/**

View File

@ -5,6 +5,7 @@ module.exports = {
* 将 CREATED 状态合并到 PENDING:
* 1. 先把现有 CREATED 行更新为 PENDING
* 2. 再 ALTER TABLE 去掉 CREATED 枚举值
* @param queryInterface
*/
up: async queryInterface => {
// 先更新现有 CREATED 行
@ -19,6 +20,7 @@ module.exports = {
/**
* 回滚:将 CREATED 加回 ENUM(数据不回退,因为无法区分哪些行原本是 CREATED)
* @param queryInterface
*/
down: async queryInterface => {
await queryInterface.sequelize.query(

View File

@ -144,7 +144,7 @@ module.exports = {
});
},
down: async (queryInterface) => {
down: async queryInterface => {
await queryInterface.dropTable(TABLE_NAME);
},
};

View File

@ -4,29 +4,31 @@ module.exports = {
/**
* 修改 wms_api_app 表的唯一键 uk_interface_warehouse:
* 从 (qimen_app_key, qimen_customer_id) 改为 (qimen_app_key, qimen_warehouse_code)
* @param queryInterface
*/
up: async queryInterface => {
// 1. 删除旧唯一键
await queryInterface.sequelize.query(
"ALTER TABLE wms_api_app DROP INDEX uk_interface_warehouse"
'ALTER TABLE wms_api_app DROP INDEX uk_interface_warehouse'
);
// 2. 创建新唯一键
await queryInterface.sequelize.query(
"ALTER TABLE wms_api_app ADD UNIQUE INDEX uk_interface_warehouse (qimen_app_key, qimen_warehouse_code)"
'ALTER TABLE wms_api_app ADD UNIQUE INDEX uk_interface_warehouse (qimen_app_key, qimen_warehouse_code)'
);
},
/**
* 回滚:恢复为 (qimen_app_key, qimen_customer_id)
* @param queryInterface
*/
down: async queryInterface => {
// 1. 删除新唯一键
await queryInterface.sequelize.query(
"ALTER TABLE wms_api_app DROP INDEX uk_interface_warehouse"
'ALTER TABLE wms_api_app DROP INDEX uk_interface_warehouse'
);
// 2. 恢复旧唯一键
await queryInterface.sequelize.query(
"ALTER TABLE wms_api_app ADD UNIQUE INDEX uk_interface_warehouse (qimen_app_key, qimen_customer_id)"
'ALTER TABLE wms_api_app ADD UNIQUE INDEX uk_interface_warehouse (qimen_app_key, qimen_customer_id)'
);
},
};

View File

@ -5,6 +5,7 @@ module.exports = {
* 为 wms_entry_order 增加 CREATED 状态:
* ENUM 顺序: CREATING → CREATED → PENDING → CONFIRMED → PARTIAL_RECEIVED → COMPLETED → CANCELLED
* 默认值改为 CREATED
* @param queryInterface
*/
up: async queryInterface => {
await queryInterface.sequelize.query(
@ -16,6 +17,7 @@ module.exports = {
* 回滚:
* 1. 先将 CREATED 行更新为 PENDING
* 2. 再移除 CREATED 枚举值,恢复默认值 PENDING
* @param queryInterface
*/
down: async queryInterface => {
await queryInterface.sequelize.query(

View File

@ -8,6 +8,7 @@ module.exports = {
* 前置条件:
* - CONFIRMED 行数为 0,无需迁移
* - PARTIAL_RECEIVED 的 11 行改为 PENDING
* @param queryInterface
*/
up: async queryInterface => {
// 将 PARTIAL_RECEIVED 和 CONFIRMED 记录统一刷成 PENDING
@ -22,6 +23,7 @@ module.exports = {
/**
* 回滚:恢复 CONFIRMED 和 PARTIAL_RECEIVED 到 ENUM 中(不回滚数据)
* @param queryInterface
*/
down: async queryInterface => {
await queryInterface.sequelize.query(

View File

@ -60,7 +60,7 @@ module.exports = {
});
},
down: async (queryInterface) => {
down: async queryInterface => {
await queryInterface.dropTable(TABLE_NAME);
},
};

View File

@ -35,11 +35,11 @@ const logMigrationDbContext = async (queryInterface, phase, table) => {
* ALTER TABLE wms_receiving_detail MODIFY COLUMN storage_status ENUM('none','partial','all') NOT NULL DEFAULT 'none' COMMENT '入库状态:none-未入库, partial-部分入库, all-全部入库';
*/
const UP_SQL_RECEIVING = `ALTER TABLE wms_receiving MODIFY COLUMN storage_status ENUM('none','waiting','partial','all') NOT NULL DEFAULT 'none' COMMENT '入库状态:none-未入库, waiting-等待入库, partial-部分入库, all-全部入库'`;
const DOWN_SQL_RECEIVING = `ALTER TABLE wms_receiving MODIFY COLUMN storage_status ENUM('none','partial','all') NOT NULL DEFAULT 'none' COMMENT '入库状态:none-未入库, partial-部分入库, all-全部入库'`;
const UP_SQL_RECEIVING = 'ALTER TABLE wms_receiving MODIFY COLUMN storage_status ENUM(\'none\',\'waiting\',\'partial\',\'all\') NOT NULL DEFAULT \'none\' COMMENT \'入库状态:none-未入库, waiting-等待入库, partial-部分入库, all-全部入库\'';
const DOWN_SQL_RECEIVING = 'ALTER TABLE wms_receiving MODIFY COLUMN storage_status ENUM(\'none\',\'partial\',\'all\') NOT NULL DEFAULT \'none\' COMMENT \'入库状态:none-未入库, partial-部分入库, all-全部入库\'';
const UP_SQL_DETAIL = `ALTER TABLE wms_receiving_detail MODIFY COLUMN storage_status ENUM('none','waiting','partial','all') NOT NULL DEFAULT 'none' COMMENT '入库状态:none-未入库, waiting-等待入库, partial-部分入库, all-全部入库'`;
const DOWN_SQL_DETAIL = `ALTER TABLE wms_receiving_detail MODIFY COLUMN storage_status ENUM('none','partial','all') NOT NULL DEFAULT 'none' COMMENT '入库状态:none-未入库, partial-部分入库, all-全部入库'`;
const UP_SQL_DETAIL = 'ALTER TABLE wms_receiving_detail MODIFY COLUMN storage_status ENUM(\'none\',\'waiting\',\'partial\',\'all\') NOT NULL DEFAULT \'none\' COMMENT \'入库状态:none-未入库, waiting-等待入库, partial-部分入库, all-全部入库\'';
const DOWN_SQL_DETAIL = 'ALTER TABLE wms_receiving_detail MODIFY COLUMN storage_status ENUM(\'none\',\'partial\',\'all\') NOT NULL DEFAULT \'none\' COMMENT \'入库状态:none-未入库, partial-部分入库, all-全部入库\'';
module.exports = {
/**

View File

@ -9,14 +9,14 @@ const options = {
path: `/system?method=${method}&v=1&timestamp=${Math.floor(Date.now() / 1000)}`,
method: 'POST',
headers: {
'platform': 'web',
'project': 'wms',
'Authorization': `Bearer ${token}`,
platform: 'web',
project: 'wms',
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
},
};
const req = http.request(options, (res) => {
const req = http.request(options, res => {
let data = '';
res.on('data', chunk => data += chunk);
res.on('end', () => {
@ -29,6 +29,6 @@ const req = http.request(options, (res) => {
}
});
});
req.on('error', (e) => console.error('ERROR:', e.message));
req.on('error', e => console.error('ERROR:', e.message));
req.write(reqBody);
req.end();

View File

@ -17,14 +17,14 @@ const options = {
path: `/system?method=${method}&v=1&timestamp=${Math.floor(Date.now() / 1000)}`,
method: 'POST',
headers: {
'platform': 'web',
'project': 'wms',
'Authorization': `Bearer ${token}`,
platform: 'web',
project: 'wms',
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
},
};
const req = http.request(options, (res) => {
const req = http.request(options, res => {
let data = '';
res.on('data', chunk => data += chunk);
res.on('end', () => {
@ -42,6 +42,6 @@ const req = http.request(options, (res) => {
}
});
});
req.on('error', (e) => console.error('REQUEST ERROR:', e.message));
req.on('error', e => console.error('REQUEST ERROR:', e.message));
req.write(reqBody);
req.end();

View File

@ -34,15 +34,14 @@ function api(method, body) {
hostname: 'localhost', port: 6060,
path: `/system?method=${method}&v=1&timestamp=${Math.floor(Date.now() / 1000)}`,
method: 'POST',
headers: { 'platform': 'web', 'project': 'wms', 'Authorization': `Bearer ${TOKEN}`, 'Content-Type': 'application/json' },
headers: { platform: 'web', project: 'wms', Authorization: `Bearer ${TOKEN}`, 'Content-Type': 'application/json' },
timeout: 60000,
};
const req = http.request(opts, res => {
let d = '';
res.on('data', c => d += c);
res.on('end', () => {
try { resolve({ status: res.statusCode, body: JSON.parse(d) }); }
catch (e) { resolve({ status: res.statusCode, body: { _raw: d.substring(0, 300) } }); }
try { resolve({ status: res.statusCode, body: JSON.parse(d) }); } catch (e) { resolve({ status: res.statusCode, body: { _raw: d.substring(0, 300) } }); }
});
});
req.on('error', e => reject(e));

View File

@ -40,8 +40,7 @@ function api(method, body) {
timeout: 60000,
}, res => {
let d = ''; res.on('data', c => d += c); res.on('end', () => {
try { resolve({ status: res.statusCode, body: JSON.parse(d) }); }
catch (e) { resolve({ status: res.statusCode, body: { _raw: d.substring(0, 300) } }); }
try { resolve({ status: res.statusCode, body: JSON.parse(d) }); } catch (e) { resolve({ status: res.statusCode, body: { _raw: d.substring(0, 300) } }); }
});
});
req.on('error', e => reject(e));
@ -114,11 +113,11 @@ async function runScene(label, sceneKey, expectedStep, checkExpressExpected) {
await setPolicy(sceneKey);
// 2. Wait for cache invalidation
console.log(` [2] 等待缓存... (10秒让 600s cache 有机会清除)`);
console.log(' [2] 等待缓存... (10秒让 600s cache 有机会清除)');
await sleep(10000);
// 3. Create order via API
console.log(` [3] API 创建订单...`);
console.log(' [3] API 创建订单...');
const r = await createOrder();
console.log(` HTTP ${r.status}`);
@ -133,7 +132,7 @@ async function runScene(label, sceneKey, expectedStep, checkExpressExpected) {
console.log(` order_id=${orderId}, api_step=${apiStep}, api_step_label="${r.body.step_label}"`);
// 4. Wait async processing
console.log(` [4] 等待异步处理 (8秒)...`);
console.log(' [4] 等待异步处理 (8秒)...');
await sleep(8000);
// 5. Check DB
@ -141,7 +140,7 @@ async function runScene(label, sceneKey, expectedStep, checkExpressExpected) {
if (order) {
console.log(` [5] DB 订单状态: step=${order.step}, status=${order.status}, wave_id=${order.wave_id}, logistics=${order.sys_logistics_code}`);
} else {
console.log(` [5] ⚠️ 数据库中未找到订单!`);
console.log(' [5] ⚠️ 数据库中未找到订单!');
return { pass: false, reason: 'DB中找不到订单' };
}

View File

@ -40,14 +40,14 @@ function apiRequest(method, body) {
path: `/system?method=${method}&v=1&timestamp=${Math.floor(Date.now() / 1000)}`,
method: 'POST',
headers: {
'platform': 'web',
'project': 'wms',
'Authorization': `Bearer ${TOKEN}`,
platform: 'web',
project: 'wms',
Authorization: `Bearer ${TOKEN}`,
'Content-Type': 'application/json',
},
timeout: 60000,
};
const req = http.request(options, (res) => {
const req = http.request(options, res => {
let data = '';
res.on('data', chunk => data += chunk);
res.on('end', () => {
@ -60,7 +60,7 @@ function apiRequest(method, body) {
resolve({ status: res.statusCode, body: parsed });
});
});
req.on('error', (e) => reject(e));
req.on('error', e => reject(e));
req.on('timeout', () => { req.destroy(); reject(new Error('Request timeout')); });
req.write(bodyStr);
req.end();
@ -73,6 +73,7 @@ function sleep(ms) {
/**
* 更新 store_warehouse 的 policy_config
* @param policyConfig
*/
async function updatePolicyConfig(policyConfig) {
return await apiRequest('storeWarehouse.store.savePolicyConfig', {

View File

@ -16,13 +16,13 @@ function apiRequest(method, body) {
path: `/system?method=${method}&v=1&timestamp=${Math.floor(Date.now() / 1000)}`,
method: 'POST',
headers: {
'platform': 'web',
'project': 'wms',
'Authorization': `Bearer ${TOKEN}`,
platform: 'web',
project: 'wms',
Authorization: `Bearer ${TOKEN}`,
'Content-Type': 'application/json',
},
};
const req = http.request(options, (res) => {
const req = http.request(options, res => {
let data = '';
res.on('data', chunk => data += chunk);
res.on('end', () => {
@ -35,7 +35,7 @@ function apiRequest(method, body) {
resolve({ status: res.statusCode, headers: res.headers, body, _rawLength: data.length });
});
});
req.on('error', (e) => reject(e));
req.on('error', e => reject(e));
req.write(bodyStr);
req.end();
});

View File

@ -19,7 +19,7 @@ const mysql = require('mysql2/promise');
// Check the current model table for warehouse 100000
console.log('\nChecking wms_order_delivery for recheck_status:');
try {
const [rows] = await conn.query("SELECT * FROM wms_order_delivery WHERE warehouse_id = 100000 LIMIT 1");
const [ rows ] = await conn.query('SELECT * FROM wms_order_delivery WHERE warehouse_id = 100000 LIMIT 1');
if (rows.length > 0) {
console.log('Keys:', Object.keys(rows[0]).join(', '));
}

View File

@ -21,10 +21,10 @@ async function callApi(ids) {
const ts = Math.floor(Date.now() / 1000);
const url = `${BASE_URL}/system?method=order.recheckOrder.batchQuickRecheck&v=1.0&timestamp=${ts}`;
const headers = {
'platform': 'web',
'project': 'wms',
platform: 'web',
project: 'wms',
'Content-Type': 'application/json; charset=utf-8',
'Authorization': `Bearer ${TOKEN}`,
Authorization: `Bearer ${TOKEN}`,
};
const body = JSON.stringify({
module: 'order.recheckOrder',

View File

@ -54,10 +54,10 @@ async function callApi(ids) {
const ts = Math.floor(Date.now() / 1000);
const url = `${BASE_URL}/system?method=order.recheckOrder.batchQuickRecheck&v=1.0&timestamp=${ts}`;
const headers = {
'platform': 'web',
'project': 'wms',
platform: 'web',
project: 'wms',
'Content-Type': 'application/json; charset=utf-8',
'Authorization': `Bearer ${TOKEN}`,
Authorization: `Bearer ${TOKEN}`,
};
const body = JSON.stringify({ ids });
@ -76,7 +76,10 @@ async function runTestCase(name, ids, expectedDesc, preSetup, postVerify, postCl
console.log(` 输入IDs: [${ids.join(', ')}]`);
console.log(` 预期: ${expectedDesc}`);
let beforeOrder = {}, beforeStorage = {}, afterOrder = {}, afterStorage = {};
let beforeOrder = {},
beforeStorage = {},
afterOrder = {},
afterStorage = {};
let passed = false;
let failReason = '';
@ -155,7 +158,7 @@ async function main() {
console.log(`测试时间: ${new Date().toISOString()}`);
console.log(`目标表: ${TABLE}`);
console.log(`Base URL: ${BASE_URL}`);
console.log(`测试仓库ID: 100000 | 测试货主ID: 1000000`);
console.log('测试仓库ID: 100000 | 测试货主ID: 1000000');
console.log('='.repeat(60));
const results = [];
@ -187,7 +190,7 @@ async function main() {
[],
'返回错误 "订单ID列表不能为空"',
null,
async (result) => {
async result => {
// batchQuickRecheck 返回 500 而非 400(内部 throw(400) 被框架包装为 500)
// 检查是否包含错误消息
const msg = result.body && (result.body.message || '');
@ -203,7 +206,7 @@ async function main() {
[ 999999999 ],
'全部 failed, reason="未找到对应订单"',
null,
async (result) => {
async result => {
const data = result.body && (result.body.data !== undefined ? result.body.data : result.body);
if (!data || typeof data !== 'object') return `返回数据格式异常: ${JSON.stringify(result.body)}`;
if (data.success_count === 0 && data.failed_count >= 1) {
@ -221,7 +224,7 @@ async function main() {
[ 120858, 120857 ],
'全部 failed, reason="没有同步"',
null,
async (result) => {
async result => {
const data = result.body && (result.body.data !== undefined ? result.body.data : result.body);
if (!data || data.success_count !== 0) return `期望 success_count=0,实际: ${JSON.stringify(data)}`;
const allNoSync = (data.failed || []).every(f => f.reason === '没有同步');
@ -236,7 +239,7 @@ async function main() {
[ 120944, 120943 ],
'全部 failed, reason="没有分配快递"',
null,
async (result) => {
async result => {
const data = result.body && (result.body.data !== undefined ? result.body.data : result.body);
if (!data || data.success_count !== 0) return `期望 success_count=0,实际: ${JSON.stringify(data)}`;
const allNoPost = (data.failed || []).every(f => f.reason === '没有分配快递');
@ -251,7 +254,7 @@ async function main() {
[ 120947, 120939 ],
'全部 failed, reason="未分配储位"',
null,
async (result) => {
async result => {
const data = result.body && (result.body.data !== undefined ? result.body.data : result.body);
if (!data || data.success_count !== 0) return `期望 success_count=0,实际: ${JSON.stringify(data)}`;
const allNoStorage = (data.failed || []).every(f => f.reason === '未分配储位');
@ -266,7 +269,7 @@ async function main() {
[ 120945 ],
'全部 failed, reason="已拦截"',
null,
async (result) => {
async result => {
const data = result.body && (result.body.data !== undefined ? result.body.data : result.body);
if (!data || data.success_count !== 0) return `期望 success_count=0,实际: ${JSON.stringify(data)}`;
const allIntercepted = (data.failed || []).every(f => f.reason === '已拦截');
@ -290,7 +293,7 @@ async function main() {
const [ pk ] = await c2.query('SELECT status FROM wms_picking WHERE id = 87425 AND warehouse_id = 100000');
console.log(` [前置确认] picking 87425 status=${pk[0].status}`);
},
async (result) => {
async result => {
const data = result.body && (result.body.data !== undefined ? result.body.data : result.body);
if (!data || data.success_count < 1) return `期望 success_count >= 1,实际: ${JSON.stringify(data)}`;
@ -344,7 +347,7 @@ async function main() {
await c4.query("UPDATE wms_order_delivery_100000 SET pick_status = 'none', recheck_status = 'none', updated_at = NOW() WHERE id = 120946 AND warehouse_id = 100000");
console.log(' [前置] 120946 数据已恢复');
},
async (result) => {
async result => {
const data = result.body && (result.body.data !== undefined ? result.body.data : result.body);
if (!data) return `返回数据为空: ${JSON.stringify(result.body)}`;
if (data.success_count >= 1 && data.failed_count >= 2) {

View File

@ -22,10 +22,10 @@ async function callApi(ids) {
const ts = Math.floor(Date.now() / 1000);
const url = `${BASE_URL}/system?method=order.recheckOrder.batchQuickRecheck&v=1.0&timestamp=${ts}`;
const headers = {
'platform': 'web',
'project': 'wms',
platform: 'web',
project: 'wms',
'Content-Type': 'application/json; charset=utf-8',
'Authorization': `Bearer ${TOKEN}`,
Authorization: `Bearer ${TOKEN}`,
};
// IMPORTANT: body 必须扁平化,ids 直接在顶层。callMethod 将整个 body 传给业务方法
const body = JSON.stringify({ ids });

View File

@ -34,7 +34,7 @@ function createSequelizeTypes() {
STRING: length => makeType(`VARCHAR(${length})`),
BIGINT: unsignedBigInt,
DECIMAL: (precision, scale) => makeType(`DECIMAL(${precision},${scale})`),
TEXT: (length) => makeType(length ? `TEXT(${length})` : 'TEXT'),
TEXT: length => makeType(length ? `TEXT(${length})` : 'TEXT'),
ENUM: (...values) => makeType(`ENUM('${values.join("','")}')`),
DATE: makeType('DATETIME'),
INTEGER: length => makeType(`INT(${length})`),

View File

@ -35,8 +35,8 @@ function createHarness() {
service.getWarehouseId = () => 1;
// 模拟 normalizeOrderListItem / attachOrderExpressNumbers 为直通
service.normalizeOrderListItem = (item) => item;
service.attachOrderExpressNumbers = async (list) => list;
service.normalizeOrderListItem = item => item;
service.attachOrderExpressNumbers = async list => list;
// 捕获 buildWhere 入参,返回简单条件
const originalBuildWhere = service.buildWhere.bind(service);
@ -48,7 +48,7 @@ function createHarness() {
// 模拟 getOrderModel 返回可控数据
service.getOrderModel = async () => ({
count: async () => 1,
findAll: async (opts) => {
findAll: async opts => {
captures.modelOpts = opts;
return [
{

View File

@ -205,7 +205,7 @@ describe('test/app/service/systemMethods/stock.warehouse.import.test.js', () =>
});
it('should map 条码 to barcode', () => {
const row = { '条码': 'A,B' };
const row = { 条码: 'A,B' };
const normalized = service._normalizeWarehouseImportRow(row);
assert.deepEqual(normalized.barcode, [ 'A', 'B' ]);
});