TaskSubscribe.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <?php
  2. namespace crmeb\subscribes;
  3. use app\admin\model\system\SystemAttachment;
  4. use app\models\many\Many;
  5. use app\models\many\ManyOrder;
  6. use app\models\store\StoreBargainUser;
  7. use app\models\store\StoreOrder;
  8. use app\models\store\StorePink;
  9. use app\models\user\User;
  10. use app\models\user\UserToken;
  11. use think\facade\Db;
  12. /**
  13. * 定时任务类
  14. * Class TaskSubscribe
  15. * @package crmeb\subscribes
  16. */
  17. class TaskSubscribe
  18. {
  19. public function handle()
  20. {
  21. }
  22. /**
  23. * 2秒钟执行的方法
  24. */
  25. public function onTask_2()
  26. {
  27. try {
  28. Db::startTrans();
  29. Many::second();//区域代理发放
  30. Db::commit();
  31. } catch (\Exception $e) {
  32. Db::rollback();
  33. }
  34. }
  35. /**
  36. * 6秒钟执行的方法
  37. */
  38. public function onTask_6()
  39. {
  40. }
  41. /**
  42. * 10秒钟执行的方法
  43. */
  44. public function onTask_10()
  45. {
  46. }
  47. /**
  48. * 30秒钟执行的方法
  49. */
  50. public function onTask_30()
  51. {
  52. try {
  53. Db::startTrans();
  54. StoreBargainUser::startBargainUserStatus();//批量修改砍价状态为 砍价失败
  55. Db::commit();
  56. } catch (\Exception $e) {
  57. Db::rollback();
  58. }
  59. try {
  60. Db::startTrans();
  61. StoreOrder::orderUnpaidCancel();//订单未支付默认取消
  62. Db::commit();
  63. } catch (\Exception $e) {
  64. Db::rollback();
  65. }
  66. try {
  67. Db::startTrans();
  68. StoreOrder::startTakeOrder();//7天自动收货
  69. Db::commit();
  70. } catch (\Exception $e) {
  71. Db::rollback();
  72. }
  73. try {
  74. Db::startTrans();
  75. StorePink::statusPink();//拼团到期修改状态
  76. Db::commit();
  77. } catch (\Exception $e) {
  78. Db::rollback();
  79. }
  80. }
  81. /**
  82. * 60秒钟执行的方法
  83. */
  84. public function onTask_60()
  85. {
  86. try {
  87. Db::startTrans();
  88. User::agent();//区域代理发放
  89. Db::commit();
  90. } catch (\Exception $e) {
  91. Db::rollback();
  92. }
  93. try {
  94. Db::startTrans();
  95. ManyOrder::flowing_water(); //流水分红
  96. Db::commit();
  97. } catch (\Exception $e) {
  98. Db::rollback();
  99. }
  100. try {
  101. Db::startTrans();
  102. Many::fail();//众筹失败
  103. Db::commit();
  104. } catch (\Exception $e) {
  105. Db::rollback();
  106. }
  107. try {
  108. Db::startTrans();
  109. ManyOrder::suc_return(); // 众筹成功订单返还
  110. Db::commit();
  111. } catch (\Exception $e) {
  112. Db::rollback();
  113. }
  114. ManyOrder::time(); //流水分红
  115. }
  116. /**
  117. * 180秒钟执行的方法
  118. */
  119. public function onTask_180()
  120. {
  121. try {
  122. Db::startTrans();
  123. Many::next_period(); // 自动下一期
  124. Db::commit();
  125. } catch (\Exception $e) {
  126. Db::rollback();
  127. }
  128. }
  129. /**
  130. * 300秒钟执行的方法
  131. */
  132. public function onTask_300()
  133. {
  134. UserToken::delToken();//删除一天前的过期token
  135. SystemAttachment::emptyYesterdayAttachment();//清除昨日海报
  136. StoreOrder::sendTen();//10分钟未付款发送通知
  137. }
  138. }