ToStoreDelivery.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. namespace addons\TinyShop\common\components\delivery;
  3. use yii\web\UnprocessableEntityHttpException;
  4. use addons\TinyShop\common\components\PreviewInterface;
  5. use addons\TinyShop\common\forms\PreviewForm;
  6. /**
  7. * 到店
  8. *
  9. * Class ToStoreDelivery
  10. * @package addons\TinyShop\common\components\delivery
  11. * @author jianyan74 <751393839@qq.com>
  12. */
  13. class ToStoreDelivery extends PreviewInterface
  14. {
  15. /**
  16. * @param PreviewForm $form
  17. * @return PreviewForm
  18. * @throws UnprocessableEntityHttpException
  19. */
  20. public function execute(PreviewForm $form): PreviewForm
  21. {
  22. if (!$form->store) {
  23. throw new UnprocessableEntityHttpException('门店地点不存在');
  24. }
  25. $form->shipping_money = 0;
  26. return $form;
  27. }
  28. /**
  29. * 排斥营销
  30. *
  31. * @return array
  32. */
  33. public function rejectNames()
  34. {
  35. return [];
  36. }
  37. /**
  38. * 营销名称
  39. *
  40. * @return string
  41. */
  42. public static function getName(): string
  43. {
  44. return 'toStore';
  45. }
  46. }
粤ICP备19079148号