TaskSubscribe.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  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\UserPartake;
  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. UserPartake::cumulative();//出局计算
  74. Db::commit();
  75. } catch (\Exception $e) {
  76. Db::rollback();
  77. }
  78. }
  79. /**
  80. * 60秒钟执行的方法
  81. */
  82. public function onTask_60()
  83. {
  84. }
  85. /**
  86. * 180秒钟执行的方法
  87. */
  88. public function onTask_180()
  89. {
  90. }
  91. /**
  92. * 300秒钟执行的方法
  93. */
  94. public function onTask_300()
  95. {
  96. UserToken::delToken();//删除一天前的过期token
  97. SystemAttachment::emptyYesterdayAttachment();//清除昨日海报
  98. StoreOrder::sendTen();//10分钟未付款发送通知
  99. }
  100. }