<?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(), "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" => "json", ]); return $this->ok($this->service->categoryGoods($params)); } public function categoryTree() { return $this->ok([ "categoryTree" => $this->service->categoryTree(), ]); } public function search() { $params = $this->valid([ "keyword" => "", "attrs" => "json", ]); return $this->ok($this->service->search($params)); } }