GoodsController.php 955 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. namespace app\api\controller;
  3. use app\api\lists\GoodsLists;
  4. use app\api\logic\GoodsLogic;
  5. use app\api\validate\GoodsValidate;
  6. /**
  7. * 用户控制器
  8. * Class UserController
  9. * @package app\api\controller
  10. */
  11. class GoodsController extends BaseApiController
  12. {
  13. public array $notNeedLogin = ['lists'];
  14. public function lists()
  15. {
  16. return $this->dataLists(new GoodsLists());
  17. }
  18. public function hotData(){
  19. $result = GoodsLogic::getHotData();
  20. return $this->data($result);
  21. }
  22. public function categoryDetail()
  23. {
  24. $params = (new GoodsValidate())->goCheck('category');
  25. $result = GoodsLogic::detail($params['goods_category_id'],'category');
  26. return $this->data($result);
  27. }
  28. public function goodsDetail()
  29. {
  30. $params = (new GoodsValidate())->goCheck('goods');
  31. $result = GoodsLogic::detail($params['id'],'goods');
  32. return $this->data($result);
  33. }
  34. }