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.

67 lines
2.7 KiB

1 month ago
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 LogLongKeep()
{
FileStream fsFile = new FileStream("./bill_out_keep_long.txt", FileMode.Create);
StreamWriter fileWriter = new StreamWriter(fsFile, Encoding.UTF8);
string strMessage = "日期\t活跃用户\t新进用户\t新进次留\t2留\t3留\t5留\t7留\t15留\t30留\t60留\t90留\t120留\t150留\t180留";
fileWriter.WriteLine(strMessage);
foreach (KeyValuePair<DateTime, BillInfoEveryDay> pair in BillAlldays.Instance.m_billAllDays)
{
DateTime dateTime = pair.Key;
BillInfoEveryDay info = pair.Value;
info.NewUser = info.m_newUserLongKeep.Count;
string strDay = string.Format("{0}/{1}/{2}\t{3}\t{4}", dateTime.Year, dateTime.Month, dateTime.Day
, info.m_activeUserLongKeep.Count, info.NewUser);
string strNewUser = "";
if (info.NewUser != 0)
{
strNewUser = string.Format("{0:0.0000}%\t{1:0.0000}%\t{2:0.0000}%\t{3:0.0000}%\t{4:0.0000}%\t{5:0.0000}%\t{6:0.0000}%\t{7:0.0000}%\t{8:0.0000}%\t{9:0.0000}%\t{10:0.0000}%\t{11:0.0000}%",
info.m_newUserRetentionInfo.Retention1 * 100.0f / info.NewUser,
info.m_newUserRetentionInfo.Retention2 * 100.0f / info.NewUser,
info.m_newUserRetentionInfo.Retention3 * 100.0f / info.NewUser,
info.m_newUserRetentionInfo.Retention5 * 100.0f / info.NewUser,
info.m_newUserRetentionInfo.Retention7 * 100.0f / info.NewUser,
info.m_newUserRetentionInfo.Retention15 * 100.0f / info.NewUser,
info.m_newUserRetentionInfo.Retention30 * 100.0f / info.NewUser,
info.m_newUserRetentionInfo.Retention60 * 100.0f / info.NewUser,
info.m_newUserRetentionInfo.Retention90 * 100.0f / info.NewUser,
info.m_newUserRetentionInfo.Retention120 * 100.0f / info.NewUser,
info.m_newUserRetentionInfo.Retention150 * 100.0f / info.NewUser,
info.m_newUserRetentionInfo.Retention180 * 100.0f / info.NewUser);
}
strMessage = string.Format("{0}\t{1}", strDay, strNewUser);
fileWriter.WriteLine(strMessage);
}
fileWriter.Dispose();
fsFile.Dispose();
}
}
}