GoodsDeductMarketing.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace common\logic\order\marketing;
  3. use addons\Agent\common\enums\ComputingEnum;
  4. use addons\Agent\common\logic\reward\AgentReward;
  5. use addons\Agent\common\models\Agent;
  6. use addons\Agent\common\models\AgentCommissionItemSetting;
  7. use addons\Agent\common\models\AgentLevel;
  8. use addons\Mch\common\models\MchGoodsModel;
  9. use common\enums\AddonsEnum;
  10. use common\enums\StatusEnum;
  11. use common\events\data\api\AgentMarketingEvent;
  12. use common\events\data\api\GoodsDeductEvent;
  13. use common\models\mall\MallAddons;
  14. use Exception;
  15. use phpDocumentor\Reflection\Types\Self_;
  16. use Yii;
  17. use yii\helpers\Json;
  18. /**
  19. * 经销商内购折扣
  20. * Class AgentMarketing
  21. * @Author: hua
  22. * @DateTime: 2022/1/14 17:22
  23. * @Copyright: copyright (c) 2021 广东七件事集团
  24. * @package common\logic\order\marketing渠道分红
  25. */
  26. class GoodsDeductMarketing extends BaseMarketing
  27. {
  28. public function execute($form)
  29. {
  30. }
  31. public static function compute($item, &$form, &$extra)
  32. {
  33. try {
  34. $mall_id = $form['mall_id'];
  35. $event = new AgentMarketingEvent($mall_id, $item, $form, $extra);
  36. Yii::$app->services->events->dispatch($event);
  37. $data = $event->getResultForm();
  38. $item = $data['item'];
  39. $form = $data['form'];
  40. $extra = $data['extra'];
  41. return $item;
  42. } catch (Exception $e) {
  43. self::setStaticError('经销商内购商品抵扣计算错误:' . $e->getMessage());
  44. return false;
  45. }
  46. }
  47. public static function getDeductMoney($mall_id,$user_id,$goods_attr_id_arr){
  48. $event = new GoodsDeductEvent($mall_id, $user_id, $goods_attr_id_arr);
  49. Yii::$app->services->events->dispatch($event);
  50. $result = $event->getResultForm();
  51. return $result;
  52. }
  53. }