TaskSubscribe.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <?php
  2. namespace crmeb\subscribes;
  3. use app\admin\model\system\SystemAttachment;
  4. use app\api\controller\trade\CashTradeController;
  5. use app\models\manage\UserBorrowMoney;
  6. use app\models\manage\UserManageMoney;
  7. use app\models\mining\UserMiningMachine;
  8. use app\models\point_plan\UserPointPlan;
  9. use app\models\store\StoreBargainUser;
  10. use app\models\store\StoreOrder;
  11. use app\models\store\StorePink;
  12. use app\models\trade\CashTradeOrder;
  13. use app\models\user\UserToken;
  14. use app\models\vote\VoteSub;
  15. use think\facade\Db;
  16. /**
  17. * 定时任务类
  18. * Class TaskSubscribe
  19. * @package crmeb\subscribes
  20. */
  21. class TaskSubscribe
  22. {
  23. public function handle()
  24. {
  25. }
  26. /**
  27. * 2秒钟执行的方法
  28. */
  29. public function onTask_2()
  30. {
  31. }
  32. /**
  33. * 6秒钟执行的方法
  34. */
  35. public function onTask_6()
  36. {
  37. }
  38. /**
  39. * 10秒钟执行的方法
  40. */
  41. public function onTask_10()
  42. {
  43. try {
  44. Db::startTrans();
  45. VoteSub::checkAllStop();//拼团到期修改状态
  46. Db::commit();
  47. } catch (\Exception $e) {
  48. Db::rollback();
  49. }
  50. try {
  51. Db::startTrans();
  52. VoteSub::robotOrder();
  53. Db::commit();
  54. } catch (\Exception $e) {
  55. Db::rollback();
  56. }
  57. }
  58. /**
  59. * 30秒钟执行的方法
  60. */
  61. public function onTask_30()
  62. {
  63. try {
  64. Db::startTrans();
  65. CashTradeOrder::orderClose();//挂出结束退回
  66. Db::commit();
  67. } catch (\Exception $e) {
  68. Db::rollback();
  69. }
  70. // try {
  71. // Db::startTrans();
  72. // StoreBargainUser::startBargainUserStatus();//批量修改砍价状态为 砍价失败
  73. // Db::commit();
  74. // } catch (\Exception $e) {
  75. // Db::rollback();
  76. // }
  77. // try {
  78. // Db::startTrans();
  79. // StoreOrder::orderUnpaidCancel();//订单未支付默认取消
  80. // Db::commit();
  81. // } catch (\Exception $e) {
  82. // Db::rollback();
  83. // }
  84. // try {
  85. // Db::startTrans();
  86. // StoreOrder::startTakeOrder();//7天自动收货
  87. // Db::commit();
  88. // } catch (\Exception $e) {
  89. // Db::rollback();
  90. // }
  91. // try {
  92. // Db::startTrans();
  93. // StorePink::statusPink();//拼团到期修改状态
  94. // Db::commit();
  95. // } catch (\Exception $e) {
  96. // Db::rollback();
  97. // }
  98. // try {
  99. // Db::startTrans();
  100. // UserPointPlan::day_release();//每日释放
  101. // Db::commit();
  102. // } catch (\Exception $e) {
  103. // Db::rollback();
  104. // }
  105. // try {
  106. // Db::startTrans();
  107. // UserPointPlan::checkFail();//每日释放
  108. // Db::commit();
  109. // } catch (\Exception $e) {
  110. // Db::rollback();
  111. // }
  112. try {
  113. Db::startTrans();
  114. CashTradeOrder::getBack();//挂出结束退回
  115. Db::commit();
  116. } catch (\Exception $e) {
  117. Db::rollback();
  118. }
  119. // try {
  120. // Db::startTrans();
  121. // UserMiningMachine::dayMining();//每日挖矿
  122. // Db::commit();
  123. // } catch (\Exception $e) {
  124. // Db::rollback();
  125. // }
  126. // try {
  127. // Db::startTrans();
  128. // UserManageMoney::daySend();
  129. // Db::commit();
  130. // } catch (\Exception $e) {
  131. // Db::rollback();
  132. // }
  133. // try {
  134. // Db::startTrans();
  135. // UserBorrowMoney::daySend();
  136. // Db::commit();
  137. // } catch (\Exception $e) {
  138. // Db::rollback();
  139. // }
  140. }
  141. /**
  142. * 60秒钟执行的方法
  143. */
  144. public function onTask_60()
  145. {
  146. (new CashTradeController())->all_money_redis();
  147. }
  148. /**
  149. * 180秒钟执行的方法
  150. */
  151. public function onTask_180()
  152. {
  153. }
  154. /**
  155. * 300秒钟执行的方法
  156. */
  157. public function onTask_300()
  158. {
  159. UserToken::delToken();//删除一天前的过期token
  160. SystemAttachment::emptyYesterdayAttachment();//清除昨日海报
  161. StoreOrder::sendTen();//10分钟未付款发送通知
  162. }
  163. }