出站回调:
- 新增 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
107 lines
2.7 KiB
JavaScript
107 lines
2.7 KiB
JavaScript
'use strict';
|
||
|
||
/**
|
||
* 站内信群表 Model。
|
||
* 记录与 WMS 交互的群信息,支持按仓库屏蔽。
|
||
*
|
||
* @param {Object} app Egg.js Application 实例。
|
||
* @return {Object} Sequelize Model 定义。
|
||
*/
|
||
module.exports = app => {
|
||
const { BIGINT, STRING, TINYINT, DATE } = app.Sequelize;
|
||
|
||
const InboxGroup = app.model.define('inbox_group', {
|
||
id: {
|
||
type: BIGINT.UNSIGNED,
|
||
primaryKey: true,
|
||
autoIncrement: true,
|
||
allowNull: false,
|
||
comment: '主键',
|
||
},
|
||
group_name: {
|
||
type: STRING(100),
|
||
allowNull: false,
|
||
comment: '群名称',
|
||
},
|
||
group_id: {
|
||
type: STRING(100),
|
||
allowNull: true,
|
||
comment: '外部群ID',
|
||
},
|
||
warehouse_id: {
|
||
type: BIGINT.UNSIGNED,
|
||
allowNull: false,
|
||
comment: '所属仓库ID',
|
||
},
|
||
store_id: {
|
||
type: BIGINT.UNSIGNED,
|
||
allowNull: true,
|
||
comment: '关联货主ID',
|
||
},
|
||
group_type: {
|
||
type: app.Sequelize.ENUM('store', 'warehouse', 'express'),
|
||
allowNull: true,
|
||
comment: '群类型: store=货主 warehouse=仓库 express=快递',
|
||
},
|
||
sub_type: {
|
||
type: STRING(20),
|
||
allowNull: true,
|
||
comment: '群子类型: 货主(售后/财务/收货) 仓库(收货/普通/生产) 快递(揽收/售后)',
|
||
},
|
||
source_type: {
|
||
type: STRING(20),
|
||
allowNull: true,
|
||
comment: '来源类型:im / api / system',
|
||
},
|
||
source_extra: {
|
||
type: STRING(100),
|
||
allowNull: true,
|
||
comment: '来源附加信息',
|
||
},
|
||
is_blocked: {
|
||
type: TINYINT(1),
|
||
allowNull: false,
|
||
defaultValue: 0,
|
||
comment: '是否屏蔽 0=否 1=是',
|
||
},
|
||
ai_enabled: {
|
||
type: TINYINT(1),
|
||
allowNull: false,
|
||
defaultValue: 0,
|
||
comment: '是否启用AI自动回复: 0=关闭 1=开启',
|
||
},
|
||
express_interfaces: {
|
||
type: STRING(500),
|
||
allowNull: true,
|
||
comment: '快递接口ID列表,逗号分隔(仅群类型为 express 时生效)',
|
||
},
|
||
system_express_code: {
|
||
type: STRING(50),
|
||
allowNull: true,
|
||
comment: '系统快递编码(仅群类型为 express 时必填)',
|
||
},
|
||
created_at: {
|
||
type: DATE,
|
||
allowNull: false,
|
||
defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'),
|
||
comment: '创建时间',
|
||
},
|
||
updated_at: {
|
||
type: DATE,
|
||
allowNull: false,
|
||
defaultValue: app.Sequelize.literal('CURRENT_TIMESTAMP'),
|
||
comment: '更新时间',
|
||
},
|
||
}, {
|
||
tableName: 'wms_inbox_group',
|
||
timestamps: true,
|
||
createdAt: 'created_at',
|
||
updatedAt: 'updated_at',
|
||
deletedAt: 'deleted_at',
|
||
paranoid: true,
|
||
comment: '站内信群表',
|
||
});
|
||
|
||
return InboxGroup;
|
||
};
|