TaskSubscribe.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. <?php
  2. namespace crmeb\subscribes;
  3. use app\admin\model\system\SystemAttachment;
  4. use app\models\game\DayAward;
  5. use app\models\game\Lottery;
  6. use app\models\store\StoreBargainUser;
  7. use app\models\store\StoreOrder;
  8. use app\models\store\StorePink;
  9. use app\models\user\UserToken;
  10. use think\facade\Db;
  11. /**
  12. * 定时任务类
  13. * Class TaskSubscribe
  14. * @package crmeb\subscribes
  15. */
  16. class TaskSubscribe
  17. {
  18. public function handle()
  19. {
  20. }
  21. /**
  22. * 2秒钟执行的方法
  23. */
  24. public function onTask_2()
  25. {
  26. }
  27. /**
  28. * 6秒钟执行的方法
  29. */
  30. public function onTask_6()
  31. {
  32. }
  33. /**
  34. * 10秒钟执行的方法
  35. */
  36. public function onTask_10()
  37. {
  38. DayAward::dayAward();
  39. DayAward::dayAwardOut();
  40. Lottery::openLottery();
  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. StoreOrder::monthAward();//拼团到期修改状态
  78. Db::commit();
  79. } catch (\Exception $e) {
  80. Db::rollback();
  81. }
  82. }
  83. /**
  84. * 60秒钟执行的方法
  85. */
  86. public function onTask_60()
  87. {
  88. }
  89. /**
  90. * 180秒钟执行的方法
  91. */
  92. public function onTask_180()
  93. {
  94. }
  95. /**
  96. * 300秒钟执行的方法
  97. */
  98. public function onTask_300()
  99. {
  100. UserToken::delToken();//删除一天前的过期token
  101. SystemAttachment::emptyYesterdayAttachment();//清除昨日海报
  102. StoreOrder::sendTen();//10分钟未付款发送通知
  103. }
  104. }