// 统计留存 private void statXDayRemain(ParamStat param, int days, ref int remainCount) { m_regeditAccList.Clear(); ChannelInfo statDay = (ChannelInfo)param.m_channel; queryRegeditAcc(param, StatBase.getRemainRegTime(statDay, days)); int regeditCount = m_regeditAccList.Count; if (regeditCount == 0) // 没有注册,此时今天的留存是0 { return; } DateTime mint = statDay.m_statDay.Date.AddDays(-1); DateTime maxt = statDay.m_statDay.Date; int count = 0; foreach (var acc in m_regeditAccList) { if (isLogin(param, ACC_KEY, acc, mint, maxt)) { count++; } } remainCount = count; }
// 统计几天前,注册玩家充值总额 private void statXDayTotalRecharge(ParamStat param, int days, ref int totalRecharge, StatResult result = null) { totalRecharge = 0; m_regeditAccList.Clear(); ChannelInfo statDay = (ChannelInfo)param.m_channel; queryRegeditAcc(param, StatBase.getRemainRegTime(statDay, days)); if (m_regeditAccList.Count == 0) // 没有注册 { return; } int playerCount = 0; IMongoQuery imq = StatBase.getRechargeCond(param, days + 1); foreach (var acc in m_regeditAccList) { int tmp = statPlayerRecharge(statDay, imq, acc); totalRecharge += tmp; if (tmp > 0) { playerCount++; } } if (days == 0) { result.m_newAccRechargePersonNum = playerCount; } }
// 更新往日LTV价值 private void updateTotalRecharge(ChannelInfo info, int days, StatResult result) { IMongoQuery imq1 = Query.EQ("genTime", StatBase.getRemainRegTime(info, days)); IMongoQuery imq2 = Query.EQ("channel", BsonValue.Create(info.m_channelNum)); IMongoQuery imq = Query.And(imq1, imq2); bool res = MongodbAccount.Instance.KeyExistsByQuery(TableName.CHANNEL_TD, imq); if (res) { Dictionary <string, object> data = new Dictionary <string, object>(); switch (days) { case 1: { data.Add("Day1TotalRecharge", result.m_1DayTotalRechargeTmp); } break; case 3: { data.Add("Day3TotalRecharge", result.m_3DayTotalRechargeTmp); } break; case 7: { data.Add("Day7TotalRecharge", result.m_7DayTotalRechargeTmp); } break; case 14: { data.Add("Day14TotalRecharge", result.m_14DayTotalRechargeTmp); } break; case 30: { data.Add("Day30TotalRecharge", result.m_30DayTotalRechargeTmp); } break; case 60: { data.Add("Day60TotalRecharge", result.m_60DayTotalRechargeTmp); } break; case 90: { data.Add("Day90TotalRecharge", result.m_90DayTotalRechargeTmp); } break; } MongodbAccount.Instance.ExecuteUpdateByQuery(TableName.CHANNEL_TD, imq, data); } }
// 查询2个列表,1是dt这一天的注册用户,2是注册账号并且付费的账号 protected void queryAccList(ParamStat param, int days) { m_regeditAccList.Clear(); m_regeditWithRecharge.Clear(); DateTime dt = StatBase.getRemainRegTime(param.m_channel, days); queryRegeditAcc(param, dt); foreach (var acc in m_regeditAccList) { if (isRecharge(param, dt, acc)) { m_regeditWithRecharge.Add(acc); } } }