12345678910111213141516171819202122232425262728293031323334353637383940 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const moment = require('moment');
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- const { ObjectId } = require('mongoose').Types;
- // 科教之旅-订单表
- const kjzl_order = {
- medium_id: { type: ObjectId }, // 机构id
- openid: { type: String }, // 微信openid
- project: { type: Object }, // 服务项目
- contact: { type: String }, // 联系人
- phone: { type: String }, // 联系电话
- email: { type: String }, // 邮件
- server_time: { type: String }, // 服务时间
- remark: { type: String }, // 预约备注
- type: { type: String }, // 服务类型
- invoice: { type: String }, // 开具发票
- company: { type: String }, // 公司名称
- number: { type: String }, // 纳税人识别号
- status: { type: String, default: '0' }, // 状态:0-预约;1-完成
- };
- const schema = new Schema(kjzl_order, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ medium_id: 1 });
- schema.index({ openid: 1 });
- schema.index({ project: 1 });
- schema.index({ contact: 1 });
- schema.index({ phone: 1 });
- schema.index({ server_time: 1 });
- schema.index({ type: 1 });
- schema.index({ invoice: 1 });
- schema.index({ company: 1 });
- schema.index({ number: 1 });
- schema.index({ status: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Kjzl_order', schema, 'kjzl_order');
- };
|