TimerController.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. class TimerController
  12. {
  13. /**
  14. * 检测定时任务是否正常,必须6秒执行一次
  15. */
  16. public function timerCheck()
  17. {
  18. file_put_contents(runtime_path() . '.timer', time());
  19. }
  20. /**
  21. * 未支付自动取消订单
  22. * @throws \think\db\exception\DataNotFoundException
  23. * @throws \think\db\exception\DbException
  24. * @throws \think\db\exception\ModelNotFoundException
  25. */
  26. public function orderUnpaidCancel()
  27. {
  28. /** @var StoreOrderServices $orderServices */
  29. $orderServices = app()->make(StoreOrderServices::class);
  30. $orderServices->orderUnpaidCancel();
  31. }
  32. /**
  33. * 拼团到期订单处理
  34. * @throws \think\db\exception\DataNotFoundException
  35. * @throws \think\db\exception\ModelNotFoundException
  36. */
  37. public function pinkExpiration()
  38. {
  39. /** @var StorePinkServices $storePinkServices */
  40. $storePinkServices = app()->make(StorePinkServices::class);
  41. $storePinkServices->statusPink();
  42. }
  43. /**
  44. * 自动解绑上级绑定
  45. */
  46. public function agentUnbind()
  47. {
  48. /** @var AgentManageServices $agentManage */
  49. $agentManage = app()->make(AgentManageServices::class);
  50. $agentManage->removeSpread();
  51. }
  52. /**
  53. * 更新直播商品状态
  54. */
  55. public function syncGoodStatus()
  56. {
  57. /** @var LiveGoodsServices $liveGoods */
  58. $liveGoods = app()->make(LiveGoodsServices::class);
  59. $liveGoods->syncGoodStatus();
  60. }
  61. /**
  62. * 更新直播间状态
  63. */
  64. public function syncRoomStatus()
  65. {
  66. /** @var LiveRoomServices $liveRoom */
  67. $liveRoom = app()->make(LiveRoomServices::class);
  68. $liveRoom->syncRoomStatus();
  69. }
  70. /**
  71. * 自动收货
  72. */
  73. public function autoTakeOrder()
  74. {
  75. /** @var StoreOrderTakeServices $services */
  76. $services = app()->make(StoreOrderTakeServices::class);
  77. $services->autoTakeOrder();
  78. }
  79. /**
  80. * 查询预售到期商品自动下架
  81. */
  82. public function downAdvance()
  83. {
  84. /** @var StoreProductServices $product */
  85. $product = app()->make(StoreProductServices::class);
  86. $product->downAdvance();
  87. }
  88. /**
  89. * 自动好评
  90. */
  91. public function autoComment()
  92. {
  93. /** @var StoreOrderServices $orderServices */
  94. $orderServices = app()->make(StoreOrderServices::class);
  95. $orderServices->autoComment();
  96. }
  97. /**
  98. * 清除昨日海报
  99. * @throws \Exception
  100. */
  101. public function emptyYesterdayAttachment()
  102. {
  103. /** @var SystemAttachmentServices $attach */
  104. $attach = app()->make(SystemAttachmentServices::class);
  105. $attach->emptyYesterdayAttachment();
  106. }
  107. }