Mem.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. /**
  3. * Mem.php UTF-8
  4. * 玩家事件处理
  5. *
  6. * @date : 2018/5/30 16:46
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : wuyonghong <wyh@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace huo\controller\queue;
  13. use huo\controller\request\Channel;
  14. use huo\controller\request\Device;
  15. use huo\controller\request\Game;
  16. use huo\controller\request\Mem as MemRq;
  17. use huolib\queue\constant\EventConst;
  18. class Mem extends SdkQueue {
  19. /**
  20. * 玩家创建
  21. * 记录玩家创建账户的日志,在该账户首次生成时调用。
  22. * http://doc.1tsdk.com/138?page_id=3379
  23. *
  24. * @param Device $device_rq
  25. * @param Game $game_rq
  26. * @param Channel $agent_rq
  27. * @param MemRq $mem_rq
  28. *
  29. * @return array
  30. */
  31. public function create(Device $device_rq, Game $game_rq, Channel $agent_rq, MemRq $mem_rq) {
  32. $this->param['event'] = EventConst::EVENT_MEM_REG;
  33. $this->setParamDevice($device_rq);
  34. $this->setParamGame($game_rq);
  35. $this->setParamChannel($agent_rq);
  36. $this->setParamMem($mem_rq);
  37. $this->param['ts'] = $mem_rq->getRegTime();
  38. return $this->pushQueue();
  39. }
  40. /**
  41. * 玩家登陆
  42. * 记录玩家账号登录的日志,输入账户和密码后,进入到“选择服务器”界面即可调用。
  43. * http://doc.1tsdk.com/138?page_id=3380
  44. *
  45. * @param Device $device_rq
  46. * @param Game $game_rq
  47. * @param Channel $agent_rq
  48. * @param MemRq $mem_rq
  49. *
  50. * @return array
  51. */
  52. public function online(Device $device_rq, Game $game_rq, Channel $agent_rq, MemRq $mem_rq) {
  53. $this->param['event'] = EventConst::EVENT_MEM_LOGIN;
  54. $this->setParamDevice($device_rq);
  55. $this->setParamGame($game_rq);
  56. $this->setParamChannel($agent_rq);
  57. $this->setParamMem($mem_rq);
  58. $this->param['ts'] = $mem_rq->getLoginTime();
  59. return $this->pushQueue();
  60. }
  61. /**
  62. * 玩家登出
  63. * 记录玩家登出游戏的日志,执行“切换账户”、“退出游戏”操作时调用。
  64. * http://doc.1tsdk.com/138?page_id=3382
  65. *print_r($_rs);
  66. * @param Device $device_rq
  67. * @param Game $game_rq
  68. * @param Channel $agent_rq
  69. * @param MemRq $mem_rq
  70. *
  71. * @return array
  72. */
  73. public function offline(Device $device_rq, Game $game_rq, Channel $agent_rq, MemRq $mem_rq) {
  74. $this->param['event'] = EventConst::EVENT_MEM_LOGOUT;
  75. $this->setParamDevice($device_rq);
  76. $this->setParamGame($game_rq);
  77. $this->setParamChannel($agent_rq);
  78. $this->setParamMem($mem_rq);
  79. return $this->pushQueue();
  80. }
  81. }