'use strict'; module.exports = app => { const mongoose = app.mongoose; const Schema = mongoose.Schema; const conn = app.mongooseDB.get('etlLocalDB'); // 用户信息 本地清洗 数据结构 const TRbacUserSchema = 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 }, // 用户总数 newTotal: { type: Number }, // 用户增量 sexAndAgeTotal: [// 性别和年龄统计 { _id: { type: String }, // 分段 fCount: { type: Number }, // 男数量 mCount: { type: Number }, // 女数量 count: { type: Number }, // 总数 }, ], appTotal: { type: Number }, // app用户总数 appSexAndAgeTotal: [// app性别和年龄统计 { _id: { type: String }, // 分段 fCount: { type: Number }, // 男数量 mCount: { type: Number }, // 女数量 count: { type: Number }, // 总数 }, ], newAppTotal: { type: Number }, // app新增用户总数 newAppSexAndAgeTotal: [// app新增性别和年龄统计 { _id: { type: String }, // 分段 fCount: { type: Number }, // 男数量 mCount: { type: Number }, // 女数量 count: { type: Number }, // 总数 }, ], activeAppTotal: { type: Number }, // app 日活跃用户总数 activeAppMonth: { type: Number }, // app 月活跃用户总数 activeAppYear: { type: Number }, // app 年活跃用户总数 activeAppSexAndAgeTotal: [// app活跃性别和年龄统计 { _id: { type: String }, // 分段 fCount: { type: Number }, // 男数量 mCount: { type: Number }, // 女数量 count: { type: Number }, // 总数 }, ], iviTotal: { type: Number }, // ivi用户总数 iviSexAndAgeTotal: [// ivi性别和年龄统计 { _id: { type: String }, // 分段 fCount: { type: Number }, // 男数量 mCount: { type: Number }, // 女数量 count: { type: Number }, // 总数 }, ], newIviTotal: { type: Number }, // ivi新增用户总数 newIviSexAndAgeTotal: [// ivi新增性别和年龄统计 { _id: { type: String }, // 分段 fCount: { type: Number }, // 男数量 mCount: { type: Number }, // 女数量 count: { type: Number }, // 总数 }, ], activeIviTotal: { type: Number }, // ivi 日活跃用户总数 activeIviMonth: { type: Number }, // ivi 月活跃用户总数 activeIviYear: { type: Number }, // ivi 年活跃用户总数 activeIviSexAndAgeTotal: [// ivi活跃性别和年龄统计 { _id: { type: String }, // 分段 fCount: { type: Number }, // 男数量 mCount: { type: Number }, // 女数量 count: { type: Number }, // 总数 }, ], saledTotal: { type: Number }, // 实销, saledAppTotal: { type: Number }, // app实销, saledIviTotal: { type: Number }, // ivi实销, }); TRbacUserSchema.index({ create_date: -1 }); return conn.model('TRbacUser', TRbacUserSchema, 'lc_t_rbac_user'); };