WMS_MAIN/app/model/inbox_group.js
liufumingren c2a761ca26 feat(inbox): 新增开门/到货/进场/离场车牌登记与 extend_props 持久化
- functions 新增 openDoor/registerLicensePlate/enter/departure(规则表+权限分组)
- 到货登记表 wms_inbox_arrival_register(含消费字段,离场闭环,货主收货群优先推送)
- 回执 extend_props 持久化落库与定时补发送下发(重推兜底回读)
- 车牌提取正则兼容异体字(粤/粵)
- 售后类型/关键字/函数/回复 v2 模型与迁移
- INBOX V2 HTTP 测试报告与指南
2026-09-17 02:41:43 +08:00

123 lines
3.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

'use strict';
/**
* 站内信群表 Model。
* 记录与 WMS 交互的群信息,支持按仓库屏蔽。
*
* @param {Object} app Egg.js Application 实例。
* @return {Object} Sequelize Model 定义。
*/
module.exports = app => {
const { BIGINT, STRING, TINYINT, DATE, JSON: JSON_TYPE } = 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=开启',
},
template_reply_enabled: {
type: TINYINT(1),
allowNull: false,
defaultValue: 0,
comment: '是否启用模板消息回复: 0=关闭(普通文本回复) 1=开启(模板消息回复)',
},
express_interfaces: {
type: STRING(500),
allowNull: true,
comment: '快递接口ID列表,逗号分隔(仅群类型为 express 时生效)',
},
system_express_code: {
type: STRING(50),
allowNull: true,
comment: '系统快递编码(仅群类型为 express 时必填)',
},
ext_data: {
type: JSON_TYPE,
allowNull: true,
comment: '群扩展数据(IM平台信息等)',
},
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: '站内信群表',
indexes: [
// 群唯一性以 (warehouse_id, group_id) 为准,群名称变化只更新不建新
{ name: 'uk_warehouse_group_id', unique: true, fields: [ 'warehouse_id', 'group_id' ] },
{ name: 'idx_group_id', fields: [ 'group_id' ] },
],
});
return InboxGroup;
};