GoodsController.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. namespace App\Modules\Mini\Controllers;
  3. use App\Base\BaseController;
  4. use App\Modules\Mini\Services\PageService;
  5. use Faker\Provider\Image;
  6. class GoodsController 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 goods()
  17. {
  18. return $this->ok([
  19. "id" => 1,
  20. "image_list" => [
  21. Image::imageUrl(),
  22. Image::imageUrl(),
  23. ],
  24. "spec" => [
  25. "id" => 1,
  26. "name" => "颜色",
  27. "attr" => [
  28. [
  29. "id" => 1,
  30. "name" => "红色",
  31. ],
  32. ],
  33. ],
  34. "sku" => [
  35. [
  36. "id" => 1,
  37. "sn" => "sn",
  38. "url_3d" => "",
  39. "spec_attr" => [
  40. [
  41. "id" => 1,
  42. "name" => "白色",
  43. ],
  44. [
  45. "id" => 3,
  46. "name" => "大号",
  47. ],
  48. ],
  49. ],
  50. ],
  51. "desc_html" => "<h1>desc_html</h1>",
  52. "spec_attr_html" => "<h1>desc_html</h1>",
  53. "faq_html" => "<h1>desc_html</h1>",
  54. ]);
  55. }
  56. public function search()
  57. {
  58. return $this->ok([
  59. "total" => 1,
  60. "page_total" => 1,
  61. "list" => [
  62. [
  63. "id" => 1,
  64. "name" => "商品名称",
  65. "thumb" => Image::imageUrl(),
  66. ],
  67. ],
  68. "category" => [
  69. [
  70. "id" => 1,
  71. "thumb" => Image::imageUrl(),
  72. "name" => "分类名称",
  73. ],
  74. ],
  75. ]);
  76. }
  77. public function fav()
  78. {
  79. return $this->ok();
  80. }
  81. public function ask()
  82. {
  83. return $this->ok([
  84. "id" => 1,
  85. "thumb" => Image::imageUrl(),
  86. "name" => "商品名称",
  87. "url" => "http://baidu.com/xxxx",
  88. ]);
  89. }
  90. }