user.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /**
  2. * 用户数据模型
  3. *
  4. * @author CaiAoLin
  5. * @date 2017/7/20
  6. * @version
  7. */
  8. import mongoose from "mongoose";
  9. let Schema = mongoose.Schema;
  10. let collectionName = 'users';
  11. let upgrade = mongoose.Schema({
  12. compilationID:String,//编办ID
  13. upgrade_time:Number,
  14. isUpgrade:Boolean,
  15. remark:String//描述:广东办刘飞 2018-06-17 启用/关闭
  16. }, { _id: false })
  17. let modelSchema = {
  18. // 用户名
  19. username: String,
  20. // 电子邮件
  21. email: String,
  22. // 手机号码
  23. mobile: String,
  24. // 真实姓名
  25. real_name: String,
  26. // 公司
  27. company: String,
  28. // 省份
  29. province: Number,
  30. // 公司类型
  31. company_type: {
  32. type: Number,
  33. default: -1
  34. },
  35. // 公司规模
  36. company_scale: {
  37. type: Number,
  38. default: -1
  39. },
  40. // 最后登录时间
  41. last_login: {
  42. type: Number,
  43. default: 0
  44. },
  45. // 创建时间
  46. create_time: {
  47. type: Number,
  48. default: 0
  49. },
  50. upgrade_list:[upgrade],
  51. user_type:{
  52. type:String,
  53. default:'normal'// normal : 普通用户,test:测试用户
  54. }
  55. };
  56. mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));