manager.js 1.4 KB

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