123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- <?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()
- {
- return $this->ok([
- [
- "id" => 1,
- "name" => "类目示例",
- "type" => "category",
- "child" => [
- [
- "id" => 1,
- "name" => "名称",
- ],
- ],
- ],
- [
- "id" => 1,
- "name" => "属性示例",
- "type" => "attr",
- "child" => [
- [
- "id" => 1,
- "name" => "名称",
- ],
- ],
- ],
- ]);
- }
- 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 categoryGoods()
- {
- return $this->ok([
- "total" => 1,
- "page_total" => 1,
- "list" => [
- [
- "id" => 1,
- "name" => "商品名称",
- "thumb" => Image::imageUrl(),
- ],
- ],
- ]);
- }
- public function categoryTree()
- {
- return $this->ok([
- "categoryTree" => [
- [
- "id" => 1,
- "name" => "一级分类",
- "child" => [
- [
- "id" => 1,
- "name" => "二级分类",
- "child" => [
- [
- "id" => 1,
- "name" => "二级分类",
- ],
- ],
- ],
- ],
- ],
- ],
- ]);
- }
- public function goods()
- {
- return $this->ok([
- "id" => 1,
- "image_list" => [
- Image::imageUrl(),
- Image::imageUrl(),
- ],
- "spec" => [
- "id" => 1,
- "name" => "颜色",
- "attr" => [
- [
- "id" => 1,
- "name" => "红色",
- ],
- ],
- ],
- "sku" => [
- [
- "id" => 1,
- "sn" => "sn",
- "url_3d" => "",
- "spec_attr" => [
- [
- "id" => 1,
- "name" => "白色",
- ],
- [
- "id" => 3,
- "name" => "大号",
- ],
- ],
- ],
- ],
- "desc_html" => "<h1>desc_html</h1>",
- "spec_attr_html" => "<h1>desc_html</h1>",
- "faq_html" => "<h1>desc_html</h1>",
- ]);
- }
- }
|