LiveJob.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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;
  12. use app\services\activity\live\LiveGoodsServices;
  13. use app\services\activity\live\LiveRoomServices;
  14. use crmeb\basic\BaseJobs;
  15. use crmeb\traits\QueueTrait;
  16. use think\facade\Log;
  17. class LiveJob extends BaseJobs
  18. {
  19. use QueueTrait;
  20. /**
  21. * 执行同步数据后
  22. * @param $order
  23. * @return bool
  24. */
  25. public function doJob()
  26. {
  27. //更新直播商品状态
  28. try {
  29. /** @var LiveGoodsServices $liveGoods */
  30. $liveGoods = app()->make(LiveGoodsServices::class);
  31. $liveGoods->syncGoodStatus(true);
  32. } catch (\Throwable $e) {
  33. Log::error('更新直播商品状态失败,失败原因:' . $e->getMessage());
  34. }
  35. //更新直播间状态
  36. try {
  37. /** @var LiveRoomServices $liveRoom */
  38. $liveRoom = app()->make(LiveRoomServices::class);
  39. $liveRoom->syncRoomStatus(true);
  40. } catch (\Throwable $e) {
  41. Log::error('更新直播间状态失败,失败原因:' . $e->getMessage());
  42. }
  43. return true;
  44. }
  45. }