App.php 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?php
  2. /**
  3. * App.php UTF-8
  4. * app事件
  5. *
  6. * @date : 2018/1/19 17:26
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : wuyonghong <wyh@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace huo\controller\app;
  13. use huo\controller\common\Base;
  14. use huo\controller\request\Channel;
  15. use huo\controller\request\Crash;
  16. use huo\controller\request\Device;
  17. use huo\controller\request\Event;
  18. use huo\controller\request\Game as GameRq;
  19. use huo\controller\request\Mem;
  20. use huo\model\log\CrashLogModel;
  21. use huo\model\log\EventLogModel;
  22. use huo\model\log\OnlineLogModel;
  23. class App extends Base {
  24. /**
  25. * 事件上报记录
  26. *
  27. * @param Event $event
  28. * @param GameRq $game_rq
  29. * @param Channel $channel
  30. * @param Device $device
  31. *
  32. * @return bool|mixed
  33. */
  34. public function insertLog(Event $event, GameRq $game_rq, Channel $channel, Device $device) {
  35. $_data['agent_id'] = $channel->getAgentId();
  36. $_data['agent_game'] = $channel->getAgentGame();
  37. $_data['app_id'] = $game_rq->getHAppId();
  38. $_data['device_id'] = $device->getDeviceId();
  39. $_data['mac'] = $device->getMac();
  40. $_data['ip'] = $device->getIp();
  41. $_data['brand'] = $device->getBrand();
  42. $_data['model'] = $device->getModel();
  43. $_data['os'] = $device->getOs();
  44. $_data['os_version'] = $device->getOsVersion();
  45. $_data['screen'] = $device->getScreen();
  46. $_data['net'] = $device->getNet();
  47. $_data['imsi'] = $device->getImsi();
  48. $_data['longitude'] = $device->getLongitude();
  49. $_data['latitude'] = $device->getLatitude();
  50. $_data['userua'] = $device->getUserua();
  51. $_data['from'] = $device->getFrom();
  52. $_data['open_cnt'] = $device->getOpenCnt();
  53. $_data['event'] = $event->getEvent();
  54. $_data['status'] = $event->getStatus();
  55. $_data['context'] = $event->getContext();
  56. $_event_model = new EventLogModel();
  57. return $_event_model->insertLog($_data);
  58. }
  59. /**
  60. * 插入奔溃记录
  61. *
  62. * @param Crash $crash
  63. * @param GameRq $game_rq
  64. * @param Channel $channel
  65. * @param Device $device
  66. *
  67. * @return bool|mixed
  68. */
  69. public function insertCrashLog(Crash $crash, GameRq $game_rq, Channel $channel, Device $device) {
  70. $_data['agent_id'] = $channel->getAgentId();
  71. $_data['agent_game'] = $channel->getAgentGame();
  72. $_data['app_id'] = $game_rq->getHAppId();
  73. $_data['device_id'] = $device->getDeviceId();
  74. $_data['mac'] = $device->getMac();
  75. $_data['ip'] = $device->getIp();
  76. $_data['brand'] = $device->getBrand();
  77. $_data['model'] = $device->getModel();
  78. $_data['os'] = $device->getOs();
  79. $_data['os_version'] = $device->getOsVersion();
  80. $_data['screen'] = $device->getScreen();
  81. $_data['net'] = $device->getNet();
  82. $_data['imsi'] = $device->getImsi();
  83. $_data['longitude'] = $device->getLongitude();
  84. $_data['latitude'] = $device->getLatitude();
  85. $_data['userua'] = $device->getUserua();
  86. $_data['from'] = $device->getFrom();
  87. $_data['open_cnt'] = $device->getOpenCnt();
  88. $_data['active'] = $crash->getActive();
  89. $_data['msg'] = $crash->getMsg();
  90. $_crash_model = new CrashLogModel();
  91. return $_crash_model->insertLog($_data);
  92. }
  93. public function insertHeartLog(GameRq $game_rq, Channel $channel, Device $device, Mem $member) {
  94. $_data['mem_id'] = $member->getMemId();
  95. $_data['agent_id'] = $channel->getAgentId();
  96. $_data['agent_game'] = $channel->getAgentGame();
  97. $_data['app_id'] = $game_rq->getHAppId();
  98. $_data['device_id'] = $device->getDeviceId();
  99. $_data['mac'] = $device->getMac();
  100. $_data['ip'] = $device->getIp();
  101. $_data['brand'] = $device->getBrand();
  102. $_data['model'] = $device->getModel();
  103. $_data['os'] = $device->getOs();
  104. $_data['os_version'] = $device->getOsVersion();
  105. $_data['screen'] = $device->getScreen();
  106. $_data['net'] = $device->getNet();
  107. $_data['imsi'] = $device->getImsi();
  108. $_data['longitude'] = $device->getLongitude();
  109. $_data['latitude'] = $device->getLatitude();
  110. $_data['userua'] = $device->getUserua();
  111. $_data['from'] = $device->getFrom();
  112. $_data['open_cnt'] = $device->getOpenCnt();
  113. $_heart_model = new OnlineLogModel();
  114. return $_heart_model->insertLog($_data);
  115. }
  116. }