RechargeRefund.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\listener\user;
  12. use app\jobs\store\StoreFinanceJob;
  13. use app\jobs\system\CapitalFlowJob;
  14. use crmeb\interfaces\ListenerInterface;
  15. /**
  16. * 用户充值退款事件
  17. * Class RechargeRefund
  18. * @package app\listener\user
  19. */
  20. class RechargeRefund implements ListenerInterface
  21. {
  22. /**
  23. * 用户充值事件
  24. * @param $event
  25. */
  26. public function handle($event): void
  27. {
  28. [$order, $data] = $event;
  29. if ($order['store_id']) {
  30. //门店充值退款流水
  31. StoreFinanceJob::dispatch([$order, 5, $data['refund_price'] ?? 0.00]);
  32. }
  33. //记录资金流水
  34. CapitalFlowJob::dispatch([$order, 'refund_recharge']);
  35. //提醒推送
  36. event('notice.notice', [['user_type' => strtolower($order['recharge_type']), 'data' => $data, 'UserRecharge' => $order], 'recharge_order_refund_status']);
  37. }
  38. }