1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- <?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 home()
- {
- return $this->ok([
- "banner" => $this->service->banner(),
- "categoryTree" => [
- [
- "id" => 1,
- "name" => "一级分类",
- "child" => [
- [
- "id" => 1,
- "name" => "二级分类",
- ],
- ],
- ],
- ],
- "hot_goods" => [
- [
- "id" => 1,
- "name" => "商品名称",
- "thumb" => Image::imageUrl(),
- ],
- ],
- "recommend_goods" => [
- [
- "id" => 1,
- "name" => "商品名称",
- "thumb" => Image::imageUrl(),
- ],
- ],
- ]);
- }
- public function categoryTree()
- {
- return $this->ok([
- "categoryTree" => [
- [
- "id" => 1,
- "name" => "一级分类",
- "child" => [
- [
- "id" => 1,
- "name" => "二级分类",
- "child" => [
- [
- "id" => 1,
- "name" => "二级分类",
- ],
- ],
- ],
- ],
- ],
- ],
- ]);
- }
- }
|