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.
 
 
 
 
 
 

703 lines
21 KiB

/*
每天的数据
活跃
新增
付费
*/
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 partial class BillInfoEveryDay
{
public int GetChipRangeUserCount(long min, long max)
{
int iCount = 0;
foreach (KeyValuePair<int, UserInfo> pair in m_activeUser)
{
if (pair.Value.chip >= min && pair.Value.chip < max)
{
iCount++;
}
}
return iCount;
}
public long GetUserTotalChip()
{
long iTotalChip = 0;
foreach (KeyValuePair<int, UserInfo> pair in m_activeUser)
{
iTotalChip += pair.Value.chip;
}
return iTotalChip;
}
public int GetDiamondRangeUserCount(long min, long max)
{
int iCount = 0;
foreach (KeyValuePair<int, UserInfo> pair in m_activeUser)
{
if (pair.Value.diamond >= min && pair.Value.diamond < max)
{
iCount++;
}
}
return iCount;
}
//领取过1次破产补助的玩家数量
public int GetBrokenGrandUserCount(int times)
{
int iCount = 0;
foreach (var user in m_activeUser.Values)
{
if (user.GetBrokenGrantTimes == times)
{
iCount++;
}
}
return iCount;
}
//新进用户领取过1次破产补助的玩家数量
public int GetBrokenGrandNewUserCount(int times)
{
int iCount = 0;
foreach (var user in m_newUser.Values)
{
if (user.GetBrokenGrantTimes == times)
{
iCount++;
}
}
return iCount;
}
public int GetBrokenGrandTimes(int uid)
{
if (m_activeUser.ContainsKey(uid))
{
return m_activeUser[uid].GetBrokenGrantTimes;
}
return 0;
}
public Int64 GetUserLogoutChip(int uid)
{
Int64 chip = 0;
if (m_activeUser.ContainsKey(uid))
{
chip = m_activeUser[uid].chip;
}
return chip;
}
public void AddFirstRecharge(int uid, int time)
{
if (!m_rechargeUser.ContainsKey(uid))
{
m_rechargeUser.Add(uid, time);
}
}
public int GetPayGoogleCount(string itemId)
{
if (m_PayGoogleSuccCount.ContainsKey(itemId))
{
return m_PayGoogleSuccCount[itemId];
}
return 0;
}
public int GetPayGoogleUserCount(string itemId)
{
return m_PayGoogleSuccessResUser.Count(o => o.Value.buyItemDic.ContainsKey(itemId));
}
public void AddPayGoogleSuccessRes(DateTime dateTime, int uid, string itemId, Int64 diamond, int money, string orderid, int ret, DateTime now, int firstPay)
{
//测试号
if (uid == 10010 || uid == 10017 || uid == 10244)
{
return;
}
if (money > 0 && ret == 0)
{
if (m_PayGoogleSuccessResUser.ContainsKey(uid))
{
m_PayGoogleSuccessResUser[uid].money += money;
m_PayGoogleSuccessResUser[uid].diamond += diamond;
m_PayGoogleSuccessResUser[uid].lastPayTime = dateTime;
m_PayGoogleSuccessResUser[uid].payCount++;
}
else
{
PayGoogleSuccessRes data = new PayGoogleSuccessRes();
data.uid = uid;
data.money = money;
data.diamond = diamond;
data.PayFirstPlay = 1;
data.lastPayTime = dateTime;
data.payCount = 1;
data.firstPayTime = now;
data.firstPay = money;
m_PayGoogleSuccessResUser.Add(uid, data);
}
if (m_PayGoogleSuccessResUser[uid].buyItemDic.ContainsKey(itemId))
{
m_PayGoogleSuccessResUser[uid].buyItemDic[itemId]++;
}
else
{
m_PayGoogleSuccessResUser[uid].buyItemDic.Add(itemId, 1);
}
if (firstPay == 1)
{
this.FirstPay++;
}
if (m_PayGoogleSuccCount.ContainsKey(itemId))
{
m_PayGoogleSuccCount[itemId]++;
}
else
{
m_PayGoogleSuccCount[itemId] = 1;
}
this.PayCount++;
this.PayMoney += money;
if (m_activeUser.ContainsKey(uid))
{
if (m_activeUser[uid].platform == 2)
{
this.IOSPayCount++;
this.IOSPayMoney += money;
m_PayGoogleSuccessResUser[uid].platform = PlatformType.PlatformType_IOS;
}
else
{
m_PayGoogleSuccessResUser[uid].platform = PlatformType.PlatformType_Default;
}
}
BillStatistics.AddData(new Hourly_Statistics()
{
day = now.Day,
hour = now.Hour,
month = now.Month,
minute = now.Minute,
year = now.Year,
quantity= money,
type = Statistics_type.recharge,
});
var firstRecharge = BillAlldays.Instance.m_firstRecharge;
if (!firstRecharge.ContainsKey(uid))
{
rechargeInfo info = new rechargeInfo();
info.Uid = uid;
info.firstPayTime = now;
info.payMoney = money;
info.totalMoney += money;
info.payCount += 1;
info.buySomething = itemId;
firstRecharge.Add(uid, info);
}
else
{
if (now < firstRecharge[uid].firstPayTime)
{
firstRecharge[uid].firstPayTime = now;
firstRecharge[uid].payMoney = money;
}
firstRecharge[uid].totalMoney += money;
firstRecharge[uid].payCount += 1;
}
}
if (ret != 0)
{
}
}
public void AddDiamondChipExchange(int uid, int iDescID, Int64 iDiamond, Int64 iChip, Int64 iAfterDiamond,
Int64 iAfterChip, int iIsDiscount, int iItemId, int IItemCount)
{
//if(m_DiamondChipExchangeTable.ContainsKey(iDescID))
//{
// m_DiamondChipExchangeTable[iDescID]++;
//}
var firstRecharge = BillAlldays.Instance.m_firstRecharge;
/*if (firstRecharge.ContainsKey(uid) && firstRecharge[uid].buySomething == 0)
{
firstRecharge[uid].buySomething = iDescID;
}*/
if (firstRecharge.ContainsKey(uid) && firstRecharge[uid].chipBeforePay == 0)
{
firstRecharge[uid].chipBeforePay = iChip;
}
}
public void AddChangeDiamond(int uid, Int64 ioldDiamond, Int64 inewDiamond, Int64 ichange, string reason, string param1)
{
if (ichange > 0)
{
this.DiamondGet += ichange;
if (m_getDiamondReasonDict.ContainsKey(reason))
{
m_getDiamondReasonDict[reason] += ichange;
}
else
{
m_getDiamondReasonDict.Add(reason, ichange);
}
//邮件特殊处理
if (reason == "GetItemMail")
{
int mailType = 0;
if (string.IsNullOrEmpty(param1) == false)
{
int.TryParse(param1, out mailType);
if (mailType >= 0)
{
if (m_getMailDiamondTypeDict.ContainsKey(mailType))
{
m_getMailDiamondTypeDict[mailType] += ichange;
}
else
{
m_getMailDiamondTypeDict.Add(mailType, ichange);
}
}
else
{
mailType = 100;
}
}
else
{
mailType = 100;
}
}
}
else
{
this.DiamondConsume += (-ichange);
if (reason == "MatchEntryFee")
{
this.DiamondConsumeMatchFee += (-ichange);
}
else if (reason == "DiamondChipExchange")
{
this.DiamondConsumeExchange += (-ichange);
}
}
}
public void AddNewUserConsume(int uid, long chip, string reason)
{
if (chip <= 0)
{
return;
}
if (m_newUser.ContainsKey(uid))
{
newUserChipConsume += chip;
/*if (reason == "GuessCardBet")
{
newUserGuessCardBet += chip;
}*/
}
}
public void AddChangeItem(DateTime curedateTime, long uid, long itemId, long ioldCount, long inewCount, long ichangeCount, string reason)
{
if (!m_getItemReasonDict.ContainsKey(reason))
{
m_getItemReasonDict.Add(reason, 0);
}
m_getItemReasonDict[reason] += ichangeCount;
}
public void AddChangeChip(DateTime curedateTime, int uid, Int64 ioldChip, Int64 inewChip, Int64 change, string reason, BillInfoEveryDay lastDayBill, string param1)
{
var firstRecharge = BillAlldays.Instance.m_firstRecharge;
if (change > 0)
{
if (firstRecharge.ContainsKey(uid) && firstRecharge[uid].chipBeforePay == 0)
{
firstRecharge[uid].chipBeforePay = ioldChip;
}
//算金币产出
if (reason != "RoundSettlement" &&
reason != "KpFollowCard" &&
reason != "MatchRefund" &&
reason != "GuessCardRefund" &&
reason != "RefundRoundBet" &&
reason != "RefundActionBet"
)
{
this.ChipGet += change;
if (m_getChipReasonDict.ContainsKey(reason))
{
m_getChipReasonDict[reason] += change;
}
else
{
m_getChipReasonDict.Add(reason, change);
}
if (m_newUser.ContainsKey(uid))
{
newUserChipGet += change;
if (m_getNewUserChipReasonDict.ContainsKey(reason))
{
m_getNewUserChipReasonDict[reason] += change;
}
else
{
m_getNewUserChipReasonDict.Add(reason, change);
}
}
//邮件特殊处理
if (reason == "GetItemMail")
{
int mailType = 0;
if (string.IsNullOrEmpty(param1) == false)
{
int.TryParse(param1, out mailType);
if (mailType >= 0)
{
if (m_getMailChipTypeDict.ContainsKey(mailType))
{
m_getMailChipTypeDict[mailType] += change;
}
else
{
m_getMailChipTypeDict.Add(mailType, change);
}
//玩家赠送,不算到总产出
if (mailType == 13)
{
this.ChipGet -= change;
}
}
else
{
mailType = 100;
}
}
else
{
mailType = 100;
}
}
}
if (reason == "GetSignReward")
{
if (m_activeUser.ContainsKey(uid))
{
m_activeUser[uid].bGetSignReward = true;
}
}
if (reason == "GetActivityReward")
{
int activityId = 0;
if (string.IsNullOrEmpty(param1) == false)
{
int.TryParse(param1, out activityId);
if (activityId > 0)
{
if (m_getChipActivityDict.ContainsKey(activityId))
{
m_getChipActivityDict[activityId] += change;
}
else
{
m_getChipActivityDict.Add(activityId, change);
}
}
}
}
if (reason == BillChangeItemReason.InviteSuccessInviteeReward)
{
if (m_activeUser.ContainsKey(uid))
{
m_activeUser[uid].InviteSuccessInviteeRewardCount++;
}
}
}
else
{
}
if (reason == "GetBrokeGrants")
{
if (m_activeUser.ContainsKey(uid))
{
UserInfo user = m_activeUser[uid];
user.GetBrokenGrantTimes++;
int idx = user.GetBrokenGrantTimes;
if (m_GameUser.ContainsKey(uid) && 0 <= idx && idx < 6)
{
if (user.getBrokeGrantPlayGameCount == null)
{
user.getBrokeGrantPlayGameCount = new int[6];
}
user.getBrokeGrantPlayGameCount[idx] = m_GameUser[uid][0];
}
}
}
else if (reason == "TreasureDrawBuy")
{
this.ChipConsume += -change;
//夺宝购买
this.TreasureDrawConsume += -change;
}
}
public long GetChipByReason(string reason)
{
if (m_getChipReasonDict.ContainsKey(reason))
{
return m_getChipReasonDict[reason];
}
return 0;
}
public long GetItemChangeByReason(string reason)
{
if (m_getItemReasonDict.ContainsKey(reason))
{
return m_getItemReasonDict[reason];
}
return 0;
}
public long GetChipByActivityId(int id)
{
if (m_getChipActivityDict.ContainsKey(id))
{
return m_getChipActivityDict[id];
}
return 0;
}
public long GeMailtChipByType(int mailType)
{
if (m_getMailChipTypeDict.ContainsKey(mailType))
{
return m_getMailChipTypeDict[mailType];
}
return 0;
}
public long GeMailtDiamondByType(int mailType)
{
if (m_getMailDiamondTypeDict.ContainsKey(mailType))
{
return m_getMailDiamondTypeDict[mailType];
}
return 0;
}
public long GetNewUserChipByReason(string reason)
{
if (m_getNewUserChipReasonDict.ContainsKey(reason))
{
return m_getNewUserChipReasonDict[reason];
}
return 0;
}
public long GetDiamondByReason(string reason)
{
if (m_getDiamondReasonDict.ContainsKey(reason))
{
return m_getDiamondReasonDict[reason];
}
return 0;
}
public void AddRobotChipData(long deskId, long RobotWin, long PlayerWin)
{
this.PlayerWinRobot += PlayerWin;
this.RobotWinPlayer += RobotWin;
this.ChipGet += PlayerWin;
this.ChipConsume += RobotWin;
if (PlayerWin > 0)
{
if (m_robotLoseChipInfo.ContainsKey(PlayerWin) == false)
{
m_robotLoseChipInfo[PlayerWin] = 1;
}
else
{
m_robotLoseChipInfo[PlayerWin]++;
}
}
if (RobotWin > 0)
{
if (m_robotWinChipInfo.ContainsKey(RobotWin) == false)
{
m_robotWinChipInfo[RobotWin] = 1;
}
else
{
m_robotWinChipInfo[RobotWin]++;
}
}
}
public void AddMailOpRet(int opUid, int opType, uint mailID, int mailType, int ownerUid, int senderUid,
long senderTime, int ret, long insertUniqueID, long getItemTime, long deleteTime, string title,
string content, Int64 chip, Int64 diamond)
{
//领取物品,1邮件表示好友送金币
if (ret == 0 && mailType == 1 && opType == 3)
{
m_RecvFriendChipCount++;
if (m_newUser.ContainsKey(opUid))
{
m_newUserRecvFriendChipCount++;
}
}
}
public void AddExchangeCouponDbRes(DateTime dateId, int uid, string nick, int itemid, long uniqueID,
int phoneCardMoney, string transactionId, int status, int ret, string trueName, string phoneNum,
string telcom, string email)
{
ExchangeCouponDbResInfo data = new ExchangeCouponDbResInfo();
data.dateId = dateId;
data.uid = uid;
data.nick = nick;
data.itemid = itemid;
data.uniqueID = uniqueID;
data.phoneCardMoney = phoneCardMoney;
data.transactionId = transactionId;
data.status = status;
data.ret = ret;
data.trueName = trueName;
data.phoneNum = phoneNum;
data.telcom = telcom;
data.email = email;
m_ExchangeCouponDbResUserList.Add(data);
}
public int GetUserPayCount(int uid)
{
if (m_PayGoogleSuccessResUser.ContainsKey(uid) == false)
{
return 0;
}
return m_PayGoogleSuccessResUser[uid].payCount;
}
//破产后付费用户数量
public int GetBrokenAndPayUserCount(int brokencount)
{
int iUserCount = 0;
foreach (var user in m_PayGoogleSuccessResUser)
{
if (m_activeUser.ContainsKey(user.Key))
{
if (m_activeUser[user.Key].GetBrokenGrantTimes == brokencount)
{
iUserCount++;
}
}
}
return iUserCount;
}
public void AddSendCardInfo(long uid, long uid2, int count, int area, int rate, int sameIpOnSend,
int sameIpTotal, int payCount1, int payCount2, int bet1, int bet2, int bet3, int bet4)
{
SendCardInfo data = new SendCardInfo();
data.Uid = uid;
data.Uid2 = uid2;
data.Count = count;
data.ArenaCount = area;
data.RateCount = rate;
data.sameIpOnSend = sameIpOnSend;
data.sameIpTotal = sameIpTotal;
data.payCount1 = payCount1;
data.payCount2 = payCount2;
data.bet1 = bet1;
data.bet2 = bet2;
data.bet3 = bet3;
data.bet4 = bet4;
m_SendCardList.Add(data);
}
}
}