123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <?php
- namespace crmeb\subscribes;
- use app\models\system\MerchantDailyReport;
- use app\models\system\SystemAttachment;
- use app\models\store\StoreBargainUser;
- use app\models\store\StoreOrder;
- use app\models\store\StorePink;
- use app\models\system\SystemDailyReport;
- use app\models\user\UserToken;
- use app\adminapi\controller\v1\setting\PushBinding;
- use crmeb\basic\BaseModel;
- use think\db\exception\DataNotFoundException;
- use think\db\exception\DbException;
- use think\db\exception\ModelNotFoundException;
- use think\facade\Db;
- /**
- * 定时任务类
- * Class TaskSubscribe
- * @package crmeb\subscribes
- */
- class TaskSubscribe
- {
- public function handle()
- {
- }
- /**
- * 2秒钟执行的方法
- */
- public function onTask_2()
- {
- }
- /**
- * 6秒钟执行的方法
- */
- public function onTask_6()
- {
- }
- /**
- * 10秒钟执行的方法
- */
- public function onTask_10()
- {
- }
- /**
- * 30秒钟执行的方法
- */
- public function onTask_30()
- {
- try {
- Db::startTrans();
- StoreBargainUser::startBargainUserStatus();//批量修改砍价状态为 砍价失败
- Db::commit();
- } catch (\Exception $e) {
- Db::rollback();
- }
- try {
- Db::startTrans();
- StoreOrder::orderUnpaidCancel();//订单未支付默认取消
- Db::commit();
- } catch (\Exception $e) {
- Db::rollback();
- }
- try {
- Db::startTrans();
- StoreOrder::startTakeOrder();//7天自动收货
- Db::commit();
- } catch (\Exception $e) {
- Db::rollback();
- }
- try {
- Db::startTrans();
- StorePink::statusPink();//拼团到期修改状态
- Db::commit();
- } catch (\Exception $e) {
- Db::rollback();
- }
- }
- /**
- * 60秒钟执行的方法
- */
- public function onTask_60()
- {
- }
- /**
- * 180秒钟执行的方法
- */
- public function onTask_180()
- {
- }
- /**
- * 300秒钟执行的方法
- */
- public function onTask_300()
- {
- SystemAttachment::emptyYesterdayAttachment();//清除昨日海报
- StoreOrder::sendTen();//10分钟未付款发送通知
- self::checkHour(9);//发送商户报表模板消息
- BaseModel::beginTrans();
- try {
- MerchantDailyReport::recordYesterdayReport();
- SystemDailyReport::recordYesterdayReport();
- BaseModel::commitTrans();
- } catch (DbException $e) {
- BaseModel::rollbackTrans();
- }
- }
- public static function checkHour($hour){
- $h=date("G");
- if($h >= $hour){
- MerchantDailyReport::sendMerchantMessage();
- }
- }
- }
|