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.
481 lines
18 KiB
481 lines
18 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
using Sog;
|
|
using Sog.Log;
|
|
using ProtoCSStruct;
|
|
|
|
|
|
namespace Game
|
|
{
|
|
public static class GameBillLogUtils
|
|
{
|
|
public static void LogLogin(PlayerOnGame player, int reonline)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.Login);
|
|
|
|
blh.Append("accountType", player.AccountInfo.AccountType);
|
|
blh.Append("accountID", player.AccountInfo.AccountID.GetPtr());
|
|
blh.Append("uid", player.UserID);
|
|
blh.Append("loginCount", player.RoleData.LoginCount);
|
|
blh.Append("onlineTime", player.RoleBase.OnlineTime);
|
|
blh.Append("level", player.RoleBase.Level);
|
|
blh.Append("chip", player.RoleBase.Chip);
|
|
blh.Append("diamond", player.GetDiamond());
|
|
|
|
string apkVersion = "";
|
|
string appVersion = "";
|
|
string deviceId = "";
|
|
string ip = "";
|
|
string deveceInfo = "";
|
|
string email = "";
|
|
string lang = Sog.Lang.LanguageUtils.DEFAULT_LANGUAGE;
|
|
string oslang = "";
|
|
string os = "";
|
|
|
|
var clientInfo = player.clientInfo;
|
|
if (clientInfo != null)
|
|
{
|
|
apkVersion = clientInfo.apkVersion;
|
|
appVersion = clientInfo.appVersion;
|
|
deviceId = clientInfo.DeviceId;
|
|
ip = clientInfo.IPAddr;
|
|
deveceInfo = clientInfo.deviceInfo;
|
|
PlayerSession playerSession = GameServerUtils.GetPlayerTableOp().GetPlayerSession(player.SessionID);
|
|
if (playerSession != null)
|
|
{
|
|
email = playerSession.Email;
|
|
}
|
|
|
|
lang = clientInfo.lang;
|
|
oslang = clientInfo.osLang;
|
|
os = clientInfo.os;
|
|
}
|
|
|
|
blh.Append("apkVersion", apkVersion);
|
|
blh.Append("appVersion", appVersion);
|
|
blh.Append("nick", player.GetNick());
|
|
blh.Append("deviceId", deviceId);
|
|
//添加付费次数
|
|
blh.Append("paycount", PlayerPayUtil.GetTotalPaySuccessCount(player));
|
|
blh.Append("ip", ip);
|
|
blh.Append("reonline", reonline);
|
|
blh.Append("deveceInfo", deveceInfo);
|
|
blh.Append("email", email);
|
|
blh.Append("lang", lang);
|
|
blh.Append("viplevel", player.GetVipLevel());
|
|
blh.Append("oslang", oslang);
|
|
blh.Append("adid", player.RoleData.OtherData.Adid.GetPtr()); //广告id
|
|
blh.Append("platform", (int)player.Platform);
|
|
blh.Append("os", os);
|
|
blh.Append("channel", GameTALogUtils.GetPlayerChannel(player));
|
|
blh.Append("realm", player.RealmID);
|
|
blh.Append("battleVesion", PlayerUtils.GetPlayerBattleVersion(player));
|
|
string logMessage = blh.ToString();
|
|
|
|
BillLogWriter.Instance.SendToBillLogSvr(player.UserID, logMessage);
|
|
}
|
|
|
|
public static void LogLogout(PlayerOnGame player)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.Logout);
|
|
|
|
blh.Append("accountType", player.AccountInfo.AccountType);
|
|
blh.Append("accountID", player.AccountInfo.AccountID.GetPtr());
|
|
blh.Append("uid", player.UserID);
|
|
blh.Append("loginCount", player.RoleData.LoginCount);
|
|
blh.Append("onlineTime", player.RoleBase.OnlineTime);
|
|
blh.Append("level", player.RoleBase.Level);
|
|
blh.Append("chip", player.RoleBase.Chip);
|
|
blh.Append("diamond", player.GetDiamond());
|
|
|
|
string deviceId = "";
|
|
if (string.IsNullOrEmpty(player.deviceId))
|
|
{
|
|
deviceId = player.deviceId;
|
|
}
|
|
|
|
blh.Append("deviceId", deviceId);
|
|
blh.Append("adid", player.RoleData.OtherData.Adid.GetPtr()); //广告id
|
|
blh.Append("realm", player.RealmID);
|
|
|
|
string logMessage = blh.ToString();
|
|
|
|
BillLogWriter.Instance.SendToBillLogSvr(player.UserID, logMessage);
|
|
}
|
|
|
|
|
|
|
|
public static void LogPayGoogleReq(ref SSPayGoogleReq ssReq)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.PayGoogleReq);
|
|
|
|
blh.Append("uid", ssReq.Uid);
|
|
blh.Append("itemid", ssReq.ItemID);
|
|
blh.Append("diamond", ssReq.Diamond);
|
|
blh.Append("money", ssReq.Money);
|
|
|
|
string logMessage = blh.ToString();
|
|
|
|
BillLogWriter.Instance.SendToBillLogSvr(ssReq.Uid, logMessage);
|
|
}
|
|
|
|
public static void LogPayGoogleRes(ref SSPayGoogleRes ssRes)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.PayGoogleRes);
|
|
|
|
blh.Append("uid", ssRes.Uid);
|
|
blh.Append("itemid", ssRes.ItemID);
|
|
blh.Append("diamond", ssRes.Diamond);
|
|
blh.Append("money", ssRes.Money);
|
|
blh.Append("orderid", ssRes.OrderId.GetPtr());
|
|
blh.Append("ret", ssRes.Ret);
|
|
|
|
string logMessage = blh.ToString();
|
|
|
|
BillLogWriter.Instance.SendToBillLogSvr(ssRes.Uid, logMessage);
|
|
}
|
|
|
|
public static void LogPayGoogleSuccessReq(ref SSPayGoogleSuccessReq ssReq)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.PayGoogleSuccessReq);
|
|
|
|
blh.Append("uid", ssReq.Uid);
|
|
blh.Append("orderid", ssReq.OrderId.GetPtr());
|
|
blh.Append("purchasedata", ssReq.PurchaseData.GetPtr());
|
|
blh.Append("signature", ssReq.Signature.GetPtr());
|
|
blh.Append("payType", ssReq.PayType);
|
|
blh.Append("orderid3rd", ssReq.OrderId3rd.GetPtr());
|
|
|
|
string logMessage = blh.ToString();
|
|
|
|
BillLogWriter.Instance.SendToBillLogSvr(ssReq.Uid, logMessage);
|
|
}
|
|
|
|
public static void LogPayGoogleSuccessReq(ref CSPayGoogleSuccessReq req, int payType)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.PayGoogleSuccessReq);
|
|
|
|
blh.Append("uid", req.Uid);
|
|
blh.Append("orderid", req.OrderId.GetPtr());
|
|
blh.Append("purchasedata", req.PurchaseData.GetPtr());
|
|
blh.Append("signature", req.Signature.GetPtr());
|
|
blh.Append("payType", payType);
|
|
blh.Append("orderid3rd", req.OrderId3rd.GetPtr());
|
|
|
|
string logMessage = blh.ToString();
|
|
|
|
BillLogWriter.Instance.SendToBillLogSvr(req.Uid, logMessage);
|
|
}
|
|
|
|
|
|
public static void LogPayGoogleSuccessRes(ref SSPayGoogleSuccessRes ssRes, int money,
|
|
uint diamond, uint diamondGift, long addChip, bool firstPayUser, PlayerOnGame player)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.PayGoogleSuccessRes);
|
|
|
|
|
|
blh.Append("uid", ssRes.Uid);
|
|
blh.Append("itemid", ssRes.ItemID);
|
|
blh.Append("diamond", diamond);
|
|
blh.Append("money", money);
|
|
blh.Append("orderid", ssRes.OrderId.GetPtr());
|
|
blh.Append("ret", ssRes.Ret);
|
|
blh.Append("orderid3rd", ssRes.OrderId3rd.GetPtr());
|
|
blh.Append("diamondGift", diamondGift);
|
|
blh.Append("firstPayUser", firstPayUser);
|
|
if (player != null)
|
|
{
|
|
blh.Append("nick", player.GetNick());
|
|
}
|
|
else
|
|
{
|
|
blh.Append("nick", "");
|
|
}
|
|
|
|
blh.Append("payType", ssRes.PayType);
|
|
blh.Append("addChip", addChip);
|
|
blh.Append("payStatus", ssRes.Status);
|
|
blh.Append("amount", ssRes.Amount);
|
|
blh.Append("currency", ssRes.Currency.GetString());
|
|
|
|
string logMessage = blh.ToString();
|
|
BillLogWriter.Instance.SendToBillLogSvr(ssRes.Uid, logMessage);
|
|
}
|
|
|
|
public static void LogPayGoogleSuccessRes(ref DBPaySuccWaitAddRole data, long addChip, bool firstPayUser,
|
|
PlayerOnGame player)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.PayGoogleSuccessRes);
|
|
|
|
blh.Append("uid", player.UserID);
|
|
blh.Append("itemid", data.ItemID);
|
|
blh.Append("money", data.Money);
|
|
blh.Append("orderid", data.OrderId.GetPtr());
|
|
// 支付成功后才会调用这个接口, 所以支付结果ret是0
|
|
blh.Append("ret", 0);
|
|
blh.Append("orderid3rd", data.OrderId3rd.GetPtr());
|
|
blh.Append("firstPayUser", firstPayUser);
|
|
blh.Append("nick", player.GetNick());
|
|
blh.Append("payType", data.PayType);
|
|
blh.Append("addChip", addChip);
|
|
// 支付成功后才会调用这个接口, 所以支付状态是2
|
|
blh.Append("payStatus", 2);
|
|
blh.Append("amount", data.Amount);
|
|
blh.Append("currency", data.Currency.GetString());
|
|
|
|
string logMessage = blh.ToString();
|
|
BillLogWriter.Instance.SendToBillLogSvr(player.UserID, logMessage);
|
|
}
|
|
|
|
public static void LogPayFreeGiftPack(PlayerOnGame player, PayDiamondDesc desc, ref DBRolePayItemRecord record)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.PayFreeGiftPack);
|
|
|
|
blh.Append("uid", player.UserID);
|
|
blh.Append("itemid", desc.itemID);
|
|
blh.Append("payCountToday", record.PayCountToday);
|
|
blh.Append("payCountWeek", record.PayCountWeek);
|
|
blh.Append("payCountMonth", record.PayCountMonth);
|
|
blh.Append("paySuccCount", record.PaySuccessCount);
|
|
blh.Append("lastUpdateRecordTime", record.LastUpdateRecordTime);
|
|
|
|
string logMessage = blh.ToString();
|
|
BillLogWriter.Instance.SendToBillLogSvr(player.UserID, logMessage);
|
|
}
|
|
|
|
public static void LogFakePay(ref DBPaySuccWaitAddRole data, long addChip, bool firstPayUser,
|
|
PlayerOnGame player)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.FakePay);
|
|
|
|
blh.Append("uid", player.UserID);
|
|
blh.Append("itemid", data.ItemID);
|
|
blh.Append("money", data.Money);
|
|
blh.Append("orderid", data.OrderId.GetPtr());
|
|
blh.Append("orderid3rd", data.OrderId3rd.GetPtr());
|
|
blh.Append("firstPayUser", firstPayUser);
|
|
blh.Append("nick", player.GetNick());
|
|
blh.Append("payType", data.PayType);
|
|
blh.Append("addChip", addChip);
|
|
blh.Append("amount", data.Amount);
|
|
blh.Append("currency", data.Currency.GetString());
|
|
|
|
string logMessage = blh.ToString();
|
|
BillLogWriter.Instance.SendToBillLogSvr(player.UserID, logMessage);
|
|
}
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="uid"></param>
|
|
/// <param name="oldDiamond">改变前的钻石</param>
|
|
/// <param name="newDiamond">改变后的钻石</param>
|
|
/// <param name="changeValue">可为负,表示扣钻石</param>
|
|
/// <param name="reason">原因 BillChangeItemReason</param>
|
|
/// <param name="param1">param1可以是订单号之类的</param>
|
|
public static void LogChangeDiamond(long uid, long oldDiamond, long newDiamond, long changeValue, string reason,
|
|
string param1)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.ChangeDiamond);
|
|
|
|
blh.Append("uid", uid);
|
|
blh.Append("old", oldDiamond);
|
|
blh.Append("new", newDiamond);
|
|
blh.Append("change", changeValue);
|
|
blh.Append("reason", reason);
|
|
blh.Append("param1", param1);
|
|
|
|
string logMessage = blh.ToString();
|
|
|
|
BillLogWriter.Instance.SendToBillLogSvr(uid, logMessage);
|
|
}
|
|
|
|
|
|
public static void LogChangeChip(long uid, long oldcount, long newcount, long changeValue, string reason,
|
|
string param1)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.ChangeChip);
|
|
|
|
blh.Append("uid", uid);
|
|
blh.Append("old", oldcount);
|
|
blh.Append("new", newcount);
|
|
blh.Append("change", changeValue);
|
|
blh.Append("reason", reason);
|
|
blh.Append("param1", param1);
|
|
|
|
string logMessage = blh.ToString();
|
|
|
|
BillLogWriter.Instance.SendToBillLogSvr(uid, logMessage);
|
|
}
|
|
|
|
public static void LogChangeItem(long uid, uint itemid, long uniqueID, long oldcount, long newcount,
|
|
int changeValue, int itemType, string reason, string param1)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.ChangeItem);
|
|
|
|
blh.Append("uid", uid);
|
|
blh.Append("itemid", itemid);
|
|
blh.Append("uniqueID", uniqueID);
|
|
blh.Append("old", oldcount);
|
|
blh.Append("new", newcount);
|
|
blh.Append("change", changeValue);
|
|
blh.Append("itemtype", itemType);
|
|
blh.Append("reason", reason);
|
|
blh.Append("param1", param1);
|
|
|
|
string logMessage = blh.ToString();
|
|
|
|
BillLogWriter.Instance.SendToBillLogSvr(uid, logMessage);
|
|
}
|
|
|
|
public static void LogPlayerPingInfo(long uid, PlayerPingInfo pingInfo)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.PingInfo);
|
|
|
|
blh.Append("uid", uid);
|
|
blh.Append("minPing", pingInfo.MinPingTime);
|
|
blh.Append("maxPing", pingInfo.MaxPingTime);
|
|
blh.Append("avgPing", pingInfo.TotalPingTime / pingInfo.PingCount);
|
|
|
|
string logMessage = blh.ToString();
|
|
|
|
BillLogWriter.Instance.SendToBillLogSvr(uid, logMessage);
|
|
}
|
|
|
|
|
|
|
|
public static void LogAgainConnect(long uid)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.AgainConnect);
|
|
|
|
blh.Append("uid", uid);
|
|
|
|
string logMessage = blh.ToString();
|
|
|
|
BillLogWriter.Instance.SendToBillLogSvr(uid, logMessage);
|
|
}
|
|
|
|
public static void LogFriendGift(long selfUid, int opType, long friendUid, int todaySend, int todayRecv,
|
|
int autoOp)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.FriendGift);
|
|
|
|
blh.Append("selfUid", selfUid);
|
|
blh.Append("opType", opType);
|
|
blh.Append("friendUid", friendUid);
|
|
blh.Append("todaySend", todaySend);
|
|
blh.Append("todayRecv", todayRecv);
|
|
blh.Append("autoOp", autoOp);
|
|
|
|
string logMessage = blh.ToString();
|
|
BillLogWriter.Instance.SendToBillLogSvr(selfUid, logMessage);
|
|
}
|
|
|
|
public static void LogInviteFacebook(long uid, long iCount)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.InviteFacebook);
|
|
|
|
blh.Append("uid", uid);
|
|
blh.Append("Count", iCount);
|
|
|
|
string logMessage = blh.ToString();
|
|
|
|
BillLogWriter.Instance.SendToBillLogSvr(uid, logMessage);
|
|
}
|
|
|
|
public static void LogInviteMeUidBindSuccess(long uid, string inviteCode, long inviteMeUid)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.InviteMeUidBindSuccess);
|
|
|
|
blh.Append("uid", uid);
|
|
blh.Append("inviteMeUid", inviteMeUid);
|
|
blh.Append("inviteCode", inviteCode);
|
|
|
|
string logMessage = blh.ToString();
|
|
|
|
BillLogWriter.Instance.SendToBillLogSvr(uid, logMessage);
|
|
}
|
|
|
|
|
|
public static void LogCliReportBill(long uid, string strType, string message)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.CliReportBill);
|
|
|
|
blh.Append("uid", uid);
|
|
blh.Append("type", strType);
|
|
blh.Append("message", message);
|
|
|
|
string logMessage = blh.ToString();
|
|
|
|
BillLogWriter.Instance.SendToBillLogSvr(uid, logMessage);
|
|
}
|
|
|
|
public static void LogSendToMsgPlayer(long uid, int msgType)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.SendMsgToPlayer);
|
|
|
|
blh.Append("uid", uid);
|
|
blh.Append("msgType", msgType);
|
|
|
|
string logMessage = blh.ToString();
|
|
|
|
BillLogWriter.Instance.SendToBillLogSvr(uid, logMessage);
|
|
}
|
|
|
|
|
|
|
|
public static void LogHideMyInfo(long uid, int hide)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.HideMyInfo);
|
|
|
|
blh.Append("uid", uid);
|
|
blh.Append("hide", hide);
|
|
|
|
|
|
string logMessage = blh.ToString();
|
|
BillLogWriter.Instance.SendToBillLogSvr(uid, logMessage);
|
|
}
|
|
|
|
public static void LogFreezePlayer(long uid, int hour)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.FreezePlayer);
|
|
blh.Append("uid", uid);
|
|
blh.Append("hour", hour);
|
|
|
|
string logMessage = blh.ToString();
|
|
BillLogWriter.Instance.SendToBillLogSvr(uid, logMessage);
|
|
}
|
|
|
|
public static void LogAddLevel(long uid, LevelType type, int level)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.AddLevel);
|
|
blh.Append("uid", uid);
|
|
blh.Append("levelType", type == LevelType.RoleLevel ? "role" : "vip");
|
|
blh.Append("level", level);
|
|
|
|
string logMessage = blh.ToString();
|
|
BillLogWriter.Instance.SendToBillLogSvr(uid, logMessage);
|
|
}
|
|
|
|
|
|
public static void LogSendMailToPlayer(long uid, long targetUid, int vipLevel, long chip, long tax)
|
|
{
|
|
BillLogHelper blh = new BillLogHelper((int)BillLogType.MailSendToPlayer);
|
|
blh.Append("uid", uid);
|
|
blh.Append("targetUid", targetUid);
|
|
blh.Append("vipLevel", vipLevel);
|
|
blh.Append("chip", chip);
|
|
blh.Append("tax", tax);
|
|
|
|
string logMessage = blh.ToString();
|
|
BillLogWriter.Instance.SendToBillLogSvr(uid, logMessage);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|