'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin'); const configProp = { logo: { type: Array, zh: 'logo' }, share: { type: Array, zh: '分享图片' }, buyPoint: { type: Number, zh: '购物赠送积分' }, // 金额 / buyPoint 为实际获得积分 pointPlan: { type: Array, zh: '积分计划' }, // 后续有待制作,目前全靠新写 autoCloseOrder: { type: Number, zh: '自动关闭订单时间' }, // <=0时不自动关闭 }; const bottom_menu = { list: { type: Array, zh: '菜单列表' }, is_use: { type: String, zh: '是否使用' }, }; // 系统设置 const config = { title: { type: String, required: false, zh: '系统名称' }, // config: { type: Object, required: false, zh: '设置' }, // agree: { type: String, required: false, zh: '用户协议' }, // 富文本 bottom_title: { type: String, required: false, zh: '底部加载数据结束的文字提示' }, // bottom_menu: { type: Object, zh: '底部菜单' }, reward_day: { type: Number, zh: '提现日期', default: 14 }, leader: { type: Object, required: false , zh: '团长规则' }, // explain,rule }; const schema = new Schema(config, { toJSON: { getters: true, virtuals: true } }); schema.index({ id: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Config', schema, 'config'); };