VipUser.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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\system\CapitalFlowJob;
  13. use app\services\order\OtherOrderServices;
  14. use app\services\user\UserServices;
  15. use crmeb\interfaces\ListenerInterface;
  16. use app\jobs\order\OtherOrderJob;
  17. /**
  18. * 购买付费会员
  19. * Class Register
  20. * @package app\listener\user
  21. */
  22. class VipUser implements ListenerInterface
  23. {
  24. /**
  25. * 购买付费会员
  26. * @param $event
  27. */
  28. public function handle($event): void
  29. {
  30. [$orderInfo] = $event;
  31. //支付成功后发送消息
  32. OtherOrderJob::dispatch([$orderInfo]);
  33. /** @var UserServices $userServices */
  34. $userServices = app()->make(UserServices::class);
  35. $userInfo = $userServices->get($orderInfo['uid'], ['uid,nickname']);
  36. /** @var OtherOrderServices $otherServices */
  37. $otherServices = app()->make(OtherOrderServices::class);
  38. $orderInfo = $otherServices->get($orderInfo['id']);
  39. //记录资金流水队列
  40. CapitalFlowJob::dispatch([$orderInfo, 'pay_member']);
  41. $orderInfo['storeName'] = ['免费领取会员卡','购买会员卡','卡密领取会员卡'][$orderInfo['type']];
  42. $orderInfo['send_name'] = $userInfo['nickname'];
  43. $orderInfo['is_vip_order'] = 1;
  44. //用户推送消息事件
  45. event('notice.notice', [$orderInfo, 'order_pay_success']);
  46. //支付成功给客服发送消息
  47. event('notice.notice', [$orderInfo, 'admin_pay_success_code']);
  48. // 小程序订单服务
  49. event('order.routine.shipping', ['member', $orderInfo, 3, '', '']);
  50. }
  51. }