GameserverController.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * GameserverController.php UTF-8
  4. *
  5. *
  6. * @date : 2018/5/28 16:47
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : luowei <lw@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace api\cfloat\controller;
  13. use api\common\controller\CFloatBaseController;
  14. use huo\controller\game\GameServer;
  15. use huolib\constant\CommonConst;
  16. class GameserverController extends CFloatBaseController {
  17. public function _initialize() {
  18. parent::_initialize();
  19. $this->checkLogin();
  20. }
  21. /**
  22. * Client浮点获取游戏开服列表
  23. * http://doc.1tsdk.com/138?page_id=3275
  24. * 【域名】/cfloat/gameserver/list
  25. */
  26. public function index() {
  27. $_page = get_val($this->rq_data, 'page', 1); /* 页码 默认为1 代表第一页 1 */
  28. $_offset = get_val($this->rq_data, 'offset', 10); /* 每页显示数量 默认为10 */
  29. $_server_type = get_val($this->rq_data, 'server_type', 0); /*开服类型*/
  30. $_app_id = get_val($this->rq_data, 'app_id'); /* 游戏id */
  31. $_map = ['app_id' => $_app_id, 'is_delete' => CommonConst::CONST_NOT_DELETE];
  32. if (!empty($_server_type)) {
  33. $_map['server_type'] = $_server_type;
  34. }
  35. $_page = $_page.','.$_offset;
  36. $_server_list = (new GameServer())->getServerList($_map, $_page);;
  37. $this->returnData($_server_list);
  38. }
  39. }