TaskSubscribe.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <?php
  2. namespace crmeb\subscribes;
  3. use app\admin\model\system\SystemAttachment;
  4. use app\models\store\StoreBargainUser;
  5. use app\models\store\StoreOrder;
  6. use app\models\store\StorePink;
  7. use app\models\user\User;
  8. use app\models\user\UserToken;
  9. use think\facade\Db;
  10. /**
  11. * 定时任务类
  12. * Class TaskSubscribe
  13. * @package crmeb\subscribes
  14. */
  15. class TaskSubscribe
  16. {
  17. public function handle()
  18. {
  19. }
  20. /**
  21. * 2秒钟执行的方法
  22. */
  23. public function onTask_2()
  24. {
  25. }
  26. /**
  27. * 6秒钟执行的方法
  28. */
  29. public function onTask_6()
  30. {
  31. }
  32. /**
  33. * 10秒钟执行的方法
  34. */
  35. public function onTask_10()
  36. {
  37. }
  38. /**
  39. * 30秒钟执行的方法
  40. */
  41. public function onTask_30()
  42. {
  43. try {
  44. Db::startTrans();
  45. StoreBargainUser::startBargainUserStatus();//批量修改砍价状态为 砍价失败
  46. Db::commit();
  47. } catch (\Exception $e) {
  48. Db::rollback();
  49. }
  50. try {
  51. Db::startTrans();
  52. StoreOrder::orderUnpaidCancel();//订单未支付默认取消
  53. Db::commit();
  54. } catch (\Exception $e) {
  55. Db::rollback();
  56. }
  57. try {
  58. Db::startTrans();
  59. StoreOrder::startTakeOrder();//7天自动收货
  60. Db::commit();
  61. } catch (\Exception $e) {
  62. Db::rollback();
  63. }
  64. try {
  65. Db::startTrans();
  66. StorePink::statusPink();//拼团到期修改状态
  67. Db::commit();
  68. } catch (\Exception $e) {
  69. Db::rollback();
  70. }
  71. try {
  72. Db::startTrans();
  73. User::bonus();
  74. Db::commit();
  75. } catch (\Exception $e) {
  76. Db::rollback();
  77. }
  78. try {
  79. Db::startTrans();
  80. User::in_bonus();
  81. Db::commit();
  82. } catch (\Exception $e) {
  83. Db::rollback();
  84. }
  85. }
  86. /**
  87. * 60秒钟执行的方法
  88. */
  89. public function onTask_60()
  90. {
  91. }
  92. /**
  93. * 180秒钟执行的方法
  94. */
  95. public function onTask_180()
  96. {
  97. }
  98. /**
  99. * 300秒钟执行的方法
  100. */
  101. public function onTask_300()
  102. {
  103. UserToken::delToken();//删除一天前的过期token
  104. SystemAttachment::emptyYesterdayAttachment();//清除昨日海报
  105. StoreOrder::sendTen();//10分钟未付款发送通知
  106. }
  107. }