| 1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- namespace process;
- use app\business\TaskBusiness;
- use support\Db;
- use support\Log;
- use Workerman\Timer;
- /** 重启任务 */
- class TaskRestart
- {
- public function onWorkerStart()
- {
- Timer::add(20, function(){
- $this->task();
- });
- }
- public function task()
- {
- try {
- $taskData=Db::table('wa_apply_record')
- ->where('add_time','<=',time())
- ->where('status',1)
- ->limit(150)
- ->pluck('id')
- ->toArray();
- foreach ($taskData as $k=>$v){
- TaskBusiness::TaskRefund($v);
- }
- }catch (\Throwable $exception){
- Log::channel('task')->error($exception->getMessage());
- }
- }
- }
|