user.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. qq: {
  25. type: String,
  26. default: ''
  27. },
  28. // 真实姓名
  29. real_name: String,
  30. // 公司
  31. company: String,
  32. // 省份
  33. province: Number,
  34. // 公司类型
  35. company_type: {
  36. type: Number,
  37. default: -1
  38. },
  39. // 公司规模
  40. company_scale: {
  41. type: Number,
  42. default: -1
  43. },
  44. // 最后登录时间
  45. latest_login: {
  46. type: Number,
  47. default: 0
  48. },
  49. //最近使用编办
  50. latest_used:String,
  51. // 创建时间
  52. create_time: {
  53. type: Number,
  54. default: 0
  55. },
  56. upgrade_list:[upgrade],
  57. user_type:{
  58. type:String,
  59. default:'normal'// normal : 普通用户,test:测试用户
  60. }
  61. };
  62. mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));