TaskSubscribe.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. StoreBargainUser::startBargainUserStatus();//批量修改砍价状态为 砍价失败
  66. Db::commit();
  67. } catch (\Exception $e) {
  68. Db::rollback();
  69. }
  70. try {
  71. Db::startTrans();
  72. StoreOrder::orderUnpaidCancel();//订单未支付默认取消
  73. Db::commit();
  74. } catch (\Exception $e) {
  75. Db::rollback();
  76. }
  77. try {
  78. Db::startTrans();
  79. StoreOrder::startTakeOrder();//7天自动收货
  80. Db::commit();
  81. } catch (\Exception $e) {
  82. Db::rollback();
  83. }
  84. try {
  85. Db::startTrans();
  86. StorePink::statusPink();//拼团到期修改状态
  87. Db::commit();
  88. } catch (\Exception $e) {
  89. Db::rollback();
  90. }
  91. try {
  92. Db::startTrans();
  93. UserPointPlan::day_release();//每日释放
  94. Db::commit();
  95. } catch (\Exception $e) {
  96. Db::rollback();
  97. }
  98. try {
  99. Db::startTrans();
  100. UserPointPlan::checkFail();//每日释放
  101. Db::commit();
  102. } catch (\Exception $e) {
  103. Db::rollback();
  104. }
  105. try {
  106. Db::startTrans();
  107. CashTradeOrder::getBack();//挂出结束退回
  108. Db::commit();
  109. } catch (\Exception $e) {
  110. Db::rollback();
  111. }
  112. try {
  113. Db::startTrans();
  114. CashTradeOrder::orderClose();//挂出结束退回
  115. Db::commit();
  116. } catch (\Exception $e) {
  117. Db::rollback();
  118. }
  119. try {
  120. Db::startTrans();
  121. UserManageMoney::daySend();
  122. Db::commit();
  123. } catch (\Exception $e) {
  124. Db::rollback();
  125. }
  126. try {
  127. Db::startTrans();
  128. UserBorrowMoney::daySend();
  129. Db::commit();
  130. } catch (\Exception $e) {
  131. Db::rollback();
  132. }
  133. }
  134. /**
  135. * 60秒钟执行的方法
  136. */
  137. public function onTask_60()
  138. {
  139. try {
  140. // $day_gets['XCH'] = 0;
  141. $res = UserMiningMachine::dayMining();//每日挖矿
  142. if (!$res) {
  143. @file_put_contents('mining.txt', '【' . date('Y-m-d H:i:s') . '】' . UserMiningMachine::getErrorInfo() . PHP_EOL, FILE_APPEND);
  144. }
  145. } catch (\Exception $e) {
  146. @file_put_contents('mining.txt', '【' . date('Y-m-d H:i:s') . '】' . $e->getMessage() . PHP_EOL, FILE_APPEND);
  147. }
  148. (new CashTradeController())->all_money_redis();
  149. }
  150. /**
  151. * 180秒钟执行的方法
  152. */
  153. public function onTask_180()
  154. {
  155. }
  156. /**
  157. * 300秒钟执行的方法
  158. */
  159. public function onTask_300()
  160. {
  161. UserToken::delToken();//删除一天前的过期token
  162. SystemAttachment::emptyYesterdayAttachment();//清除昨日海报
  163. StoreOrder::sendTen();//10分钟未付款发送通知
  164. }
  165. }