TimerController.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. <?php
  2. namespace app\api\controller\v1;
  3. use app\services\activity\combination\StorePinkServices;
  4. use app\services\activity\live\LiveGoodsServices;
  5. use app\services\activity\live\LiveRoomServices;
  6. use app\services\agent\AgentManageServices;
  7. use app\services\order\StoreOrderServices;
  8. use app\services\order\StoreOrderTakeServices;
  9. use app\services\product\product\StoreProductServices;
  10. use app\services\system\attachment\SystemAttachmentServices;
  11. use app\services\system\timer\SystemTimerServices;
  12. class TimerController
  13. {
  14. /**
  15. * 定时任务调用接口
  16. * @author 吴汐
  17. * @email 442384644@qq.com
  18. * @date 2023/02/17
  19. */
  20. public function timerRun()
  21. {
  22. app()->make(SystemTimerServices::class)->timerRun();
  23. }
  24. /**
  25. * 检测定时任务是否正常,必须6秒执行一次
  26. */
  27. public function timerCheck()
  28. {
  29. file_put_contents(root_path() . 'runtime/.timer', time());
  30. }
  31. /**
  32. * 未支付自动取消订单
  33. * @throws \think\db\exception\DataNotFoundException
  34. * @throws \think\db\exception\DbException
  35. * @throws \think\db\exception\ModelNotFoundException
  36. */
  37. public function orderUnpaidCancel()
  38. {
  39. /** @var StoreOrderServices $orderServices */
  40. $orderServices = app()->make(StoreOrderServices::class);
  41. $orderServices->orderUnpaidCancel();
  42. }
  43. /**
  44. * 拼团到期订单处理
  45. * @throws \think\db\exception\DataNotFoundException
  46. * @throws \think\db\exception\ModelNotFoundException
  47. */
  48. public function pinkExpiration()
  49. {
  50. /** @var StorePinkServices $storePinkServices */
  51. $storePinkServices = app()->make(StorePinkServices::class);
  52. $storePinkServices->statusPink();
  53. }
  54. /**
  55. * 自动解绑上级绑定
  56. */
  57. public function agentUnbind()
  58. {
  59. /** @var AgentManageServices $agentManage */
  60. $agentManage = app()->make(AgentManageServices::class);
  61. $agentManage->removeSpread();
  62. }
  63. /**
  64. * 更新直播商品状态
  65. */
  66. public function syncGoodStatus()
  67. {
  68. /** @var LiveGoodsServices $liveGoods */
  69. $liveGoods = app()->make(LiveGoodsServices::class);
  70. $liveGoods->syncGoodStatus();
  71. }
  72. /**
  73. * 更新直播间状态
  74. */
  75. public function syncRoomStatus()
  76. {
  77. /** @var LiveRoomServices $liveRoom */
  78. $liveRoom = app()->make(LiveRoomServices::class);
  79. $liveRoom->syncRoomStatus();
  80. }
  81. /**
  82. * 自动收货
  83. */
  84. public function autoTakeOrder()
  85. {
  86. /** @var StoreOrderTakeServices $services */
  87. $services = app()->make(StoreOrderTakeServices::class);
  88. $services->autoTakeOrder();
  89. }
  90. /**
  91. * 查询预售到期商品自动下架
  92. */
  93. public function downAdvance()
  94. {
  95. /** @var StoreProductServices $product */
  96. $product = app()->make(StoreProductServices::class);
  97. $product->downAdvance();
  98. }
  99. /**
  100. * 自动好评
  101. */
  102. public function autoComment()
  103. {
  104. /** @var StoreOrderServices $orderServices */
  105. $orderServices = app()->make(StoreOrderServices::class);
  106. $orderServices->autoComment();
  107. }
  108. /**
  109. * 清除昨日海报
  110. * @throws \Exception
  111. */
  112. public function emptyYesterdayAttachment()
  113. {
  114. /** @var SystemAttachmentServices $attach */
  115. $attach = app()->make(SystemAttachmentServices::class);
  116. $attach->emptyYesterdayAttachment();
  117. }
  118. }