using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.IO; using System.Text; using Sog; namespace bill_statistics { public static partial class LogWrapper { public static void LogCommInfo() { FileStream fsFile = new FileStream("./bill_out_comm.txt", FileMode.Create); StreamWriter fileWriter = new StreamWriter(fsFile, Encoding.UTF8); string strMessage = "Date\t平均在线时长(分钟)\tFacebook用户\t人均fb好友数\t平均玩牌局数\t平均倍数(不算跟牌)\t平均每桌人数\t平均身上金币\t玩牌人数\t分享次数\t赠送好友次数\t领取好友赠送次数\t邀请好友次数\t破产1次玩家数量\t2次\t3次\t破产1次新用户\t2次\t3次\t签到次数"; fileWriter.WriteLine(strMessage); foreach (KeyValuePair pair in BillAlldays.Instance.m_billAllDays) { DateTime dateTime = pair.Key; BillInfoEveryDay info = pair.Value; string strDay = string.Format("{0}/{1}/{2}", dateTime.Year, dateTime.Month, dateTime.Day); string strOnlineShare = string.Format("\t{0}\t{1}\t{2:0.0}\t{3:0.0}\t{4:0.00}\t{5:0.00}\t{6}\t{7}\t{8}\t{9}\t{10}\t{11}\t{12}" , info.GetAvgOnlineTime(1) / 60 , info.GetFaceBookUserCount(info.m_activeUser) , info.GetSnsFriendAvgCount(info.m_activeUser) , 0 , info.m_activeUser.Count> 0 ? info.m_activeUser.Values.Average(o=>o.chip):0 , info.m_GameUser.Count , info.GetShareFacebookCount(info.m_activeUser) , info.m_giveFriendChipCount , info.m_RecvFriendChipCount , info.GetInviteFacebookFriendCount(info.m_activeUser) , info.GetBrokenGrandUserCount(1) , info.GetBrokenGrandUserCount(2) , info.GetBrokenGrandUserCount(3) ); string strBrokenGrandNewUserCount = string.Format("\t{0}\t{1}\t{2}" , info.GetBrokenGrandNewUserCount(1) , info.GetBrokenGrandNewUserCount(2) , info.GetBrokenGrandNewUserCount(3)); string strSignCount = string.Format("\t{0}", info.GetSignRewardCount(info.m_activeUser)); strMessage = strDay + strOnlineShare + strBrokenGrandNewUserCount + strSignCount; fileWriter.WriteLine(strMessage); } fileWriter.Dispose(); fsFile.Dispose(); } public static void LogNewUserCommInfo() { FileStream fsFile = new FileStream("./bill_out_newUserComm.txt", FileMode.Create); StreamWriter fileWriter = new StreamWriter(fsFile, Encoding.UTF8); string strMessage = "Date\t平均在线时长(分钟)\t新进用户\tFacebook用户\t人均fb好友数\t平均玩牌局数\t平均倍数(不算跟牌)\t平均身上金币\t玩牌人数\t分享次数\t赠送好友次数\t领取好友赠送次数\t邀请好友次数\t破产1次新用户\t2次\t3次\t签到次数"; fileWriter.WriteLine(strMessage); foreach (KeyValuePair pair in BillAlldays.Instance.m_billAllDays) { DateTime dateTime = pair.Key; BillInfoEveryDay info = pair.Value; string strDay = string.Format("{0}/{1}/{2}", dateTime.Year, dateTime.Month, dateTime.Day); string strOnlineShare = string.Format("\t{0}\t{1}\t{2}\t{3:0.0}\t{4:0.0}\t{5:0.00}\t{6}\t{7}\t{8}\t{9}\t{10}\t{11}\t{12}" , info.GetAvgOnlineTime(0) / 60 , info.NewUser , info.GetFaceBookUserCount(info.m_newUser) , info.GetSnsFriendAvgCount(info.m_newUser) //, info.GetAvgDeskPlayerCount() //新用户此项去掉 , info.m_newUser.Count > 0 ? info.m_newUser.Values.Average(o => o.chip) : 0 , info.m_GameUser.Count(o=>info.m_newUser.ContainsKey(o.Key)) , info.GetShareFacebookCount(info.m_newUser) , info.m_newUserGiveFriendChipCount //////// , info.m_newUserRecvFriendChipCount , info.GetInviteFacebookFriendCount(info.m_newUser) , info.GetBrokenGrandNewUserCount(1) , info.GetBrokenGrandNewUserCount(2) , info.GetBrokenGrandNewUserCount(3) ); string strSignCount = string.Format("\t{0}", info.GetSignRewardCount(info.m_newUser)); strMessage = strDay + strOnlineShare + strSignCount; fileWriter.WriteLine(strMessage); } fileWriter.Dispose(); fsFile.Dispose(); } } }