添加定时任务

main
fengxinyhyl 11 months ago
parent b9678e445b
commit 8cf30f499b
  1. 3
      app/event.php
  2. 16
      crmeb/listens/task/CustomizeTask.php

@ -55,7 +55,7 @@ return [
\crmeb\listens\AuthCancelActivityListen::class, \crmeb\listens\AuthCancelActivityListen::class,
\crmeb\listens\CloseUserSvipListen::class, \crmeb\listens\CloseUserSvipListen::class,
\crmeb\listens\SendSvipCouponListen::class, \crmeb\listens\SendSvipCouponListen::class,
// \crmeb\listens\task\CustomizeTask::class, \crmeb\listens\task\CustomizeTask::class,
] : [], ] : [],
'pay_success_user_recharge' => [\crmeb\listens\pay\UserRechargeSuccessListen::class], 'pay_success_user_recharge' => [\crmeb\listens\pay\UserRechargeSuccessListen::class],
'pay_success_user_order' => [\crmeb\listens\pay\UserOrderSuccessListen::class], 'pay_success_user_order' => [\crmeb\listens\pay\UserOrderSuccessListen::class],
@ -65,7 +65,6 @@ return [
'order.paySuccess' => [\crmeb\listens\pay\CustomizePaySuccess::class], 'order.paySuccess' => [\crmeb\listens\pay\CustomizePaySuccess::class],
'order.take' => [\crmeb\listens\pay\CustomizeTake::class], 'order.take' => [\crmeb\listens\pay\CustomizeTake::class],
'order.refundAll' => [\crmeb\listens\pay\CustomizeRefundAll::class], 'order.refundAll' => [\crmeb\listens\pay\CustomizeRefundAll::class],
'order.statistics' => [\crmeb\listens\task\CustomizeTask::class],
], ],
'subscribe' => [], 'subscribe' => [],

@ -15,16 +15,16 @@ use crmeb\interfaces\ListenerInterface;
use crmeb\services\TimerService; use crmeb\services\TimerService;
use think\facade\Log; use think\facade\Log;
//class CustomizeTask extends TimerService implements ListenerInterface class CustomizeTask extends TimerService implements ListenerInterface
class CustomizeTask implements ListenerInterface
{ {
public function handle($event): void public function handle($event): void
{ {
// $this->tick(1000 * 60 , function () { $this->tick(1000 * 60, function () {
// Log::info("aaaa3333"); if(date('i') == 00){
// }); Log::info('整点任务开始执行');
}
if (date('H:i') == '00:10') {
/** /**
* @var UserAssetsRepository $userAssets * @var UserAssetsRepository $userAssets
*/ */
@ -36,5 +36,9 @@ class CustomizeTask implements ListenerInterface
*/ */
$huitong = app()->make(HuitongRepository::class); $huitong = app()->make(HuitongRepository::class);
$huitong->dayStatistics(); $huitong->dayStatistics();
}
});
} }
} }

Loading…
Cancel
Save