using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using pbt = Google.Protobuf.WellKnownTypes; using ps = ProtoCSStruct; namespace Sog.Log { public static class CommBillLogUtils { public static void LogMailOpBegin(long opuid, ps.DBMail mail, int opType) { BillLogHelper blh = new BillLogHelper((int)BillLogType.MailOpBegin); blh.Append("opUid", opuid); blh.Append("opType", (int)opType); blh.Append("mailID", mail.MailID); blh.Append("mailType", mail.MailType); blh.Append("ownerUid", mail.Uid); blh.Append("senderUid", mail.SenderUid); blh.Append("senderTime", mail.SendTime); blh.Append("insertUniqueID", mail.InsertUniqueID); blh.Append("getItemTime", mail.GetItemTime); blh.Append("deleteTime", mail.DeleteTime); blh.Append("title", mail.Title.ToString()); string content = mail.Content.ToString().Replace("\n", "\\n"); blh.Append("content", content); long chip = 0; long diamond = 0; blh.Append("chip", chip); blh.Append("diamond", diamond); //道具放到最后 for (int i = 0; i < mail.AddGoods.Count; i++) { blh.Append("itemid_" + i.ToString(), mail.AddGoods[i].Id.GetString()); blh.Append("itemcount_" + i.ToString(), mail.AddGoods[i].Value); } string logMessage = blh.ToString(); long logUid = opuid; if (logUid == 0) { logUid = mail.Uid; } BillLogWriter.Instance.SendToBillLogSvr(logUid, logMessage); } public static void LogMailOpRet(long opuid, ps.DBMail mail, int opType, int ret) { BillLogHelper blh = new BillLogHelper((int)BillLogType.MailOpRet); blh.Append("opUid", opuid); blh.Append("opType", (int)opType); blh.Append("mailID", mail.MailID); blh.Append("mailType", mail.MailType); blh.Append("ownerUid", mail.Uid); blh.Append("senderUid", mail.SenderUid); blh.Append("senderTime", mail.SendTime); blh.Append("ret", ret); blh.Append("insertUniqueID", mail.InsertUniqueID); blh.Append("getItemTime", mail.GetItemTime); blh.Append("deleteTime", mail.DeleteTime); blh.Append("title", mail.Title.ToString()); string content = mail.Content.ToString().Replace("\n", "\\n"); blh.Append("content", content); long chip = 0; long diamond = 0; blh.Append("chip", chip); blh.Append("diamond", diamond); //道具放到最后 for (int i = 0; i < mail.AddGoods.Count; i++) { blh.Append("itemid_" + i.ToString(), mail.AddGoods[i].Id.GetString()); blh.Append("itemcount_" + i.ToString(), mail.AddGoods[i].Value); } string logMessage = blh.ToString(); long logUid = opuid; if (logUid == 0) { logUid = mail.Uid; } BillLogWriter.Instance.SendToBillLogSvr(logUid, logMessage); } public static void LogMailOpBegin(long opuid, ref ps.DBMail mail, int opType) { BillLogHelper blh = new BillLogHelper((int)BillLogType.MailOpBegin); blh.Append("opUid", opuid); blh.Append("opType", (int)opType); blh.Append("mailID", mail.MailID); blh.Append("mailType", mail.MailType); blh.Append("ownerUid", mail.Uid); blh.Append("senderUid", mail.SenderUid); blh.Append("senderTime", mail.SendTime); blh.Append("insertUniqueID", mail.InsertUniqueID); blh.Append("getItemTime", mail.GetItemTime); blh.Append("deleteTime", mail.DeleteTime); blh.Append("title", mail.Title.GetString()); string content = mail.Content.GetString().Replace("\n", "\\n"); blh.Append("content", content); long chip = 0; long diamond = 0; blh.Append("chip", chip); blh.Append("diamond", diamond); //道具放到最后 for (int i = 0; i < mail.AddGoods.Count; i++) { blh.Append("itemid_" + i.ToString(), mail.AddGoods[i].Id.GetString()); blh.Append("itemcount_" + i.ToString(), mail.AddGoods[i].Value); } blh.Append("param1", mail.Param1); blh.Append("param2", mail.Param2); blh.Append("param3", mail.Param3); blh.Append("param4", mail.Param4); blh.Append("param5", mail.Param5); string logMessage = blh.ToString(); long logUid = opuid; if (logUid == 0) { logUid = mail.Uid; } BillLogWriter.Instance.SendToBillLogSvr(logUid, logMessage); } public static void LogMailOpRet(long opuid, ref ps.DBMail mail, int opType, int ret) { BillLogHelper blh = new BillLogHelper((int)BillLogType.MailOpRet); blh.Append("opUid", opuid); blh.Append("opType", (int)opType); blh.Append("mailID", mail.MailID); blh.Append("mailType", mail.MailType); blh.Append("ownerUid", mail.Uid); blh.Append("senderUid", mail.SenderUid); blh.Append("senderTime", mail.SendTime); blh.Append("ret", ret); blh.Append("insertUniqueID", mail.InsertUniqueID); blh.Append("getItemTime", mail.GetItemTime); blh.Append("deleteTime", mail.DeleteTime); blh.Append("title", mail.Title.GetString()); string content = mail.Content.GetString().Replace("\n", "\\n"); blh.Append("content", content); long chip = 0; long diamond = 0; blh.Append("chip", chip); blh.Append("diamond", diamond); //道具放到最后 for (int i = 0; i < mail.AddGoods.Count; i++) { blh.Append("itemid_" + i.ToString(), mail.AddGoods[i].Id.GetString()); blh.Append("itemcount_" + i.ToString(), mail.AddGoods[i].Value); } string logMessage = blh.ToString(); long logUid = opuid; if (logUid == 0) { logUid = mail.Uid; } BillLogWriter.Instance.SendToBillLogSvr(logUid, logMessage); } } }