12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- /**
- * 后台管理用户数据模型
- *
- * @author CaiAoLin
- * @date 2017/7/20
- * @version
- */
- import mongoose from "mongoose";
- let Schema = mongoose.Schema;
- let collectionName = 'manager';
- let modelSchema = {
- // 用户名
- username: {
- type: String,
- index: true
- },
- // 密码
- password: String,
- // token 10位随机字符串(用于加密)
- token: String,
- // 最后登录时间
- last_login: {
- type: Number,
- default: 0
- },
- // 创建时间
- create_time: {
- type: Number,
- default: 0
- },
- // 最后登录ip
- login_ip: {
- type: String,
- default: ''
- },
- // 登录用户电脑信息
- login_info: {
- type: String,
- default: ''
- },
- // 是否可以登录 0为禁止登录
- can_login: {
- type: Number,
- default: 1
- },
- // 角色id
- role: {
- type: Number,
- default: 0
- },
- // 办事处
- office: {
- type: Number,
- default: 0
- },
- // 超级管理员 1为超级管理员
- super_admin: {
- type: Number,
- default: 0
- }
- };
- let model = mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));
- export {model as default, collectionName as collectionName};
|