EnterpriseWechatJob.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2023 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\jobs\notice;
  12. use app\services\message\notice\EnterpriseWechatService;
  13. use crmeb\basic\BaseJobs;
  14. use crmeb\traits\QueueTrait;
  15. use think\facade\Log;
  16. class EnterpriseWechatJob extends BaseJobs
  17. {
  18. use QueueTrait;
  19. /**
  20. * 给企业微信群发送消息
  21. * @param $data
  22. * @return bool
  23. */
  24. public function doJob($data): bool
  25. {
  26. try {
  27. /** @var EnterpriseWechatService $enterpriseWechatService */
  28. $enterpriseWechatService = app()->make(EnterpriseWechatService::class);
  29. $enterpriseWechatService->weComSend($data);
  30. return true;
  31. } catch (\Exception $e) {
  32. Log::error('发送企业群消息失败,失败原因:' . $e->getMessage());
  33. }
  34. }
  35. }