123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- <?php
- /**
- * App.php UTF-8
- * APP事件异步处理--生产者
- *
- * @date : 2018/5/30 16:43
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : wuyonghong <wyh@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace huo\controller\queue;
- use huo\controller\request\Channel;
- use huo\controller\request\Crash;
- use huo\controller\request\Device;
- use huo\controller\request\Game;
- use huolib\queue\constant\EventConst;
- class App extends SdkQueue {
- /**
- * app激活
- * 记录客户端被激活日志,用户下载APP后第一次打开客户端时调用。
- * http://doc.1tsdk.com/138?page_id=3375
- *
- * @param Device $device_rq
- * @param Game $game_rq
- * @param Channel $agent_rq
- *
- * @return array
- */
- public function activation(Device $device_rq, Game $game_rq, Channel $agent_rq) {
- $this->param['event'] = EventConst::EVENT_APP_ACTIVATION;
- $this->setParamDevice($device_rq);
- $this->setParamGame($game_rq);
- $this->setParamChannel($agent_rq);
- return $this->pushQueue();
- }
- /**
- * app启动
- * 记录客户端被启动日志,用户激活客户端后,每次跳转到SDK登录界面时调用。
- *
- * http://doc.1tsdk.com/138?page_id=3376
- * @param Device $device_rq
- * @param Game $game_rq
- * @param Channel $agent_rq
- *
- * @return array
- */
- public function startup(Device $device_rq, Game $game_rq, Channel $agent_rq) {
- $this->param['event'] = EventConst::EVENT_APP_STARTUP;
- $this->setParamDevice($device_rq);
- $this->setParamGame($game_rq);
- $this->setParamChannel($agent_rq);
- return $this->pushQueue();
- }
- /**
- * app崩溃
- * 记录客户端异常的日志,用户激活无法跳转到SDK登录界面、闪退等异常情况时调用。
- * http://doc.1tsdk.com/138?page_id=3377
- *
- * @param Device $device_rq
- * @param Game $game_rq
- * @param Channel $agent_rq
- * @param Crash $crash_rq
- *
- * @return array
- */
- public function crash(Device $device_rq, Game $game_rq, Channel $agent_rq, Crash $crash_rq) {
- $this->param['event'] = EventConst::EVENT_APP_CRASH;
- $this->setParamDevice($device_rq);
- $this->setParamGame($game_rq);
- $this->setParamChannel($agent_rq);
- $this->param['crash'] = [
- 'active' => $crash_rq->getActive(),
- 'msg' => $crash_rq->getMsg(),
- ];
- return $this->pushQueue();
- }
- /**
- * app心跳
- * 客户端每2分钟上报一次客户端活跃状态的事件
- * http://doc.1tsdk.com/138?page_id=3378
- *
- * @param Device $device_rq
- * @param Game $game_rq
- * @param Channel $agent_rq
- *
- * @return array
- */
- public function heartbeat(Device $device_rq, Game $game_rq, Channel $agent_rq) {
- $this->param['event'] = EventConst::EVENT_APP_HEARTBEAT;
- $this->setParamDevice($device_rq);
- $this->setParamGame($game_rq);
- $this->setParamChannel($agent_rq);
- return $this->pushQueue();
- }
- }
|