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.
255 lines
16 KiB
255 lines
16 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace bill_statistics
|
|
{
|
|
public static class WriteBillAllToExport
|
|
{
|
|
public static void WriteAllAndExportIfNeed()
|
|
{
|
|
|
|
|
|
//导出到数据库,入库后31天
|
|
if (BillMode.Mode == BillModeType.EXPROT_DAY_STAT
|
|
|| BillMode.Mode == BillModeType.EXPROT_ALL_DAY
|
|
|| BillMode.Mode == BillModeType.EXPROT_TODAY_STAT)
|
|
{
|
|
int i = 0;
|
|
int startIndex = 1;
|
|
|
|
if (BillMode.Mode == BillModeType.EXPROT_DAY_STAT)
|
|
{
|
|
int dayCount = BillAlldays.Instance.m_billAllDays.Count;
|
|
startIndex = dayCount - 31;
|
|
if (startIndex < 0)
|
|
{
|
|
startIndex = 1;
|
|
}
|
|
}
|
|
|
|
foreach (KeyValuePair<DateTime, BillInfoEveryDay> pair in BillAlldays.Instance.m_billAllDays)
|
|
{
|
|
i++;
|
|
Console.WriteLine("----{0}", pair.Key);
|
|
//只入库最近30天的数据
|
|
if (i < startIndex)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
|
|
|
|
ActiveData_userNewAdd newUserData = new ActiveData_userNewAdd();
|
|
newUserData.dateId = pair.Key;
|
|
newUserData.newAddU = pair.Value.NewUser;
|
|
|
|
newUserData.retentionU_1 = pair.Value.m_newUserRetentionInfo.Retention1;
|
|
newUserData.retentionU_2 = pair.Value.m_newUserRetentionInfo.Retention2;
|
|
newUserData.retentionU_3 = pair.Value.m_newUserRetentionInfo.Retention3;
|
|
newUserData.retentionU_4 = pair.Value.m_newUserRetentionInfo.Retention4;
|
|
newUserData.retentionU_5 = pair.Value.m_newUserRetentionInfo.Retention5;
|
|
newUserData.retentionU_6 = pair.Value.m_newUserRetentionInfo.Retention6;
|
|
newUserData.retentionU_7 = pair.Value.m_newUserRetentionInfo.Retention7;
|
|
|
|
newUserData.retentionU_15 = pair.Value.m_newUserRetentionInfo.Retention15;
|
|
newUserData.retentionU_30 = pair.Value.m_newUserRetentionInfo.Retention30;
|
|
|
|
ExportToMysql.Instance.AddOneDailyNewAddUserInfo(newUserData);
|
|
|
|
ActiveData_userActive actUserData = new ActiveData_userActive();
|
|
actUserData.dateId = pair.Key;
|
|
actUserData.newU = pair.Value.NewUser;
|
|
actUserData.oldU = pair.Value.ActiveUser - pair.Value.NewUser;
|
|
actUserData.dayActU = pair.Value.ActiveUser;
|
|
|
|
actUserData.retentionU_1 = pair.Value.ActRetention1;
|
|
actUserData.retentionU_2 = pair.Value.ActRetention2;
|
|
actUserData.retentionU_3 = pair.Value.ActRetention3;
|
|
actUserData.retentionU_4 = pair.Value.ActRetention4;
|
|
actUserData.retentionU_5 = pair.Value.ActRetention5;
|
|
actUserData.retentionU_6 = pair.Value.ActRetention6;
|
|
actUserData.retentionU_7 = pair.Value.ActRetention7;
|
|
|
|
actUserData.retentionU_15 = pair.Value.ActRetention15;
|
|
actUserData.retentionU_30 = pair.Value.ActRetention30;
|
|
|
|
ExportToMysql.Instance.AddOneDailyActiveUserInfo(actUserData);
|
|
|
|
IncomeData_daily incomeData = new IncomeData_daily();
|
|
incomeData.dateId = pair.Key;
|
|
|
|
incomeData.dayIncome = pair.Value.MoneyUSD;
|
|
incomeData.dayPayPeopleN = pair.Value.m_PayGoogleSuccessResUser.Count;
|
|
incomeData.dayPayTimes = pair.Value.PayCount;
|
|
incomeData.dayArppu = pair.Value.ARPPU;
|
|
incomeData.dayArpu = pair.Value.ARPU;
|
|
incomeData.dayPayPerm = pair.Value.PayUserPer;
|
|
|
|
incomeData.monIncome = pair.Value.MoneyUSDMon;
|
|
incomeData.monPayPeopleN = pair.Value.m_payUserMonth.Count;
|
|
incomeData.monArppu = pair.Value.ARPPUMon;
|
|
incomeData.monArpu = pair.Value.ARPUMon;
|
|
incomeData.monPayPerm = pair.Value.PayUserPerMon;
|
|
|
|
incomeData.retentionP_1 = pair.Value.PayRetention1;
|
|
incomeData.retentionP_2 = pair.Value.PayRetention2;
|
|
incomeData.retentionP_3 = pair.Value.PayRetention3;
|
|
incomeData.retentionP_4 = pair.Value.PayRetention4;
|
|
incomeData.retentionP_5 = pair.Value.PayRetention5;
|
|
incomeData.retentionP_6 = pair.Value.PayRetention6;
|
|
incomeData.retentionP_7 = pair.Value.PayRetention7;
|
|
|
|
incomeData.retentionP_15 = pair.Value.PayRetention15;
|
|
incomeData.retentionP_30 = pair.Value.PayRetention30;
|
|
|
|
ExportToMysql.Instance.AddOneDailyPaymentInfo(incomeData);
|
|
|
|
|
|
|
|
foreach (var couponItem in pair.Value.m_ExchangeCouponDbResUserList)
|
|
{
|
|
Coupon_Info couponData = new Coupon_Info();
|
|
couponData.dateId = couponItem.dateId;
|
|
couponData.uid = couponItem.uid;
|
|
couponData.nick = couponItem.nick;
|
|
couponData.itemid = couponItem.itemid;
|
|
|
|
couponData.uniqueID = couponItem.uniqueID;
|
|
couponData.phoneCardMoney = couponItem.phoneCardMoney;
|
|
couponData.transactionId = couponItem.transactionId;
|
|
couponData.trueName = couponItem.trueName;
|
|
couponData.phoneNum = couponItem.phoneNum;
|
|
couponData.telcom = couponItem.telcom;
|
|
couponData.email = couponItem.email;
|
|
|
|
ExportToMysql.Instance.AddExchangeCouponInfo(couponData);
|
|
}
|
|
|
|
NewUserRecharge_Info NewUserRechargeData = new NewUserRecharge_Info();
|
|
NewUserRechargeData.dateId = pair.Key;
|
|
|
|
NewUserRechargeData.m_newUser = pair.Value.m_newUser.Count;
|
|
NewUserRechargeData.m_newUserRechargeMoney1 = (float)(pair.Value.m_newUserRechargeMoney1 / BillTypeUtils.USD_TK_DOLLA);
|
|
NewUserRechargeData.m_newUserRechargeCount1 = pair.Value.m_newUserRechargeCount1;
|
|
NewUserRechargeData.m_newUserRechargeMoney2 = (float)(pair.Value.m_newUserRechargeMoney2 / BillTypeUtils.USD_TK_DOLLA);
|
|
NewUserRechargeData.m_newUserRechargeCount2 = pair.Value.m_newUserRechargeCount2;
|
|
|
|
NewUserRechargeData.m_newUserRechargeMoney7 = (float)(pair.Value.m_newUserRechargeMoney7 / BillTypeUtils.USD_TK_DOLLA);
|
|
NewUserRechargeData.m_newUserRechargeCount7 = pair.Value.m_newUserRechargeCount7;
|
|
NewUserRechargeData.m_newUserRechargeMoney30 = (float)(pair.Value.m_newUserRechargeMoney30 / BillTypeUtils.USD_TK_DOLLA);
|
|
NewUserRechargeData.m_newUserRechargeCount30 = pair.Value.m_newUserRechargeCount30;
|
|
|
|
ExportToMysql.Instance.AddNewUserRechargeInfo(NewUserRechargeData);
|
|
|
|
|
|
PrintTreasureDraw_Info PrintTreasureDrawData = new PrintTreasureDraw_Info();
|
|
PrintTreasureDrawData.dateId = pair.Key;
|
|
|
|
PrintTreasureDrawData.m_treasureUser = pair.Value.TreasureUserCount;
|
|
PrintTreasureDrawData.TreasureDrawConsume = pair.Value.TreasureDrawConsume;
|
|
PrintTreasureDrawData.m_treasureItemDrawCount1 = pair.Value.m_treasureItemDrawCount[1];
|
|
PrintTreasureDrawData.m_treasureItemDrawUserCount1 = pair.Value.m_treasureItemDrawUserCount[1].Count;
|
|
PrintTreasureDrawData.m_treasureItemDrawCount2 = pair.Value.m_treasureItemDrawCount[2];
|
|
PrintTreasureDrawData.m_treasureItemDrawUserCount2 = pair.Value.m_treasureItemDrawUserCount[2].Count;
|
|
PrintTreasureDrawData.m_treasureItemDrawCount3 = pair.Value.m_treasureItemDrawCount[3];
|
|
PrintTreasureDrawData.m_treasureItemDrawUserCount3 = pair.Value.m_treasureItemDrawUserCount[3].Count;
|
|
PrintTreasureDrawData.m_treasureItemDrawCount4 = pair.Value.m_treasureItemDrawCount[4];
|
|
PrintTreasureDrawData.m_treasureItemDrawUserCount4 = pair.Value.m_treasureItemDrawUserCount[4].Count;
|
|
PrintTreasureDrawData.m_treasureItemDrawCount5 = pair.Value.m_treasureItemDrawCount[5];
|
|
PrintTreasureDrawData.m_treasureItemDrawUserCount5 = pair.Value.m_treasureItemDrawUserCount[5].Count;
|
|
PrintTreasureDrawData.m_treasureItemDrawCount6 = pair.Value.m_treasureItemDrawCount[6];
|
|
PrintTreasureDrawData.m_treasureItemDrawUserCount6 = pair.Value.m_treasureItemDrawUserCount[6].Count;
|
|
PrintTreasureDrawData.m_treasureItemDrawCount7 = pair.Value.m_treasureItemDrawCount[7];
|
|
PrintTreasureDrawData.m_treasureItemDrawUserCount7 = pair.Value.m_treasureItemDrawUserCount[7].Count;
|
|
PrintTreasureDrawData.m_treasureItemDrawCount8 = pair.Value.m_treasureItemDrawCount[8];
|
|
PrintTreasureDrawData.m_treasureItemDrawUserCount8 = pair.Value.m_treasureItemDrawUserCount[8].Count;
|
|
PrintTreasureDrawData.m_treasureItemDrawCount9 = pair.Value.m_treasureItemDrawCount[9];
|
|
PrintTreasureDrawData.m_treasureItemDrawUserCount9 = pair.Value.m_treasureItemDrawUserCount[9].Count;
|
|
|
|
|
|
ExportToMysql.Instance.AddPrintTreasureDrawInfo(PrintTreasureDrawData);
|
|
|
|
|
|
PrintChipDiamond_Info PrintChipDiamondData = new PrintChipDiamond_Info();
|
|
PrintChipDiamondData.dateId = pair.Key;
|
|
|
|
PrintChipDiamondData.ChipGet = pair.Value.ChipGet;
|
|
PrintChipDiamondData.ChipConsume = pair.Value.ChipConsume;
|
|
PrintChipDiamondData.getChipMail = pair.Value.GetChipByReason("GetItemMail");
|
|
PrintChipDiamondData.getChipInviteSns = pair.Value.GetChipByReason("InviteSnsFriendAward");
|
|
PrintChipDiamondData.getChipBroken = pair.Value.GetChipByReason("GetBrokeGrants");
|
|
PrintChipDiamondData.getChipSign = pair.Value.GetChipByReason("GetSignReward");
|
|
PrintChipDiamondData.getChipOnline = pair.Value.GetChipByReason("GetOnlineReward");
|
|
PrintChipDiamondData.getChipDiamond = pair.Value.GetChipByReason("DiamondChipExchange");
|
|
PrintChipDiamondData.getChipPay = pair.Value.GetChipByReason("Pay");
|
|
PrintChipDiamondData.guessCardWin = pair.Value.GetChipByReason("GuessCardAward");
|
|
PrintChipDiamondData.getChipActivity = pair.Value.GetChipByReason("GetActivityReward");
|
|
PrintChipDiamondData.getChipShareFB = pair.Value.GetChipByReason("ShareFB");
|
|
PrintChipDiamondData.getChipFriendRank = pair.Value.GetChipByReason("GetFriendRankAward");
|
|
PrintChipDiamondData.PlayerWinRobot = pair.Value.PlayerWinRobot;
|
|
PrintChipDiamondData.RobotWinPlayer = pair.Value.RobotWinPlayer;
|
|
|
|
PrintChipDiamondData.TreasureDrawConsume = pair.Value.TreasureDrawConsume;
|
|
PrintChipDiamondData.DiamondGet = pair.Value.DiamondGet;
|
|
PrintChipDiamondData.DiamondConsume = pair.Value.DiamondConsume;
|
|
PrintChipDiamondData.getDiamondPay = pair.Value.GetDiamondByReason("Pay");
|
|
PrintChipDiamondData.getDiamondMail = pair.Value.GetDiamondByReason("GetItemMail");
|
|
PrintChipDiamondData.getDiamondGm = pair.Value.GetDiamondByReason("GmCmd");
|
|
PrintChipDiamondData.newUserChipGet = pair.Value.newUserChipGet;
|
|
PrintChipDiamondData.newUserChipConsume = pair.Value.newUserChipConsume;
|
|
PrintChipDiamondData.GetItemMail = pair.Value.GetNewUserChipByReason("GetItemMail");
|
|
PrintChipDiamondData.InviteSnsFriendAward = pair.Value.GetNewUserChipByReason("InviteSnsFriendAward");
|
|
PrintChipDiamondData.GetOnlineReward = pair.Value.GetNewUserChipByReason("GetOnlineReward");
|
|
PrintChipDiamondData.GetSignReward = pair.Value.GetNewUserChipByReason("GetSignReward");
|
|
PrintChipDiamondData.GetBrokeGrants = pair.Value.GetNewUserChipByReason("GetBrokeGrants");
|
|
PrintChipDiamondData.GuessCardAward = pair.Value.GetNewUserChipByReason("GuessCardAward");
|
|
PrintChipDiamondData.newUserGuessCardBet = pair.Value.newUserGuessCardBet;
|
|
|
|
|
|
ExportToMysql.Instance.AddPrintChipDiamondInfo(PrintChipDiamondData);
|
|
|
|
|
|
PrintChipDiamondRange_Info PrintChipDiamondRangeData = new PrintChipDiamondRange_Info();
|
|
PrintChipDiamondRangeData.dateId = pair.Key;
|
|
|
|
PrintChipDiamondRangeData.ActiveUser = pair.Value.ActiveUser;
|
|
PrintChipDiamondRangeData.GetUserTotalChipp = pair.Value.GetUserTotalChip();
|
|
PrintChipDiamondRangeData.GetChipRangeUserCount1 = pair.Value.GetChipRangeUserCount(0, 5000);
|
|
PrintChipDiamondRangeData.GetChipRangeUserCount2 = pair.Value.GetChipRangeUserCount(5000, 30000);
|
|
PrintChipDiamondRangeData.GetChipRangeUserCount3 = pair.Value.GetChipRangeUserCount(30000, 100000);
|
|
PrintChipDiamondRangeData.GetChipRangeUserCount4 = pair.Value.GetChipRangeUserCount(100000, 300000);
|
|
PrintChipDiamondRangeData.GetChipRangeUserCount5 = pair.Value.GetChipRangeUserCount(300000, 600000);
|
|
PrintChipDiamondRangeData.GetChipRangeUserCount6 = pair.Value.GetChipRangeUserCount(600000, 1000000);
|
|
PrintChipDiamondRangeData.GetChipRangeUserCount7 = pair.Value.GetChipRangeUserCount(1000000, 2000000);
|
|
PrintChipDiamondRangeData.GetChipRangeUserCount8 = pair.Value.GetChipRangeUserCount(2000000, 5000000);
|
|
PrintChipDiamondRangeData.GetChipRangeUserCount9 = pair.Value.GetChipRangeUserCount(5000000, 6000000);
|
|
PrintChipDiamondRangeData.GetChipRangeUserCount10 = pair.Value.GetChipRangeUserCount(6000000, 20000000);
|
|
PrintChipDiamondRangeData.GetChipRangeUserCount11 = pair.Value.GetChipRangeUserCount(20000000, 60000000);
|
|
PrintChipDiamondRangeData.GetChipRangeUserCount12 = pair.Value.GetChipRangeUserCount(60000000, 600000000000);
|
|
PrintChipDiamondRangeData.GetDiamondRangeUserCount1 = pair.Value.GetDiamondRangeUserCount(0, 1);
|
|
PrintChipDiamondRangeData.GetDiamondRangeUserCount2 = pair.Value.GetDiamondRangeUserCount(1, 10);
|
|
PrintChipDiamondRangeData.GetDiamondRangeUserCount3 = pair.Value.GetDiamondRangeUserCount(10, 100);
|
|
PrintChipDiamondRangeData.GetDiamondRangeUserCount4 = pair.Value.GetDiamondRangeUserCount(100, 1000);
|
|
PrintChipDiamondRangeData.GetDiamondRangeUserCount5 = pair.Value.GetDiamondRangeUserCount(1000, 100000000);
|
|
|
|
|
|
ExportToMysql.Instance.AddPrintChipDiamondRangeInfo(PrintChipDiamondRangeData);
|
|
|
|
}
|
|
|
|
ExportToMysql.Instance.ExportActUserNew();
|
|
ExportToMysql.Instance.ExportActUserActive();
|
|
ExportToMysql.Instance.ExportPayment();
|
|
ExportToMysql.Instance.ExportCoupon();
|
|
ExportToMysql.Instance.ExportNewUserRecharge();
|
|
ExportToMysql.Instance.ExportPrintTreasureDraw();
|
|
ExportToMysql.Instance.ExportPrintChipDiamond();
|
|
ExportToMysql.Instance.ExportPrintChipDiamondRange();
|
|
|
|
Console.WriteLine("bill log export success , mode {0}", BillMode.Mode);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|