You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
409 lines
10 KiB
409 lines
10 KiB
1 month ago
|
/*
|
||
|
每天的数据
|
||
|
活跃
|
||
|
新增
|
||
|
付费
|
||
|
*/
|
||
|
|
||
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Threading.Tasks;
|
||
|
using System.IO;
|
||
|
using System.Text;
|
||
|
|
||
|
|
||
|
using Google.Protobuf.WellKnownTypes;
|
||
|
namespace bill_statistics
|
||
|
{
|
||
|
public partial class BillInfoEveryDay
|
||
|
{
|
||
|
public BillInfoEveryDay()
|
||
|
{
|
||
|
for (int i=0; i< m_treasureItemDrawUserCount.Length; i++)
|
||
|
{
|
||
|
m_treasureItemDrawUserCount[i] = new Dictionary<int, int>();
|
||
|
}
|
||
|
|
||
|
|
||
|
//foreach(var desc in DiamondChipExchangeDescMgr.Instance.ItemTable)
|
||
|
//{
|
||
|
// m_DiamondChipExchangeTable.Add(desc.Value.ID, 0);
|
||
|
//}
|
||
|
}
|
||
|
|
||
|
public void AddOnlineUser(int hour, int userNum)
|
||
|
{
|
||
|
if (0 <= hour && hour <= 23 && userNum > 0)
|
||
|
{
|
||
|
m_onlineUser[hour] += userNum;
|
||
|
m_onlineCnt[hour]++;
|
||
|
|
||
|
if (MaxOnline < userNum)
|
||
|
{
|
||
|
MaxOnline = userNum;
|
||
|
}
|
||
|
|
||
|
m_onlineBillTotal += userNum;
|
||
|
m_onlineBillCount++;
|
||
|
|
||
|
AvgOnlineADay = m_onlineBillTotal/m_onlineBillCount;
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public int GetSignRewardCount(Dictionary<int, UserInfo> user)
|
||
|
{
|
||
|
int iCount = 0;
|
||
|
foreach (KeyValuePair<int, UserInfo> pair in user)
|
||
|
{
|
||
|
if (pair.Value.bGetSignReward == true)
|
||
|
{
|
||
|
iCount++;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return iCount;
|
||
|
}
|
||
|
|
||
|
public int GetFaceBookUserCount(Dictionary<int, UserInfo> user)
|
||
|
{
|
||
|
int iCount = 0;
|
||
|
foreach (KeyValuePair<int, UserInfo> pair in user)
|
||
|
{
|
||
|
if (pair.Value.AccType == 1)
|
||
|
{
|
||
|
iCount++;
|
||
|
}
|
||
|
}
|
||
|
return iCount;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
public double GetSnsFriendAvgCount(Dictionary<int, UserInfo> user , int day = 0)
|
||
|
{
|
||
|
var list = user.Where(o => o.Value.AccType == 1 && o.Value.playDay >= day);
|
||
|
if (list.Count() > 0)
|
||
|
{
|
||
|
return 1.00 * list.Sum(o => o.Value.snsFriendCount) / list.Count();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
return 0.0;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
public bool IsFaceBookUser(int uid)
|
||
|
{
|
||
|
if (m_activeUser.ContainsKey(uid))
|
||
|
{
|
||
|
return (m_activeUser[uid].AccType == 1);
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
|
||
|
public int IsGetSignReward(int uid)
|
||
|
{
|
||
|
if (m_activeUser.ContainsKey(uid))
|
||
|
{
|
||
|
return m_activeUser[uid].bGetSignReward ? 1 : 0;
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
public int GetFBFriendCount(int uid)
|
||
|
{
|
||
|
if(m_activeUser.ContainsKey(uid) && m_activeUser[uid].AccType == 1)
|
||
|
{
|
||
|
return m_activeUser[uid].snsFriendCount;
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
public int GetAvgOnlineTime(int user)
|
||
|
{
|
||
|
int iTime = 0;
|
||
|
if (user == 1)
|
||
|
{
|
||
|
if (m_activeUser.Count > 0)
|
||
|
iTime = m_OnlineTimeSum/ m_activeUser.Count();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (m_newUser.Count > 0)
|
||
|
iTime = m_newUserOnlineTimeSum / m_newUser.Count();
|
||
|
}
|
||
|
|
||
|
|
||
|
return iTime;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
public int GetAvgUserNum(int hour)
|
||
|
{
|
||
|
if (0 <= hour && hour <= 23 && m_onlineCnt[hour] > 0)
|
||
|
{
|
||
|
return m_onlineUser[hour]/m_onlineCnt[hour];
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
public void AddShareFacebook(int uid, int rewardId)
|
||
|
{
|
||
|
if (m_activeUser.ContainsKey(uid))
|
||
|
{
|
||
|
m_activeUser[uid].ShareFBCount++;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
if (rewardId > 0)
|
||
|
{
|
||
|
if (m_ShareFBTypeCount.ContainsKey(rewardId))
|
||
|
{
|
||
|
m_ShareFBTypeCount[rewardId]++;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
m_ShareFBTypeCount[rewardId] = 1;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public int GetShareFBUserCount()
|
||
|
{
|
||
|
int iCount = 0;
|
||
|
foreach (var pair in m_activeUser)
|
||
|
{
|
||
|
if(pair.Value.ShareFBCount > 0)
|
||
|
{
|
||
|
iCount++;
|
||
|
}
|
||
|
}
|
||
|
return iCount;
|
||
|
}
|
||
|
public int GetShareFacebookCount(Dictionary<int, UserInfo> user)
|
||
|
{
|
||
|
int iCount = 0;
|
||
|
foreach (var pair in user)
|
||
|
{
|
||
|
iCount += pair.Value.ShareFBCount;
|
||
|
}
|
||
|
return iCount;
|
||
|
}
|
||
|
|
||
|
public int GetShareFBTypeCount(int type)
|
||
|
{
|
||
|
if (m_ShareFBTypeCount.ContainsKey(type) == true)
|
||
|
{
|
||
|
return m_ShareFBTypeCount[type];
|
||
|
}
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
public void AddGiveFriendChipDaily(int uid, int recvUid)
|
||
|
{
|
||
|
m_giveFriendChipCount++;
|
||
|
if (m_newUser.ContainsKey(uid))
|
||
|
{
|
||
|
m_newUserGiveFriendChipCount++;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
public void AddInviteFacebook(int uid, int iCount)
|
||
|
{
|
||
|
if (m_activeUser.ContainsKey(uid))
|
||
|
{
|
||
|
m_activeUser[uid].InviteFBFriendCount = iCount;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public int GetInviteFacebookFriendCount(Dictionary<int, UserInfo> user)
|
||
|
{
|
||
|
int iCount = 0;
|
||
|
foreach (var pair in user)
|
||
|
{
|
||
|
if (pair.Value.InviteFBFriendCount > 0)
|
||
|
{
|
||
|
iCount += pair.Value.InviteFBFriendCount;
|
||
|
}
|
||
|
}
|
||
|
return iCount;
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
public void AddFocusFacebook(int uid)
|
||
|
{
|
||
|
m_FocusFacebook++;
|
||
|
}
|
||
|
|
||
|
|
||
|
public void AddFinishNewbitStep(int uid, int step)
|
||
|
{
|
||
|
if (m_newUser.ContainsKey(uid))
|
||
|
{
|
||
|
m_newUser[uid].iFinishNewbieStep = step;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public bool IsFinishNewbieGuide(int uid)
|
||
|
{
|
||
|
bool bFin = false;
|
||
|
if (m_newUser.ContainsKey(uid))
|
||
|
bFin = m_newUser[uid].iFinishNewbieStep >= 45;
|
||
|
|
||
|
return bFin;
|
||
|
}
|
||
|
|
||
|
public int GetFinishNewbitStep(int uid)
|
||
|
{
|
||
|
int iStep = 0;
|
||
|
if (m_newUser.ContainsKey(uid))
|
||
|
iStep = m_newUser[uid].iFinishNewbieStep;
|
||
|
|
||
|
return iStep;
|
||
|
}
|
||
|
|
||
|
public int AddTreasureBuy(int uid, int id, int totalcount)
|
||
|
{
|
||
|
if(m_tmpTreasureUser.ContainsKey(uid) == false)
|
||
|
{
|
||
|
m_tmpTreasureUser.Add(uid, 1);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
m_tmpTreasureUser[uid]++;
|
||
|
}
|
||
|
|
||
|
if (id >= 0 && id < m_treasureItemDrawCount.Length)
|
||
|
{
|
||
|
if(m_treasureItemDrawUserCount[id].ContainsKey(uid) == false)
|
||
|
{
|
||
|
m_treasureItemDrawUserCount[id].Add(uid, totalcount);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
m_treasureItemDrawUserCount[id][uid] = totalcount;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
public int AddTreasure(int id, int prizeIndex, long prizeUid)
|
||
|
{
|
||
|
if(id >= 0 && id < m_treasureItemDrawCount.Length)
|
||
|
{
|
||
|
m_treasureItemDrawCount[id]++;
|
||
|
}
|
||
|
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
public void AddYuXiaXiePlay(int uid)
|
||
|
{
|
||
|
if (m_activeUser.ContainsKey(uid))
|
||
|
{
|
||
|
m_activeUser[uid].PlayYuXiaXieCount++;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
public void AddFriendInfo(int uid, int friendCount, int snsFriendCount, int day)
|
||
|
{
|
||
|
if (m_activeUser.ContainsKey(uid))
|
||
|
{
|
||
|
m_activeUser[uid].friendCount = friendCount;
|
||
|
|
||
|
if(m_activeUser[uid].AccType == 1)
|
||
|
{
|
||
|
m_activeUser[uid].snsFriendCount = snsFriendCount;
|
||
|
if (day != -1)
|
||
|
{
|
||
|
m_activeUser[uid].playDay = day;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void ReadMailStart(int uid, int mailType)
|
||
|
{
|
||
|
if(mailType == 14)
|
||
|
{
|
||
|
if (m_activeUser.ContainsKey(uid))
|
||
|
{
|
||
|
m_activeUser[uid].InviteSuccessInviteeRewardCount++;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void AddAdjustInstallReport(string channel, string fullchannel, string adid)
|
||
|
{
|
||
|
UserChannelInfo info = null;
|
||
|
if (m_userChannelInfo.ContainsKey(channel))
|
||
|
{
|
||
|
info = m_userChannelInfo[channel];
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
info = new UserChannelInfo();
|
||
|
m_userChannelInfo.Add(channel, info);
|
||
|
}
|
||
|
|
||
|
info.InstallCount++;
|
||
|
|
||
|
if(channel != fullchannel)
|
||
|
{
|
||
|
info = null;
|
||
|
if (m_userChannelInfo.ContainsKey(fullchannel))
|
||
|
{
|
||
|
info = m_userChannelInfo[fullchannel];
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
info = new UserChannelInfo();
|
||
|
m_userChannelInfo.Add(fullchannel, info);
|
||
|
}
|
||
|
|
||
|
info.InstallCount++;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
public void AddRetentionOptimizetion(int day,int push1,int succ1, int push2, int succ2,int twice,int total,int totalsucc)
|
||
|
{
|
||
|
if(!optimizedata.ContainsKey(day))
|
||
|
{
|
||
|
optimizedata.Add(day, new optimizetionResult { day = day });
|
||
|
|
||
|
}
|
||
|
|
||
|
if (push1 > 0) { optimizedata[day].push1 = push1; }
|
||
|
if (succ1 > 0) { optimizedata[day].succ1 = succ1; }
|
||
|
if (push2 > 0) { optimizedata[day].push2 = push2; }
|
||
|
if (succ2 > 0) { optimizedata[day].succ2 = succ2; }
|
||
|
}
|
||
|
|
||
|
public void AddHorsePlay(int uid)
|
||
|
{
|
||
|
if (m_activeUser.ContainsKey(uid))
|
||
|
{
|
||
|
m_activeUser[uid].PlayHorseCount++;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|