manager.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 = 'manager';
  11. let modelSchema = {
  12. // 用户名
  13. username: {
  14. type: String,
  15. index: true
  16. },
  17. // 密码
  18. password: String,
  19. // token 10位随机字符串(用于加密)
  20. token: String,
  21. // 最后登录时间
  22. last_login: {
  23. type: Number,
  24. default: 0
  25. },
  26. real_name:String,
  27. // 创建时间
  28. create_time: {
  29. type: Number,
  30. default: 0
  31. },
  32. // 最后登录ip
  33. login_ip: {
  34. type: String,
  35. default: ''
  36. },
  37. // 登录用户电脑信息
  38. login_info: {
  39. type: String,
  40. default: ''
  41. },
  42. // 是否可以登录 0为禁止登录
  43. can_login: {
  44. type: Number,
  45. default: 1
  46. },
  47. // 权限
  48. permission: {
  49. type: String,
  50. default: ''
  51. },
  52. // 办事处
  53. office: {
  54. type: Number,
  55. default: 0
  56. },
  57. //职称
  58. position: {
  59. type: String,
  60. default: ''
  61. },
  62. // 超级管理员 1为超级管理员
  63. super_admin: {
  64. type: Number,
  65. default: 0
  66. }
  67. };
  68. mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));