123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- <?php
- namespace App\Modules\Mini\Controllers;
- use App\Base\BaseController;
- use App\Modules\Mini\Services\PageService;
- use Faker\Provider\Image;
- class PageController extends BaseController
- {
- protected PageService $service;
- /**
- * @param PageService $service
- */
- public function __construct(PageService $service)
- {
- $this->service = $service;
- }
- public function filterConfig()
- {
- $params = $this->valid([
- "type" => "",
- ]);
- return $this->ok([
- "list" => $this->service->filterConfig($params),
- ]);
- }
- public function home()
- {
- return $this->ok([
- "banner" => $this->service->banner(),
- "categoryTree" => $this->service->categoryTree("home"),
- "hot_goods" => $this->service->hotGoods(10),
- "recommend_goods" => $this->service->recommendedGoods(10),
- ]);
- }
- public function categoryGoods()
- {
- $params = $this->valid([
- "id" => "required",
- "page_size" => "int",
- "keyword" => "",
- "attrs" => "",
- ]);
- return $this->ok($this->service->categoryGoods($params));
- }
- public function categoryTree()
- {
- return $this->ok([
- "categoryTree" => $this->service->categoryTree("category"),
- ]);
- }
- public function search()
- {
- $params = $this->valid([
- "keyword" => "",
- "attrs" => "",
- ]);
- return $this->ok($this->service->search($params));
- }
- }
|