rentease-backend-new/models/PricingConfig.js

67 lines
1.6 KiB
JavaScript
Raw Permalink Normal View History

2026-04-20 06:43:09 +00:00
const { DataTypes } = require('sequelize');
const sequelize = require('../config/db');
const PricingConfig = sequelize.define('PricingConfig', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true,
comment: 'ID'
},
// 注意:混合计费模式下,基础费用来自套餐的 monthlyPrice
// 此表只配置超额使用的单价
overageApartmentPrice: {
type: DataTypes.DECIMAL(10, 2),
defaultValue: 10.00,
comment: '超额公寓单价(每栋/月)'
},
overageRoomPrice: {
type: DataTypes.DECIMAL(10, 2),
defaultValue: 2.00,
comment: '超额房间单价(每间/月)'
},
overageUserPrice: {
type: DataTypes.DECIMAL(10, 2),
defaultValue: 5.00,
comment: '超额用户单价(每人/月)'
},
currency: {
type: DataTypes.STRING(10),
defaultValue: 'CNY',
comment: '货币'
},
effectiveDate: {
type: DataTypes.DATE,
defaultValue: DataTypes.NOW,
comment: '生效日期'
},
isActive: {
type: DataTypes.BOOLEAN,
defaultValue: true,
comment: '是否生效'
},
isDeleted: {
type: DataTypes.INTEGER,
defaultValue: 0,
comment: '删除状态0未删除1已删除'
},
createTime: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
comment: '创建时间'
},
updateTime: {
type: DataTypes.DATE,
allowNull: false,
defaultValue: DataTypes.NOW,
comment: '更新时间'
}
}, {
tableName: 'pricing_configs',
timestamps: false,
comment: '定价配置表'
});
module.exports = PricingConfig;