You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
915 B

  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Controller;
  4. use App\Service\ShopCarService;
  5. use Hyperf\Di\Annotation\Inject;
  6. use App\Service\ShopCarServiceInterface;
  7. use App\Constants\ErrorCode;
  8. class ShopCarController extends BaseController
  9. {
  10. /**
  11. * @Inject
  12. * @var ShopCarServiceInterface
  13. */
  14. protected $shopCarService;
  15. public function addShopCar()
  16. {
  17. $res = $this->shopCarService->addShopCar($this->request->all());
  18. if (isset($res['error'])) {
  19. return $this->result(ErrorCode::GOODS_FAILURE, '', $res['error']);
  20. }
  21. return $this->success($res);
  22. }
  23. public function updateShopCar()
  24. {
  25. $res = $this->shopCarService->updateShopCar($this->request->all());
  26. if (isset($res['error'])) {
  27. return $this->result(ErrorCode::GOODS_FAILURE, '', $res['error']);
  28. }
  29. return $this->success($res);
  30. }
  31. }