1
This commit is contained in:
@@ -50,9 +50,26 @@ module.exports = (db) => {
|
|||||||
},
|
},
|
||||||
features: {
|
features: {
|
||||||
comment: '功能特性列表(JSON字符串数组)',
|
comment: '功能特性列表(JSON字符串数组)',
|
||||||
type: Sequelize.TEXT,
|
type: Sequelize.JSON(),
|
||||||
allowNull: false,
|
allowNull: false,
|
||||||
defaultValue: '[]'
|
defaultValue: [],
|
||||||
|
get: function () {
|
||||||
|
const value = this.getDataValue('features');
|
||||||
|
if (!value) return null;
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
return JSON.parse(value);
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
},
|
||||||
|
set: function (value) {
|
||||||
|
if (value === null || value === undefined) {
|
||||||
|
this.setDataValue('features', null);
|
||||||
|
} else if (typeof value === 'string') {
|
||||||
|
this.setDataValue('features', value);
|
||||||
|
} else {
|
||||||
|
this.setDataValue('features', JSON.stringify(value));
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
featured: {
|
featured: {
|
||||||
comment: '是否为推荐套餐(1=推荐,0=普通)',
|
comment: '是否为推荐套餐(1=推荐,0=普通)',
|
||||||
|
|||||||
Reference in New Issue
Block a user