WMS_MAIN/app/model/after_sale_keyword.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

82 lines
2.1 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';
module.exports = app => {
const { STRING, INTEGER, BIGINT, TINYINT, DATE } = app.Sequelize;
const AfterSaleKeyword = app.model.define('afterSaleKeyword', {
id: {
type: BIGINT(20).UNSIGNED,
primaryKey: true,
autoIncrement: true,
comment: '主键',
},
warehouse_id: {
type: BIGINT(20).UNSIGNED,
allowNull: true,
defaultValue: null,
comment: '仓库ID(NULL=系统级,全部仓库可见;非NULL=该仓库自定义,仅该仓库可见)',
},
sub_type_id: {
type: BIGINT(20).UNSIGNED,
allowNull: false,
comment: '售后子类型ID(关联 wms_after_sale_sub_type.id)',
},
keyword: {
type: STRING(100),
allowNull: false,
comment: '关键词,命中即映射到对应售后子类型',
},
is_system: {
type: TINYINT(1),
allowNull: false,
defaultValue: 0,
comment: '是否系统级:1=系统级(全部仓库可读,不允许编辑/删除),0=仓库自定义',
},
is_enabled: {
type: TINYINT(1),
allowNull: false,
defaultValue: 1,
comment: '是否启用:1=启用,0=停用',
},
sort_order: {
type: INTEGER(11),
allowNull: false,
defaultValue: 0,
comment: '匹配优先级,数值小者优先(同长度命中时生效)',
},
created_at: {
type: DATE,
comment: '创建时间',
},
updated_at: {
type: DATE,
comment: '更新时间',
},
}, {
tableName: 'wms_after_sale_keyword',
underscored: true,
timestamps: true,
createdAt: 'created_at',
updatedAt: 'updated_at',
paranoid: false,
comment: '售后关键词表(关键词 → 售后子类型映射)',
indexes: [
{
unique: true,
fields: [ 'keyword', 'warehouse_id' ],
name: 'uk_keyword_warehouse',
},
{
fields: [ 'sub_type_id' ],
name: 'idx_sub_type_id',
},
{
fields: [ 'warehouse_id' ],
name: 'idx_warehouse_id',
},
],
});
return AfterSaleKeyword;
};