LiveJob.php 1.8 KB

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