user.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. deadline: {
  17. type:String,
  18. default: '',
  19. },
  20. }, { _id: false })
  21. let modelSchema = {
  22. // 用户名
  23. username: String,
  24. // 电子邮件
  25. email: String,
  26. // 手机号码
  27. mobile: String,
  28. qq: {
  29. type: String,
  30. default: ''
  31. },
  32. // 真实姓名
  33. real_name: String,
  34. // 公司
  35. company: String,
  36. // 省份
  37. province: Number,
  38. // 公司类型
  39. company_type: {
  40. type: Number,
  41. default: -1
  42. },
  43. // 公司规模
  44. company_scale: {
  45. type: Number,
  46. default: -1
  47. },
  48. // 最后登录时间
  49. latest_login: {
  50. type: Number,
  51. default: 0
  52. },
  53. //最近使用编办
  54. latest_used:String,
  55. // 创建时间
  56. create_time: {
  57. type: Number,
  58. default: 0
  59. },
  60. upgrade_list:[upgrade],
  61. user_type:{
  62. type:String,
  63. default:'normal'// normal : 普通用户,test:测试用户
  64. },
  65. online_times: {
  66. type: Number,
  67. default: 0
  68. } //最近一天的登录时长累计
  69. };
  70. mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));