PageController.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. <?php
  2. namespace App\Modules\Pc\Controllers;
  3. use App\Base\BaseController;
  4. use App\Modules\Mini\Services\PageService;
  5. use Faker\Provider\Image;
  6. class PageController extends BaseController
  7. {
  8. protected PageService $service;
  9. /**
  10. * @param PageService $service
  11. */
  12. public function __construct(PageService $service)
  13. {
  14. $this->service = $service;
  15. }
  16. public function filterConfig()
  17. {
  18. return $this->ok([
  19. [
  20. "id" => 1,
  21. "name" => "类目示例",
  22. "type" => "category",
  23. "child" => [
  24. [
  25. "id" => 1,
  26. "name" => "名称",
  27. ],
  28. ],
  29. ],
  30. [
  31. "id" => 1,
  32. "name" => "属性示例",
  33. "type" => "attr",
  34. "child" => [
  35. [
  36. "id" => 1,
  37. "name" => "名称",
  38. ],
  39. ],
  40. ],
  41. ]);
  42. }
  43. public function home()
  44. {
  45. return $this->ok([
  46. "banner" => $this->service->banner(),
  47. "categoryTree" => [
  48. [
  49. "id" => 1,
  50. "name" => "一级分类",
  51. "child" => [
  52. [
  53. "id" => 1,
  54. "name" => "二级分类",
  55. ],
  56. ],
  57. ],
  58. ],
  59. "hot_goods" => [
  60. [
  61. "id" => 1,
  62. "name" => "商品名称",
  63. "thumb" => Image::imageUrl(),
  64. ],
  65. ],
  66. "recommend_goods" => [
  67. [
  68. "id" => 1,
  69. "name" => "商品名称",
  70. "thumb" => Image::imageUrl(),
  71. ],
  72. ],
  73. ]);
  74. }
  75. public function categoryGoods()
  76. {
  77. return $this->ok([
  78. "total" => 1,
  79. "page_total" => 1,
  80. "list" => [
  81. [
  82. "id" => 1,
  83. "name" => "商品名称",
  84. "thumb" => Image::imageUrl(),
  85. ],
  86. ],
  87. ]);
  88. }
  89. public function categoryTree()
  90. {
  91. return $this->ok([
  92. "categoryTree" => [
  93. [
  94. "id" => 1,
  95. "name" => "一级分类",
  96. "child" => [
  97. [
  98. "id" => 1,
  99. "name" => "二级分类",
  100. "child" => [
  101. [
  102. "id" => 1,
  103. "name" => "二级分类",
  104. ],
  105. ],
  106. ],
  107. ],
  108. ],
  109. ],
  110. ]);
  111. }
  112. public function search()
  113. {
  114. return $this->ok([
  115. "total" => 1,
  116. "page_total" => 1,
  117. "list" => [
  118. [
  119. "id" => 1,
  120. "name" => "商品名称",
  121. "thumb" => Image::imageUrl(),
  122. ],
  123. ],
  124. "category" => [
  125. [
  126. "id" => 1,
  127. "thumb" => Image::imageUrl(),
  128. "name" => "分类名称",
  129. ],
  130. ],
  131. ]);
  132. }
  133. }