GoodsController.php 1.1 KB

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