出站回调:
- 新增 warehouse_notify.json 文档(notify.ping/notify.reply),与 warehouse.json 互跳
- 回调体统一 { method, code, data },method 放 query,body 为业务数据
- MD5 签名: sign=MD5(appSecret+timestamp+bodyJson)
- 回调响应: {code:200} 成功,非200/非code:200 视为失败
- docs 页面支持模拟推送调试
搜索增强(searchStock/searchWarehouseStock):
- 直接查 stock_warehouse,不再依赖 stock_store
- 新增字段: gross_weight/box_spec/packing_requirements/prohibited_type
- 管理标识: is_sn_mgmt/is_shelf_life_mgmt/is_batch_mgmt
- 条码关联: wms_stock_barcodes
- 图片: wms_file_reference(business_type=stock)+wms_file,返回数组
- id 修正为 stock_warehouse.id
推送状态完善:
- handleApiMessage 增加 push_status 更新(2成功/3失败)
- 未配回调地址 → push_status=3 + error 原因
- 回调异常 catch 也更新 push_status=3 + 写日志
- 出站日志写入 wms_warehouse_log 表(WN-前缀)
消息列表:
- keyword 兼容 content/keyword,支持数组
- keyword 搜索 content/group_name/user_name 三列
- 支持 where+operator 结构化查询(parseWhereConditions)
- storeId=-1 查询无货主消息; storeId=0→IS NULL
- 日期范围: startDate/endDate
其他:
- silent 动作: AI 识别无需回复时跳过回执
- ai_enabled 灰度开关(群级)
- bindCode 文档修正
- store_name 改用 StoreWarehouse.store_remask
109 lines
2.6 KiB
JavaScript
109 lines
2.6 KiB
JavaScript
'use strict';
|
||
|
||
/**
|
||
* 创建仓库开放 API 请求日志表。
|
||
* 记录 /warehouse 入口的每次请求:app_key、method、warehouse_id、
|
||
* 请求体、响应体、HTTP 状态码、耗时等。
|
||
*/
|
||
module.exports = {
|
||
up: async (queryInterface, Sequelize) => {
|
||
const { STRING, INTEGER, BIGINT, TEXT, DATE } = Sequelize;
|
||
|
||
await queryInterface.createTable('wms_warehouse_log', {
|
||
id: {
|
||
type: BIGINT(20).UNSIGNED,
|
||
primaryKey: true,
|
||
autoIncrement: true,
|
||
comment: '自增主键',
|
||
},
|
||
log_id: {
|
||
type: STRING(32),
|
||
allowNull: false,
|
||
unique: true,
|
||
comment: '日志唯一ID(WL-{timestamp}-{random})',
|
||
},
|
||
app_key: {
|
||
type: STRING(64),
|
||
allowNull: true,
|
||
comment: 'API 应用 AppKey',
|
||
},
|
||
method: {
|
||
type: STRING(100),
|
||
allowNull: true,
|
||
comment: '请求方法名(如 inbox.push)',
|
||
},
|
||
warehouse_id: {
|
||
type: INTEGER(10),
|
||
allowNull: true,
|
||
comment: '仓库 ID',
|
||
},
|
||
url: {
|
||
type: TEXT,
|
||
allowNull: true,
|
||
comment: '请求 URL',
|
||
},
|
||
http_status: {
|
||
type: INTEGER(5),
|
||
allowNull: true,
|
||
comment: 'HTTP 状态码',
|
||
},
|
||
body: {
|
||
type: TEXT('long'),
|
||
allowNull: true,
|
||
comment: '请求体(最大 65535 字符)',
|
||
},
|
||
result: {
|
||
type: TEXT('long'),
|
||
allowNull: true,
|
||
comment: '响应体(最大 65535 字符)',
|
||
},
|
||
use_time: {
|
||
type: INTEGER(12),
|
||
allowNull: true,
|
||
comment: '耗时(毫秒)',
|
||
},
|
||
created_at: {
|
||
type: DATE,
|
||
allowNull: true,
|
||
comment: '创建时间',
|
||
},
|
||
updated_at: {
|
||
type: DATE,
|
||
allowNull: true,
|
||
comment: '更新时间',
|
||
},
|
||
});
|
||
|
||
// 索引
|
||
await queryInterface.addIndex('wms_warehouse_log', {
|
||
name: 'uk_log_id',
|
||
unique: true,
|
||
fields: [ 'log_id' ],
|
||
});
|
||
|
||
await queryInterface.addIndex('wms_warehouse_log', {
|
||
name: 'idx_app_key',
|
||
fields: [ 'app_key' ],
|
||
});
|
||
|
||
await queryInterface.addIndex('wms_warehouse_log', {
|
||
name: 'idx_method',
|
||
fields: [ 'method' ],
|
||
});
|
||
|
||
await queryInterface.addIndex('wms_warehouse_log', {
|
||
name: 'idx_warehouse_id',
|
||
fields: [ 'warehouse_id' ],
|
||
});
|
||
|
||
await queryInterface.addIndex('wms_warehouse_log', {
|
||
name: 'idx_created_at',
|
||
fields: [ 'created_at' ],
|
||
});
|
||
},
|
||
|
||
down: async queryInterface => {
|
||
await queryInterface.dropTable('wms_warehouse_log');
|
||
},
|
||
};
|