| 1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- namespace app\controller\api;
- use app\extra\basic\Base;
- use app\middleware\HomeMiddleware;
- use app\model\cpa\CpaPage;
- use LinFly\Annotation\Attributes\Route\Controller;
- use LinFly\Annotation\Attributes\Route\GetMapping;
- use LinFly\Annotation\Attributes\Route\Middleware;
- use support\Request;
- use support\Response;
- #[Controller("/web"),Middleware(HomeMiddleware::class)]
- class Home extends Base
- {
- #[GetMapping('portal')]
- public function getDesignData(Request $request): Response
- {
- try {
- $param = $request->all();
- if (empty($param['pageId'])) return error("参数错误");
- $page = (new CpaPage)->where("link_code",$param['pageId'])->findOrEmpty();
- if ($page->isEmpty()) return error("数据错误");
- return success("success",[
- "title" => $page['title'],
- "design" => $page['content']
- ]);
- } catch (\Throwable $th) {
- return error($th->getMessage());
- }
- }
- }
|