ApiPage.Class.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php
  2. /**
  3. * 页面
  4. * Created by PhpStorm.
  5. * User: XiaoMing
  6. * Date: 2020/3/19
  7. * Time: 15:51
  8. */
  9. namespace JinDouYun\Controller\System;
  10. use JinDouYun\Controller\BaseController;
  11. use JinDouYun\Model\System\MPage;
  12. class ApiPage extends BaseController
  13. {
  14. private $objMPage;
  15. /**
  16. * ApiPage constructor.
  17. * @param bool $isCheckAcl
  18. * @param bool $isMustLogin
  19. * @param bool $checkToken
  20. * @param bool $getAreaCode
  21. * @throws \Exception
  22. */
  23. public function __construct($isCheckAcl = false, $isMustLogin = false,$checkToken=true,$getAreaCode=true)
  24. {
  25. parent::__construct($isCheckAcl, $isMustLogin, $checkToken,$getAreaCode);
  26. $authorization = $this->request->getServerParam('HTTP_AUTHORIZATION');
  27. if (!empty($authorization)) {
  28. self::getUserIdByAuthorization();
  29. }
  30. $this->objMPage = new MPage($this->onlineUserId,$this->onlineEnterpriseId,$this->areaCode);
  31. }
  32. /**
  33. * 获取app首页(现在没有用了,统一用的homePage)
  34. *
  35. * @throws \Exception
  36. * @deprecated
  37. */
  38. public function home()
  39. {
  40. $result = $this->objMPage->home();
  41. if ($result->isSuccess()) {
  42. parent::sendOutput($result->getData());
  43. }
  44. parent::sendOutput($result->getData(), $result->getErrorCode());
  45. }
  46. /**
  47. * 根据id获取页面详情(主要用来获取专题详情页)
  48. * @throws \Exception
  49. */
  50. public function getDetailById()
  51. {
  52. $id = $this->request->param('request_id');
  53. $result = $this->objMPage->getDetailById($id);
  54. if ($result->isSuccess()) {
  55. parent::sendOutput($result->getData());
  56. }
  57. parent::sendOutput($result->getData(), $result->getErrorCode());
  58. }
  59. }