Page.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2017~2024 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 think\response\Json;
  14. use app\api\model\Page as PageModel;
  15. /**
  16. * 页面控制器
  17. * Class Index
  18. * @package app\api\controller
  19. */
  20. class Page extends Controller
  21. {
  22. /**
  23. * 页面数据
  24. * @param int|null $pageId 页面ID, 不传的话默认为首页
  25. * @return Json
  26. * @throws \cores\exception\BaseException
  27. * @throws \think\Exception
  28. * @throws \think\db\exception\DataNotFoundException
  29. * @throws \think\db\exception\DbException
  30. * @throws \think\db\exception\ModelNotFoundException
  31. */
  32. public function detail(int $pageId = null): Json
  33. {
  34. // 页面数据
  35. $model = new PageModel;
  36. $pageData = $model->getPageData($pageId);
  37. return $this->renderSuccess(compact('pageData'));
  38. }
  39. }