123456789101112131415161718192021222324252627282930313233343536373839 |
- 'use strict';
- module.exports = app => {
- const mongoose = app.mongoose;
- const Schema = mongoose.Schema;
- const conn = app.mongooseDB.get('etlDB');
- // IVI登录埋点数据,记录用户每次登陆记录
- const IviOnlineUserSchema = new Schema({
- _id: { type: String }, // 主键,用户ID+年月日拼接+序号
- user_id: { type: String }, // 用户ID
- user_name: { type: String }, // 登录账号
- user_mobileno: { type: String }, // 登录手机号
- vin: { type: String }, // vin
- role_id: { type: String },
- // owner 是车主,common是使用人,guest是潜客(粉丝)
- login_time: { type: Number }, // 登录时间戳
- longitude: { type: Number }, // 登录位置-经度
- latitude: { type: Number }, // 登录位置-纬度
- // area_code: { type: String }, // 登录位置-地区编码
- // area_name: { type: String }, // 登录位置-地区名称
- // provice_code: { type: String }, // 登录位置-省份编码
- provice_name: { type: String }, // 登录位置-省份名称
- // city_code: { type: String }, // 登录位置-城市编码
- city_name: { type: String }, // 登录位置-城市名称
- county_code: { type: String }, // 登录位置-行政区编码
- county_name: { type: String }, // 登录位置-行政区名称
- // series_code: { type: String }, // 车系编码
- // series_name: { type: String }, // 车系名称
- login_mode: { type: Number }, // 登录方式 (1:人脸、2:声纹、3:密码、4:验证码、5:二维码)
- // FACE/SOUND/PASSWORD/VERIFICATION_CODE/QR
- login_state: { type: Number }, // 登录状态 (1:成功、2:失败)
- });
- IviOnlineUserSchema.index({ login_time: -1 });
- IviOnlineUserSchema.index({ login_time: -1, login_state: -1 });
- IviOnlineUserSchema.index({ login_time: -1, login_state: -1, user_id: -1 });
- IviOnlineUserSchema.index({ login_time: -1, login_state: -1, user_id: -1, provice_name: -1, city_name: -1 });
- IviOnlineUserSchema.index({ login_time: -1, login_mode: -1 });
- IviOnlineUserSchema.index({ login_time: -1, role_id: -1 });
- return conn.model('IviOnlineUser', IviOnlineUserSchema, 'ivi_online_user');
- };
|