AutoUserPosterJob.php 785 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /**
  3. * @package merchant
  4. *
  5. * @author xaboy
  6. * @day 2020/6/22
  7. *
  8. *
  9. */
  10. namespace crmeb\jobs;
  11. use app\common\repositories\user\UserRepository;
  12. use crmeb\interfaces\JobInterface;
  13. class AutoUserPosterJob implements JobInterface
  14. {
  15. public function fire($job, $uid)
  16. {
  17. $userRepository = app()->make(UserRepository::class);
  18. $user = $userRepository->get($uid);
  19. if (!$user)
  20. $job->delete();
  21. try {
  22. $userRepository->routineSpreadImage($user);
  23. } catch (\Exception $e) {
  24. };
  25. try {
  26. $userRepository->wxSpreadImage($user);
  27. } catch (\Exception $e) {
  28. };
  29. $job->delete();
  30. }
  31. public function failed($data)
  32. {
  33. // TODO: Implement failed() method.
  34. }
  35. }