- external_print_platforms 新增 has_own_waybill(默认 0),同步接口契约与前端类型 - 自带运单的平台取号时复用平台已确认运单号(WaybillCodes),只重新拉取打印数据,不分配新面单 - 平台属性查询补齐 has_own_waybill,更新店管家取号文档并补测试 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
37 lines
1.8 KiB
JavaScript
37 lines
1.8 KiB
JavaScript
'use strict';
|
||
|
||
/**
|
||
* 外部打单平台模型,对应 external_print_platforms 表。
|
||
* 平台字典由开发者维护(随打单/取号适配逻辑一起通过迁移写入),前端只读;
|
||
* fetch_waybill_no 固化「是否回打单平台取号」,程序按 code 选择对应适配实现。
|
||
* @param {Egg.Application} app egg application
|
||
* @return {object} externalPrintPlatform model
|
||
*/
|
||
module.exports = app => {
|
||
const { BIGINT, STRING, TINYINT, INTEGER, DATE } = app.Sequelize;
|
||
|
||
const ExternalPrintPlatform = app.model.define('external_print_platform', {
|
||
id: { type: BIGINT.UNSIGNED, primaryKey: true, autoIncrement: true, comment: '主键' },
|
||
code: { type: STRING(50), allowNull: false, comment: '平台标识,程序按此选择打单/取号适配逻辑' },
|
||
name: { type: STRING(100), allowNull: false, comment: '平台名称' },
|
||
url: { type: STRING(255), comment: '平台链接地址' },
|
||
fetch_waybill_no: { type: TINYINT, allowNull: false, defaultValue: 0, comment: '是否回打单平台取号:1是 0否' },
|
||
has_own_waybill: {
|
||
type: TINYINT,
|
||
allowNull: false,
|
||
defaultValue: 0,
|
||
comment: '是否自带运单:1是(取号时复用平台已有运单号,不分配新面单) 0否',
|
||
},
|
||
sort: { type: INTEGER, allowNull: false, defaultValue: 0, comment: '排序,越小越靠前' },
|
||
status: { type: TINYINT, allowNull: false, defaultValue: 1, comment: '状态:1启用 0禁用' },
|
||
created_at: { type: DATE, comment: '创建时间' },
|
||
updated_at: { type: DATE, comment: '更新时间' },
|
||
});
|
||
|
||
ExternalPrintPlatform.associate = () => {
|
||
app.model.ExternalPrintPlatform.hasMany(app.model.ExternalPrintAccount, { foreignKey: 'platform_id', as: 'accounts' });
|
||
};
|
||
|
||
return ExternalPrintPlatform;
|
||
};
|