Page.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
  8. // +----------------------------------------------------------------------
  9. // | Author: 萤火科技 <admin@yiovo.com>
  10. // +----------------------------------------------------------------------
  11. declare (strict_types = 1);
  12. namespace app\api\controller;
  13. use app\api\model\Page as PageModel;
  14. /**
  15. * 页面控制器
  16. * Class Index
  17. * @package app\api\controller
  18. */
  19. class Page extends Controller
  20. {
  21. /**
  22. * 页面数据
  23. * @param int|null $pageId 页面ID, 不传的话默认为首页
  24. * @return array|\think\response\Json
  25. * @throws \app\common\exception\BaseException
  26. * @throws \think\db\exception\DataNotFoundException
  27. * @throws \think\db\exception\DbException
  28. * @throws \think\db\exception\ModelNotFoundException
  29. */
  30. public function detail(int $pageId = null)
  31. {
  32. // 页面数据
  33. $model = new PageModel;
  34. $pageData = $model->getPageData($pageId);
  35. return $this->renderSuccess(compact('pageData'));
  36. }
  37. }