123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- 'use strict';
- module.exports = app => {
- const mongoose = app.mongoose;
- const Schema = mongoose.Schema;
- const conn = app.mongooseDB.get('etlLocalDB');
- // 在线用户数据 (包含 app在线+tbox在线) 本地清洗 数据结构
- const OnlineUserSchema = new Schema({
- create_date: { type: Number }, // 统计的数据是哪一天的
- year: { type: Number }, // 年 统计的数据
- month: { type: Number }, // 月 统计的数据
- day: { type: Number }, // 日 统计的数据
- dateString: { type: String }, // 时间字符串 yyyy-MM-dd
- start_time: { type: Date }, // 开始统计时间
- end_time: { type: Date, default: Date.now }, // 结束统计时间
- total: { type: Number }, // 在线总数(APP+TBOX)
- appYear: { type: Number }, // app当年在线总数 去重
- tBoxYear: { type: Number }, // tbox当年在线总数 去重
- appTotal: { type: Number }, // APP在线总数
- tBoxTotal: { type: Number }, // TBOX在线总数
- appPlace: [
- {
- area_name: { type: String },
- provinces: [
- {
- provice_name: { type: String },
- cities: [
- {
- city_name: { type: String },
- count: { type: Number },
- },
- ],
- count: { type: Number },
- },
- ],
- count: { type: Number },
- },
- ], // app在线分布
- tBoxPlace: [
- {
- area_name: { type: String },
- provinces: [
- {
- provice_name: { type: String },
- cities: [
- {
- city_name: { type: String },
- count: { type: Number },
- },
- ],
- count: { type: Number },
- },
- ],
- count: { type: Number },
- },
- ], // TBox在线分布
- appLocation: [
- {
- area_name: { type: String },
- provinces: [
- {
- provice_name: { type: String },
- cities: [
- {
- city_name: { type: String },
- count: { type: Number },
- },
- ],
- count: { type: Number },
- },
- ],
- count: { type: Number },
- },
- ], // app位置
- appNewLocation: [
- {
- area_name: { type: String },
- provinces: [
- {
- provice_name: { type: String },
- cities: [
- {
- city_name: { type: String },
- count: { type: Number },
- },
- ],
- count: { type: Number },
- },
- ],
- count: { type: Number },
- },
- ], // app新增位置
- appActiveLocation: [
- {
- area_name: { type: String },
- provinces: [
- {
- provice_name: { type: String },
- cities: [
- {
- city_name: { type: String },
- count: { type: Number },
- },
- ],
- count: { type: Number },
- },
- ],
- count: { type: Number },
- },
- ], // app活跃位置
- iviLocation: [
- {
- area_name: { type: String },
- provinces: [
- {
- provice_name: { type: String },
- cities: [
- {
- city_name: { type: String },
- count: { type: Number },
- },
- ],
- count: { type: Number },
- },
- ],
- count: { type: Number },
- },
- ], // ivi位置
- iviNewLocation: [
- {
- area_name: { type: String },
- provinces: [
- {
- provice_name: { type: String },
- cities: [
- {
- city_name: { type: String },
- count: { type: Number },
- },
- ],
- count: { type: Number },
- },
- ],
- count: { type: Number },
- },
- ], // ivi新增位置
- iviActiveLocation: [
- {
- area_name: { type: String },
- provinces: [
- {
- provice_name: { type: String },
- cities: [
- {
- city_name: { type: String },
- count: { type: Number },
- },
- ],
- count: { type: Number },
- },
- ],
- count: { type: Number },
- },
- ], // ivi活跃位置
- faceTotal: { type: Number }, // 人脸登录总数
- voiceTotal: { type: Number }, // 声纹登录总数
- pwdTotal: { type: Number }, // 密码登录总数
- codeTotal: { type: Number }, // 验证码登录总数
- scanTotal: { type: Number }, // 二维码登录总数
- iviTotal: { type: Number }, // ivi登录总数
- carTotal: { type: Number }, // 车主登录总数
- commonTotal: { type: Number }, // 普通用户角色登录总数
- guestTotal: { type: Number }, // guest角色登录总数
- successTotal: { type: Number }, // 登录成功总数
- failTotal: { type: Number }, // 登录失败总数
- });
- OnlineUserSchema.index({ create_date: -1 });
- return conn.model('OnlineUser', OnlineUserSchema, 'lc_online_user');
- };
|