LogServerHelper.cs 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using ET;
  2. using UnityEngine;
  3. namespace GFGGame
  4. {
  5. public class LogServerHelper
  6. {
  7. /// <summary>
  8. /// 发送节点日志
  9. /// </summary>
  10. /// <param name="node"></param>
  11. public static void SendNodeLog(int node)
  12. {
  13. var zoneScene = GameGlobal.zoneScene;
  14. var logData = EventTrackFlow2.Instance;
  15. logData.EventId = GenerateIDUtil.GenerateId();
  16. logData.DtEventTime = DateTimeUtil.GetNowTime(DateTimeUtil.FormatE);
  17. logData.PlatFormId = LauncherConfig.platformId;
  18. logData.ServerId = zoneScene.GetComponent<ServerInfosComponent>().CurrentServerId;
  19. logData.ChannelId = LauncherConfig.ChannelId;
  20. logData.Account = DeviceUniqueIdHelper.GetDeviceUniqueId();
  21. logData.EventType = node;
  22. var logStr = zoneScene.GetComponent<LogSplicingComponent>().LogObjectToStr(logData);
  23. //HttpTool.Instance.Post(GameConfig.logApiReportUrl, logStr);
  24. var body = $"?logStr={logStr}";
  25. HttpTool.Instance.Get(GameConfig.logApiReportUrl + body, null,false);
  26. }
  27. /// <summary>
  28. /// 发送玩法参与度
  29. /// </summary>
  30. /// <param name="node"></param>
  31. public static void SendPlayParticipationLog(int eventType, int type)
  32. {
  33. var zoneScene = GameGlobal.zoneScene;
  34. var logData = ET.PlayParticipation.Instance;
  35. logData.EventId = GenerateIDUtil.GenerateId();
  36. logData.DtEventTime = DateTimeUtil.GetNowTime(DateTimeUtil.FormatE);
  37. logData.PlatFormId = LauncherConfig.platformId;
  38. logData.ChannelId = LauncherConfig.ChannelId;
  39. logData.ServerId = zoneScene.GetComponent<ServerInfosComponent>().CurrentServerId;
  40. logData.PlayerId = zoneScene.GetComponent<RoleInfosComponent>().CurrentRoleId;
  41. logData.PlayerName = zoneScene.GetComponent<RoleInfosComponent>().GetCurrentRoleName();
  42. logData.EventType = eventType;
  43. logData.Type = type;
  44. var logStr = zoneScene.GetComponent<LogSplicingComponent>().LogObjectToStr(logData);
  45. //HttpTool.Instance.Post(GameConfig.logApiReportUrl, logStr);
  46. var body = $"?logStr={logStr}";
  47. HttpTool.Instance.Get(GameConfig.logApiReportUrl + body, null,false);
  48. }
  49. }
  50. }