GameController.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * GameController.php UTF-8
  4. * 游戏处理类
  5. *
  6. * @date : 2018/1/19 16:14
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : linjiebin <ljb@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace web\pc\controller\v8;
  13. use huolib\constant\GameConst;
  14. use web\common\controller\WebBaseController;
  15. use web\pc\logic\GameLogic;
  16. class GameController extends WebBaseController {
  17. public function __construct() {
  18. parent::__construct();
  19. }
  20. public function index() {
  21. $_web_info = $this->web_info;
  22. $this->set_seo($_web_info['web_basic']['company_name']);
  23. $_type = $this->request->param('type', 0);
  24. $_classify = $this->request->param('classify', 0);
  25. $_name = $this->request->param('gamename', '');
  26. $_page = $this->request->param('page', 0);
  27. $_game_class = new GameLogic();
  28. $_rdata['platform'] = $_game_class->gamePlatfromClass();
  29. $_rdata['type'] = $_game_class->getCategory(['parent_id' => 0]);
  30. $_rdata['theme'] = $_game_class->getCategory(['parent_id' => ['neq', 0]]);
  31. if($_classify == GameConst::GAME_IOS){
  32. $_classify = ['in',[GameConst::GAME_IOS,GameConst::GAME_IOS_SWITCH]];
  33. }
  34. $_map['classify'] = $_classify;
  35. $_map['type'] = $_type;
  36. $_map['name'] = $_name;
  37. $_rdata['game_list'] = $_game_class->getList($_map, $_page.',10','-list_order');
  38. if ($this->request->isAjax()) {
  39. return $_rdata;
  40. }
  41. $this->assign($_rdata);
  42. return $this->fetch('Game/index');
  43. }
  44. public function detail() {
  45. $_gameid = $this->request->param('gameid', 0);
  46. if (empty($_gameid)) {
  47. $this->error('参数错误');
  48. }
  49. $_game_class = new GameLogic();
  50. $_rdata['detail'] = $_game_class->getDetail(['id' => $_gameid]);
  51. $_rdata['similar'] = $_game_class->getSimilarList($_gameid, $_rdata['detail']['category'], '1,5', '');
  52. $_web_info = $this->web_info;
  53. $this->set_seo($_web_info['web_basic']['company_name'],$_rdata['detail']['gamename']);
  54. $this->assign($_rdata);
  55. return $this->fetch('Game/detail');
  56. }
  57. }