kjzl_order.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. 'use strict';
  2. const Schema = require('mongoose').Schema;
  3. const moment = require('moment');
  4. const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
  5. const { ObjectId } = require('mongoose').Types;
  6. // 科教之旅-订单表
  7. const kjzl_order = {
  8. medium_id: { type: ObjectId }, // 机构id
  9. openid: { type: String }, // 微信openid
  10. project: { type: Object }, // 服务项目
  11. contact: { type: String }, // 联系人
  12. phone: { type: String }, // 联系电话
  13. email: { type: String }, // 邮件
  14. server_time: { type: String }, // 服务时间
  15. remark: { type: String }, // 预约备注
  16. type: { type: String }, // 服务类型
  17. invoice: { type: String }, // 开具发票
  18. company: { type: String }, // 公司名称
  19. number: { type: String }, // 纳税人识别号
  20. status: { type: String, default: '0' }, // 状态:0-预约;1-完成
  21. };
  22. const schema = new Schema(kjzl_order, { toJSON: { virtuals: true } });
  23. schema.index({ id: 1 });
  24. schema.index({ medium_id: 1 });
  25. schema.index({ openid: 1 });
  26. schema.index({ project: 1 });
  27. schema.index({ contact: 1 });
  28. schema.index({ phone: 1 });
  29. schema.index({ server_time: 1 });
  30. schema.index({ type: 1 });
  31. schema.index({ invoice: 1 });
  32. schema.index({ company: 1 });
  33. schema.index({ number: 1 });
  34. schema.index({ status: 1 });
  35. schema.index({ 'meta.createdAt': 1 });
  36. schema.plugin(metaPlugin);
  37. module.exports = app => {
  38. const { mongoose } = app;
  39. return mongoose.model('Kjzl_order', schema, 'kjzl_order');
  40. };