123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144 |
- /**
- * 用户数据模型
- *
- * @author CaiAoLin
- * @date 2017/7/20
- * @version
- */
- import mongoose from "mongoose";
- let Schema = mongoose.Schema;
- let collectionName = 'users';
- const invalidSchema = new Schema({
- invalid: Boolean,
- invalidDate: String,
- invalidBy: String //管理者名
- });
- const versionSchema = new Schema({
- compilationId: String,
- activateCode: String,
- activatedDate: String,
- activatedBy: String,
- invalidInfo: [invalidSchema]
- });
- let upgrade = mongoose.Schema({
- compilationID:String,//编办ID
- upgrade_time:Number,
- isUpgrade:Boolean,
- remark:String,//描述:广东办刘飞 2018-06-17 启用/关闭
- deadline: {
- type:String,
- default: '',
- },
- }, { _id: false })
- const userdList = mongoose.Schema({
- compilationId: String
- }, {_id: false});
- let modelSchema = {
- ssoId: {
- type: Number,
- unique: true,
- },
- // 用户名
- username: String,
- // 电子邮件
- email: String,
- // 手机号码
- mobile: String,
- // qq号码
- qq: {
- type: String,
- default: ''
- },
- // 真实姓名
- real_name: {
- type: String,
- default: ''
- },
- // 公司
- company: {
- type: String,
- default: ''
- },
- // 省份
- province: {
- type: Number,
- default: -1
- },
- version: {
- type: [versionSchema],
- default: []
- },
- // 公司类型
- company_type: {
- type: Number,
- default: -1
- },
- // 公司规模
- company_scale: {
- type: Number,
- default: -1
- },
- // 最后登录时间
- latest_login: {
- type: Number,
- default: 0
- },
- //最近使用编办
- latest_used:String,
- // 创建时间
- create_time: {
- type: Number,
- default: 0
- },
- upgrade_list:[upgrade],
- user_type:{
- type:String,
- default:'normal'// normal : 普通用户,test:测试用户
- },
- //使用过的费用定额,主要目的拷贝用户在该费用定额下的一些数据模板 eg:用户第一次进入该费用定额的补充定额库时,拷贝补充定额的章节树
- used_list: {
- type: [userdList],
- default: []
- },
- // 联系人
- contacts: {
- type: Array,
- default: []
- },
- // 是否邮箱已通过验证
- isUserActive: Number,
- // 是否只允许短信登录
- isSmsLogin: {
- type: Number,
- default: 0
- },
- // 登录异常短信通知
- isLoginValid: {
- type: Number,
- default: 0
- },
- welcomeShowTime:String,
- token: String,
- online_times: {
- type: Number,
- default: 0
- }, //最近一天的登录时长累计
- all_online_times: {//所有登录时长累计
- type: Number,
- default: 0
- },
- is_cld: {
- type: Number,
- default: 0, // 0为普通用户,时间戳代表CLD剔除用户并按时间戳排序
- },
- };
- mongoose.model(collectionName, new Schema(modelSchema, {versionKey: false, collection: collectionName}));
|