TaskSubscribe.php 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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\subscribes;
  12. use app\services\activity\combination\StorePinkServices;
  13. use app\services\agent\AgentManageServices;
  14. use app\services\activity\live\LiveGoodsServices;
  15. use app\services\activity\live\LiveRoomServices;
  16. use app\services\order\StoreOrderServices;
  17. use app\services\order\StoreOrderTakeServices;
  18. use app\services\product\product\StoreProductServices;
  19. use app\services\system\attachment\SystemAttachmentServices;
  20. use think\facade\Log;
  21. /**
  22. * 定时任务类
  23. * Class TaskSubscribe
  24. * @package crmeb\subscribes
  25. */
  26. class TaskSubscribe
  27. {
  28. public function handle()
  29. {
  30. }
  31. /**
  32. * 2秒钟执行的方法
  33. */
  34. public function onTask_2()
  35. {
  36. }
  37. /**
  38. * 6秒钟执行的方法
  39. */
  40. public function onTask_6()
  41. {
  42. }
  43. /**
  44. * 10秒钟执行的方法
  45. */
  46. public function onTask_10()
  47. {
  48. }
  49. /**
  50. * 30秒钟执行的方法
  51. */
  52. public function onTask_30()
  53. {
  54. //自动取消订单
  55. /** @var StoreOrderServices $orderServices */
  56. $orderServices = app()->make(StoreOrderServices::class);
  57. $orderServices->orderUnpaidCancel();
  58. }
  59. /**
  60. * 60秒钟执行的方法
  61. */
  62. public function onTask_60()
  63. {
  64. //拼团失败处理
  65. /** @var StorePinkServices $storePinkServices */
  66. $storePinkServices = app()->make(StorePinkServices::class);
  67. $storePinkServices->statusPink();
  68. //自动解绑上级绑定
  69. try {
  70. /** @var AgentManageServices $agentManage */
  71. $agentManage = app()->make(AgentManageServices::class);
  72. $agentManage->removeSpread();
  73. } catch (\Throwable $e) {
  74. Log::error('自动解除上级绑定失败,失败原因:' . $e->getMessage());
  75. }
  76. }
  77. /**
  78. * 180秒钟执行的方法
  79. */
  80. public function onTask_180()
  81. {
  82. //更新直播商品状态
  83. try {
  84. /** @var LiveGoodsServices $liveGoods */
  85. $liveGoods = app()->make(LiveGoodsServices::class);
  86. $liveGoods->syncGoodStatus();
  87. } catch (\Throwable $e) {
  88. Log::error('更新直播商品状态失败,失败原因:' . $e->getMessage());
  89. }
  90. //更新直播间状态
  91. try {
  92. /** @var LiveRoomServices $liveRoom */
  93. $liveRoom = app()->make(LiveRoomServices::class);
  94. $liveRoom->syncRoomStatus();
  95. } catch (\Throwable $e) {
  96. Log::error('更新直播间状态失败,失败原因:' . $e->getMessage());
  97. }
  98. }
  99. /**
  100. * 300秒钟执行的方法
  101. */
  102. public function onTask_300()
  103. {
  104. //自动收货
  105. /** @var StoreOrderTakeServices $services */
  106. $services = app()->make(StoreOrderTakeServices::class);
  107. $services->autoTakeOrder();
  108. //清除昨日海报
  109. /** @var SystemAttachmentServices $attach */
  110. $attach = app()->make(SystemAttachmentServices::class);
  111. $attach->emptyYesterdayAttachment();
  112. //查询预售到期商品自动下架
  113. /** @var StoreProductServices $product */
  114. $product = app()->make(StoreProductServices::class);
  115. $product->downAdvance();
  116. //自动好评
  117. /** @var StoreOrderServices $orderServices */
  118. $orderServices = app()->make(StoreOrderServices::class);
  119. $orderServices->autoComment();
  120. }
  121. }