GameController.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <?php
  2. /**
  3. * GameController.php UTF-8
  4. * H5浮点游戏控制
  5. *
  6. * @date : 2018/5/3 11:17
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : wuyonghong <wyh@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace api\float\controller;
  13. use api\common\controller\FloatBaseController;
  14. use huo\controller\game\Game;
  15. use huo\controller\game\GameList;
  16. use huolib\constant\GameConst;
  17. use huolib\status\GameStatus;
  18. class GameController extends FloatBaseController {
  19. public function _initialize() {
  20. parent::_initialize();
  21. $this->checkLogin();
  22. }
  23. /**
  24. * H5浮点游戏列表
  25. * http://doc.1tsdk.com/138?page_id=3211
  26. * 【域名】/float/game/list
  27. */
  28. public function index() {
  29. $_game_id = $this->game_id;
  30. $_mem_id = $this->mem_id;
  31. $_page = $this->request->param('page/d', 1);
  32. $_offset = $this->request->param('offset/d', 10);
  33. $_gl_class = new GameList();
  34. $_from = GameConst::GAME_H5;
  35. $_rg_page = '1,3';
  36. $_rcmd_game = $_gl_class->getRcmdList($_from, $_rg_page);
  37. if (GameStatus::NO_ERROR != $_rcmd_game['code']) {
  38. $_rcmd_game = null;
  39. }
  40. $_rdata['rcmd_game'] = $_rcmd_game['data'];
  41. $_ng_page = "$_page,$_offset";
  42. $_new_game = $_gl_class->getNewList($_from, $_ng_page);
  43. if (GameStatus::NO_ERROR != $_new_game['code']) {
  44. $_new_game = null;
  45. }
  46. $_rdata['new_game'] = $_new_game['data'];
  47. $_code = GameStatus::NO_ERROR;
  48. $this->success(GameStatus::getMsg($_code), $_rdata, $_code);
  49. }
  50. }