JuheShopMarketing.php 879 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. namespace common\logic\order\marketing;
  3. use addons\JuheShop\common\service\OrderService;
  4. use common\enums\AddonsEnum;
  5. use common\enums\PreviewTypeEnum;
  6. use common\models\mall\MallAddons;
  7. use Exception;
  8. class JuheShopMarketing extends BaseMarketing
  9. {
  10. public function execute($form)
  11. {
  12. }
  13. public static function compute($item, &$form, &$extra)
  14. {
  15. $mall_id = $form['mall_id'];
  16. // 未安装插件
  17. if (!MallAddons::isInstall($mall_id, AddonsEnum::ADDONS_NAME_JUHE_SHOP)) return $item;
  18. // 不支持购物车
  19. if ($form->type != PreviewTypeEnum::BUY_NOW) {
  20. throw new Exception('供应链不支持购物车');
  21. }
  22. $order_service = new OrderService(['mall_id' => $mall_id]);
  23. $order_service->createBeforeCheck($item, $form['address_id']);
  24. return $item;
  25. }
  26. }