HomeController.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. /**
  3. * HomeController.php UTF-8
  4. * H5 WAP 首页
  5. *
  6. * @date : 2018/4/27 14:56
  7. *
  8. * @license 这不是一个自由软件,未经授权不许任何使用和传播。
  9. * @author : wuyonghong <wyh@huosdk.com>
  10. * @version : HUOSDK 8.0
  11. */
  12. namespace h5wap\wap\controller;
  13. use h5wap\common\controller\V2BaseController;
  14. use huo\controller\game\GameList;
  15. use huo\controller\slide\Slide;
  16. use huo\controller\wap\Option;
  17. use huolib\constant\GameConst;
  18. use huolib\constant\SlideConst;
  19. use huolib\status\AdsStatus;
  20. use huolib\status\GameStatus;
  21. use huo\controller\member\Member;
  22. class HomeController extends V2BaseController {
  23. public function _initialize() {
  24. parent::_initialize();
  25. }
  26. public function index() {
  27. $_mem_id = $this->mem_id;
  28. $_ads_class = new Slide();
  29. $_hometopper = $_ads_class->getList(SlideConst::SLIDE_H5WAP_TOPPER);// TODO: wuyonghong 2018/4/27 首页轮播图
  30. if (empty($_hometopper) || AdsStatus::NO_ERROR != $_hometopper['code']) {
  31. $_rdata['hometopper'] = null;
  32. } else {
  33. $_rdata['hometopper'] = $_hometopper['data'];
  34. }
  35. $_game_class = new GameList();
  36. $_from = GameConst::GAME_H5;
  37. $_played_game = $_game_class->getPlayedList($_mem_id, $_from);
  38. if (empty($_played_game) || GameStatus::NO_ERROR != $_played_game['code']) {
  39. $_rdata['playedgame'] = null;
  40. } else {
  41. $_rdata['playedgame'] = $_played_game['data'];
  42. }
  43. $_hotgame = $_game_class->getHotList($_from);
  44. if (empty($_hotgame) || GameStatus::NO_ERROR != $_hotgame['code']) {
  45. $_rdata['hotgame'] = null;
  46. } else {
  47. $_rdata['hotgame'] = $_hotgame['data'];
  48. }
  49. if ($this->mem_id) {
  50. $_data = (new Member())->getMemInfo($this->mem_id);
  51. $_rdata['userinfo'] = $_data;
  52. } else {
  53. $_rdata['userinfo'] = null;
  54. }
  55. $this->assign('hometopper', $_rdata['hometopper']);
  56. $this->assign('playedgame', $_rdata['playedgame']);
  57. $this->assign('hotgame', $_rdata['hotgame']);
  58. $this->assign('userinfo', $_rdata['userinfo']);
  59. //添加seo优化信息
  60. $_seo_data = Option::ins()->getSeoValue('h5_wap_index_seo');
  61. $this->assign('seo', $_seo_data);
  62. return $this->fetch('home/index');
  63. }
  64. }