123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- <?php
- /**
- * App.php UTF-8
- * app事件
- *
- * @date : 2018/1/19 17:26
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : wuyonghong <wyh@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace huo\controller\app;
- use huo\controller\common\Base;
- use huo\controller\request\Channel;
- use huo\controller\request\Crash;
- use huo\controller\request\Device;
- use huo\controller\request\Event;
- use huo\controller\request\Game as GameRq;
- use huo\controller\request\Mem;
- use huo\model\log\CrashLogModel;
- use huo\model\log\EventLogModel;
- use huo\model\log\OnlineLogModel;
- class App extends Base {
- /**
- * 事件上报记录
- *
- * @param Event $event
- * @param GameRq $game_rq
- * @param Channel $channel
- * @param Device $device
- *
- * @return bool|mixed
- */
- public function insertLog(Event $event, GameRq $game_rq, Channel $channel, Device $device) {
- $_data['agent_id'] = $channel->getAgentId();
- $_data['agent_game'] = $channel->getAgentGame();
- $_data['app_id'] = $game_rq->getHAppId();
- $_data['device_id'] = $device->getDeviceId();
- $_data['mac'] = $device->getMac();
- $_data['ip'] = $device->getIp();
- $_data['brand'] = $device->getBrand();
- $_data['model'] = $device->getModel();
- $_data['os'] = $device->getOs();
- $_data['os_version'] = $device->getOsVersion();
- $_data['screen'] = $device->getScreen();
- $_data['net'] = $device->getNet();
- $_data['imsi'] = $device->getImsi();
- $_data['longitude'] = $device->getLongitude();
- $_data['latitude'] = $device->getLatitude();
- $_data['userua'] = $device->getUserua();
- $_data['from'] = $device->getFrom();
- $_data['open_cnt'] = $device->getOpenCnt();
- $_data['event'] = $event->getEvent();
- $_data['status'] = $event->getStatus();
- $_data['context'] = $event->getContext();
- $_event_model = new EventLogModel();
- return $_event_model->insertLog($_data);
- }
- /**
- * 插入奔溃记录
- *
- * @param Crash $crash
- * @param GameRq $game_rq
- * @param Channel $channel
- * @param Device $device
- *
- * @return bool|mixed
- */
- public function insertCrashLog(Crash $crash, GameRq $game_rq, Channel $channel, Device $device) {
- $_data['agent_id'] = $channel->getAgentId();
- $_data['agent_game'] = $channel->getAgentGame();
- $_data['app_id'] = $game_rq->getHAppId();
- $_data['device_id'] = $device->getDeviceId();
- $_data['mac'] = $device->getMac();
- $_data['ip'] = $device->getIp();
- $_data['brand'] = $device->getBrand();
- $_data['model'] = $device->getModel();
- $_data['os'] = $device->getOs();
- $_data['os_version'] = $device->getOsVersion();
- $_data['screen'] = $device->getScreen();
- $_data['net'] = $device->getNet();
- $_data['imsi'] = $device->getImsi();
- $_data['longitude'] = $device->getLongitude();
- $_data['latitude'] = $device->getLatitude();
- $_data['userua'] = $device->getUserua();
- $_data['from'] = $device->getFrom();
- $_data['open_cnt'] = $device->getOpenCnt();
- $_data['active'] = $crash->getActive();
- $_data['msg'] = $crash->getMsg();
- $_crash_model = new CrashLogModel();
- return $_crash_model->insertLog($_data);
- }
- public function insertHeartLog(GameRq $game_rq, Channel $channel, Device $device, Mem $member) {
- $_data['mem_id'] = $member->getMemId();
- $_data['agent_id'] = $channel->getAgentId();
- $_data['agent_game'] = $channel->getAgentGame();
- $_data['app_id'] = $game_rq->getHAppId();
- $_data['device_id'] = $device->getDeviceId();
- $_data['mac'] = $device->getMac();
- $_data['ip'] = $device->getIp();
- $_data['brand'] = $device->getBrand();
- $_data['model'] = $device->getModel();
- $_data['os'] = $device->getOs();
- $_data['os_version'] = $device->getOsVersion();
- $_data['screen'] = $device->getScreen();
- $_data['net'] = $device->getNet();
- $_data['imsi'] = $device->getImsi();
- $_data['longitude'] = $device->getLongitude();
- $_data['latitude'] = $device->getLatitude();
- $_data['userua'] = $device->getUserua();
- $_data['from'] = $device->getFrom();
- $_data['open_cnt'] = $device->getOpenCnt();
- $_heart_model = new OnlineLogModel();
- return $_heart_model->insertLog($_data);
- }
- }
|