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.

37 lines
941 B

  1. <?php
  2. namespace App\Service\v3\Implementations;
  3. use App\Constants\v3\ErrorCode;
  4. use App\Exception\ErrorCodeException;
  5. use App\Service\v3\Interfaces\ShopCartUpdateServiceInterface;
  6. class ShopCartUpdateService implements ShopCartUpdateServiceInterface
  7. {
  8. public function do($params)
  9. {
  10. switch ($params['goods_id'])
  11. {
  12. case 1000:
  13. throw new ErrorCodeException(ErrorCode::GOODS_INVENTORY_ERROR);
  14. break;
  15. case 2000:
  16. throw new ErrorCodeException(ErrorCode::PURCHASE_LIMIT_ERROR);
  17. break;
  18. case 3000:
  19. throw new ErrorCodeException(ErrorCode::SPERCIAL_OFFER_GOODS_ERROR);
  20. break;
  21. default:
  22. return true;
  23. }
  24. }
  25. public function check()
  26. {
  27. // TODO: Implement check() method.
  28. }
  29. public function undo($params)
  30. {
  31. return true;
  32. }
  33. }