CancelUser.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2022 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\services\message\service\StoreServiceServices;
  13. use app\services\message\SystemMessageServices;
  14. use app\services\store\DeliveryServiceServices;
  15. use app\services\store\SystemStoreStaffServices;
  16. use app\services\user\CancelUserServices;
  17. use app\services\work\WorkClientServices;
  18. use app\services\work\WorkMemberServices;
  19. use crmeb\interfaces\ListenerInterface;
  20. use app\services\activity\collage\UserCollagePartakeServices;
  21. /**
  22. * 注销用户事件
  23. */
  24. class CancelUser implements ListenerInterface
  25. {
  26. public function handle($event): void
  27. {
  28. [$uid] = $event;
  29. /** @var CancelUserServices $cancelUserServices */
  30. $cancelUserServices = app()->make(CancelUserServices::class);
  31. $cancelUserServices->cancelUser((int)$uid);
  32. /** @var WorkClientServices $service */
  33. $service = app()->make(WorkClientServices::class);
  34. $service->unboundUser((int)$uid);
  35. /** @var WorkMemberServices $memberService */
  36. $memberService = app()->make(WorkMemberServices::class);
  37. $memberService->unboundUser((int)$uid);
  38. /** @var SystemMessageServices $systemMessageServices */
  39. $systemMessageServices = app()->make(SystemMessageServices::class);
  40. $systemMessageServices->update(['uid' => $uid], ['is_del' => 1]);
  41. /** @var UserCollagePartakeServices $partakeService */
  42. $partakeService = app()->make(UserCollagePartakeServices::class);
  43. $partakeService->logOffUserCollagePartake((int)$uid);
  44. /** @var StoreServiceServices $StoreServiceServices */
  45. $StoreServiceServices = app()->make(StoreServiceServices::class);
  46. $StoreServiceServices->update(['uid' => $uid], ['is_del' => 1]);
  47. /** @var SystemStoreStaffServices $staffServices */
  48. $staffServices = app()->make(SystemStoreStaffServices::class);
  49. $staffServices->cancelUserDel((int)$uid);
  50. /** @var DeliveryServiceServices $deliveryServices */
  51. $deliveryServices = app()->make(DeliveryServiceServices::class);
  52. $deliveryServices->update(['uid' => $uid], ['is_del' => 1]);
  53. event('user.update');
  54. }
  55. }