TaskSubscribe.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. <?php
  2. namespace crmeb\subscribes;
  3. use app\admin\model\system\SystemAttachment;
  4. use app\models\auction\Auction;
  5. use app\models\auction\AuctionOrder;
  6. use app\models\auction\AuctionProduct;
  7. use app\models\auction\AuctionTime;
  8. use app\models\store\StoreBargainUser;
  9. use app\models\store\StoreOrder;
  10. use app\models\store\StorePink;
  11. use app\models\user\User;
  12. use app\models\user\UserToken;
  13. use think\facade\Db;
  14. /**
  15. * 定时任务类
  16. * Class TaskSubscribe
  17. * @package crmeb\subscribes
  18. */
  19. class TaskSubscribe
  20. {
  21. public function handle()
  22. {
  23. }
  24. /**
  25. * 2秒钟执行的方法
  26. */
  27. public function onTask_2()
  28. {
  29. }
  30. /**
  31. * 6秒钟执行的方法
  32. */
  33. public function onTask_6()
  34. {
  35. }
  36. /**
  37. * 10秒钟执行的方法
  38. */
  39. public function onTask_10()
  40. {
  41. }
  42. /**
  43. * 30秒钟执行的方法
  44. */
  45. public function onTask_30()
  46. {
  47. try {
  48. Db::startTrans();
  49. StoreBargainUser::startBargainUserStatus();//批量修改砍价状态为 砍价失败
  50. Db::commit();
  51. } catch (\Exception $e) {
  52. Db::rollback();
  53. }
  54. try {
  55. Db::startTrans();
  56. StoreOrder::orderUnpaidCancel();//订单未支付默认取消
  57. Db::commit();
  58. } catch (\Exception $e) {
  59. Db::rollback();
  60. }
  61. try {
  62. Db::startTrans();
  63. StoreOrder::startTakeOrder();//7天自动收货
  64. Db::commit();
  65. } catch (\Exception $e) {
  66. Db::rollback();
  67. }
  68. try {
  69. Db::startTrans();
  70. StorePink::statusPink();//拼团到期修改状态
  71. Db::commit();
  72. } catch (\Exception $e) {
  73. Db::rollback();
  74. }
  75. try {
  76. Db::startTrans();
  77. AuctionOrder::deduction();//订单一个小时内未上传扣除预约卷
  78. Db::commit();
  79. } catch (\Exception $e) {
  80. Db::rollback();
  81. }
  82. try {
  83. Db::startTrans();
  84. AuctionOrder::th();//退回预约卷
  85. Db::commit();
  86. } catch (\Exception $e) {
  87. Db::rollback();
  88. }
  89. // Auction::is_new(); // 更新新人
  90. try {
  91. Db::startTrans();
  92. AuctionOrder::goods();//自动放货
  93. Db::commit();
  94. } catch (\Exception $e) {
  95. Db::rollback();
  96. }
  97. try {
  98. Db::startTrans();
  99. User::thaw();//解冻
  100. Db::commit();
  101. } catch (\Exception $e) {
  102. Db::rollback();
  103. }
  104. }
  105. /**
  106. * 60秒钟执行的方法
  107. */
  108. public function onTask_60()
  109. {
  110. AuctionOrder::auction_time();
  111. Auction::frequency(); // 更新场次
  112. AuctionProduct::off_the_shelf(); // 下架未出售商品
  113. }
  114. /**
  115. * 180秒钟执行的方法
  116. */
  117. public function onTask_180()
  118. {
  119. }
  120. /**
  121. * 300秒钟执行的方法
  122. */
  123. public function onTask_300()
  124. {
  125. UserToken::delToken();//删除一天前的过期token
  126. SystemAttachment::emptyYesterdayAttachment();//清除昨日海报
  127. StoreOrder::sendTen();//10分钟未付款发送通知
  128. }
  129. }