- 商品/商品图片、店铺、店铺商品、组合商品及明细 - 仓库、仓库商品(WMS itemId 映射)、仓库接口配置与字段定义(warehouseApi/warehouseApiField) - 库存:stock_items、product_stocks(ZC/CC 双维度)与库存重算工具(utils/recalcStock.js) - 库存单据与对接日志:stock orders、api_outbound_logs - 相关迁移:shops/shop_products/stock_orders/warehouses/warehouse_apis/warehouse_products/product_stocks/files-images 等表与字段
35 lines
1.7 KiB
JavaScript
35 lines
1.7 KiB
JavaScript
'use strict';
|
||
|
||
/**
|
||
* 对外 API 请求记录模型,对应 api_outbound_logs 表
|
||
* 记录 OMS 调用外部 WMS(index.ping / singleitem.synchronize 等)的请求与响应信息,用于排查
|
||
* @param {Egg.Application} app egg application
|
||
* @return {object} apiOutboundLog model
|
||
*/
|
||
module.exports = app => {
|
||
const { BIGINT, STRING, INTEGER, TINYINT, TEXT, DATE } = app.Sequelize;
|
||
|
||
const ApiOutboundLog = app.model.define('api_outbound_log', {
|
||
id: { type: BIGINT.UNSIGNED, primaryKey: true, autoIncrement: true, comment: '主键' },
|
||
principal_id: { type: BIGINT.UNSIGNED, comment: '所属主体ID' },
|
||
warehouse_id: { type: BIGINT.UNSIGNED, comment: '关联仓库ID' },
|
||
warehouse_api_id: { type: BIGINT.UNSIGNED, comment: '使用的接口配置ID' },
|
||
api_type: { type: STRING(50), defaultValue: 'qimen', comment: '接口类型' },
|
||
method: { type: STRING(100), allowNull: false, comment: 'WMS 方法名' },
|
||
url: { type: TEXT, comment: '完整请求地址(sign 已脱敏)' },
|
||
request_headers: { type: TEXT, comment: '请求头 JSON' },
|
||
request_body: { type: TEXT, comment: '请求报文 JSON' },
|
||
response_status: { type: INTEGER, comment: 'HTTP 状态码' },
|
||
response_body: { type: TEXT, comment: '响应报文' },
|
||
is_success: { type: TINYINT, defaultValue: 0, comment: '传输层是否成功:1是 0否' },
|
||
business_code: { type: STRING(32), comment: 'WMS 业务码' },
|
||
business_message: { type: STRING(255), comment: 'WMS 业务提示' },
|
||
error: { type: TEXT, comment: '异常信息' },
|
||
duration: { type: INTEGER, comment: '耗时(毫秒)' },
|
||
created_at: { type: DATE, comment: '创建时间' },
|
||
updated_at: { type: DATE, comment: '更新时间' },
|
||
});
|
||
|
||
return ApiOutboundLog;
|
||
};
|