123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- <?php
- /**
- * GameController.php UTF-8
- * H5 WAP 游戏
- *
- * @date : 2018/4/27 17:39
- *
- * @license 这不是一个自由软件,未经授权不许任何使用和传播。
- * @author : liuhongliang <lhl@huosdk.com>
- * @version : HUOSDK 8.0
- */
- namespace h5wap\wap\controller;
- use h5wap\common\controller\V2BaseController;
- use huo\controller\game\Game;
- use huo\controller\game\GameList;
- use huo\controller\wap\Option;
- use huo\logic\game\GameLogic;
- use huo\model\game\CategoryModel;
- use huolib\constant\CategoryConst;
- use huolib\constant\FormatConst;
- use huolib\constant\GameConst;
- use huolib\status\GameStatus;
- class GameController extends V2BaseController {
- public function _initialize() {
- parent::_initialize();
- }
- /**
- * H5WAP游戏列表
- * http://doc.1tsdk.com/138?page_id=3217
- * 【域名】/wap/game/list
- */
- public function index() {
- $_param = $this->request->param();
- $_page = $this->request->param('page/d', 1);
- $_offset = $this->request->param('offset/d', 10);
- $_played = $this->request->param('played');
- $_gl_class = new GameList();
- $_map['classify'] = GameConst::GAME_H5;
- $_page = $_page.','.$_offset;
- if (GameConst::GAME_PLAYED == $_played) {
- if (empty($this->mem_id)) {
- $_data = null;
- $_code = GameStatus::NO_ERROR;
- $this->success(GameStatus::getMsg($_code), $_data, $_code);
- }
- $_rdata = $_gl_class->getPlayedList($this->mem_id, $_map['classify'], $_page);
- $this->returnData($_rdata);
- }
- $_rdata = $_gl_class->getList($_param, $_page, $_map);
- $this->returnData($_rdata);
- }
- public function gameList() {
- return $this->fetch('game/index');
- }
- public function getTypes() {
- $_type = CategoryConst::CATE_TYPE_TAG_1;
- $_field = ['id', 'name', 'image', 'status', 'list_order', 'game_cnt', 'item_cnt'];
- $_tags = (new CategoryModel())->getList(0, '-list_order', $_type, $_field, false);
- $_rdata['data'] = $_tags;
- $_rdata['code'] = GameStatus::NO_ERROR;
- $_rdata['msg'] = GameStatus::getMsg(GameStatus::NO_ERROR);
- $this->returnData($_rdata);
- }
- /**
- * H5-WAP开服游戏列表
- * http://doc.1tsdk.com/138?page_id=3233
- * 【域名】/wap/gameserver/index
- */
- public function server() {
- $_page = $this->request->param('page/d', 1);
- $_offset = $this->request->param('offset/d', 10);
- $_gl_class = new GameList();
- $_from = GameConst::GAME_H5;
- $_page = $_page.','.$_offset;
- $_server_type = $this->request->param('server_type/d', GameConst::GAME_SERVER_ALL);
- $_rdata = $_gl_class->getServerList($_server_type, $_from, $_page);
- $this->returnData($_rdata);
- }
- /**
- * http://doc.1tsdk.com/138?page_id=3111
- * 游戏详情页
- * 【域名】/wap/game/detail
- *
- * @return mixed
- * @throws \think\Exception
- */
- public function detail() {
- $_game_id = $this->request->param('game_id/d', 0);
- $_game_data = (new Game())->getDetail($_game_id, $this->mem_id);
- if (FormatConst::FORMAT_HTML == $this->response_type) {
- $this->assign($_game_data['data']);
- //添加seo优化信息
- $_seo_data = Option::ins()->getSeoValue('h5_wap_gamedetails_seo', $_game_id);
- $this->assign('seo', $_seo_data);
- return $this->fetch('game/detail');
- }
- return $this->returnData($_game_data);
- }
- }
|