LogServerHelper.cs 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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. var body = $"?logStr={logStr}";
  24. HttpTool.Instance.Get(GameConfig.logApiReportUrl + body, null, false);
  25. }
  26. /// <summary>
  27. /// 发送玩法参与度
  28. /// </summary>
  29. public static void SendPlayParticipationLog(int eventType, int type)
  30. {
  31. var zoneScene = GameGlobal.zoneScene;
  32. var logData = ET.PlayParticipation.Instance;
  33. logData.EventId = GenerateIDUtil.GenerateId();
  34. logData.DtEventTime = DateTimeUtil.GetNowTime(DateTimeUtil.FormatE);
  35. logData.PlatFormId = LauncherConfig.platformId;
  36. logData.ChannelId = LauncherConfig.ChannelId;
  37. logData.ServerId = zoneScene.GetComponent<ServerInfosComponent>().CurrentServerId;
  38. logData.PlayerId = zoneScene.GetComponent<RoleInfosComponent>().CurrentRoleId;
  39. logData.PlayerName = zoneScene.GetComponent<RoleInfosComponent>().GetCurrentRoleName();
  40. logData.EventType = eventType;
  41. logData.Type = type;
  42. var logStr = zoneScene.GetComponent<LogSplicingComponent>().LogObjectToStr(logData);
  43. //HttpTool.Instance.Post(GameConfig.logApiReportUrl, logStr);
  44. var body = $"?logStr={logStr}";
  45. HttpTool.Instance.Get(GameConfig.logApiReportUrl + body, null, false);
  46. }
  47. /// <summary>
  48. /// 发送引导日志
  49. /// </summary>
  50. /// <param name="node"></param>
  51. public static void SendGuideFlowLog(int node)
  52. {
  53. var zoneScene = GameGlobal.zoneScene;
  54. var logData = ET.GuideFlow.Instance;
  55. logData.EventId = GenerateIDUtil.GenerateId();
  56. logData.DtEventTime = DateTimeUtil.GetNowTime(DateTimeUtil.FormatE);
  57. logData.PlatFormId = LauncherConfig.platformId;
  58. logData.ChannelId = LauncherConfig.ChannelId;
  59. logData.ServerId = zoneScene.GetComponent<ServerInfosComponent>().CurrentServerId;
  60. logData.GuideId = node;
  61. logData.PlayerId = zoneScene.GetComponent<RoleInfosComponent>().CurrentRoleId;
  62. logData.PlayerName = zoneScene.GetComponent<RoleInfosComponent>().GetCurrentRoleName();
  63. var logStr = zoneScene.GetComponent<LogSplicingComponent>().LogObjectToStr(logData);
  64. var body = $"?logStr={logStr}";
  65. HttpTool.Instance.Get(GameConfig.logApiReportUrl + body, null, false);
  66. }
  67. }
  68. }