manager.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. // 创建时间
  27. create_time: {
  28. type: Number,
  29. default: 0
  30. },
  31. // 最后登录ip
  32. login_ip: {
  33. type: String,
  34. default: ''
  35. },
  36. // 登录用户电脑信息
  37. login_info: {
  38. type: String,
  39. default: ''
  40. },
  41. // 是否可以登录 0为禁止登录
  42. can_login: {
  43. type: Number,
  44. default: 1
  45. },
  46. // 角色id
  47. role: {
  48. type: Number,
  49. default: 0
  50. },
  51. // 办事处
  52. office: {
  53. type: Number,
  54. default: 0
  55. },
  56. // 超级管理员 1为超级管理员
  57. super_admin: {
  58. type: Number,
  59. default: 0
  60. }
  61. };
  62. let model = mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));
  63. export {model as default, collectionName as collectionName};