ConsumerCouponsMarketing.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. namespace common\logic\order\marketing;
  3. use common\enums\AddonsEnum;
  4. use common\models\mall\MallAddons;
  5. /**
  6. * Class ConsumerCouponsMarketing
  7. * 满减计算
  8. * @Author: lun
  9. * @DateTime: 2021/9/30 0030 14:53
  10. * @Copyright: copyright (c) 2021 广东七件事集团
  11. * @package common\logic\order\marketing
  12. */
  13. class ConsumerCouponsMarketing extends BaseMarketing{
  14. public function execute($form){}
  15. /**
  16. * 满减计算
  17. * @Author: lun
  18. * @DateTime: 2021/10/6 0006 10:55
  19. * @Copyright: copyright (c) 2021 广东七件事集团
  20. * @param $item
  21. * @param $form
  22. * @return mixed
  23. */
  24. public static function compute($item, &$form,&$extra = [])
  25. {
  26. try {
  27. // 检测是否有安装消费券拓客应用
  28. if (MallAddons::isInstall($item['mch_order_info']['mall_id'], AddonsEnum::ADDONS_NAME_AGENT_BONUS)) {
  29. $marketing = new \addons\ConsumerCoupons\common\logic\order\ConsumerCouponsMarketing();
  30. $item = $marketing::compute($item, $form,$extra);
  31. if ($item == false) throw new \Exception($marketing::getStaticError());
  32. }
  33. return $item;
  34. } catch (\Exception $e) {
  35. self::setStaticError($e->getMessage());
  36. return false;
  37. }
  38. }
  39. }