tp5 curl多线程

有大批量数据需要通过api及时获取其状态,由于数据太大和api返回速度较慢无法及时更改状态

public function exec(){
// write_log('order已启动',DIR);
// 执行确认订单是否支付
$list = RechargeLogModel::field('id,pay_url,qr_id,create_time')->where('status',0)->where('qr_id','>',0)->select();

    if($list){
        foreach ($list as $key => $value) {
            $res = get_header($value['pay_url']);
            $url1 = strstr($res[0],'https://');
            $url2 = strstr($url1,'Server',true);
            $res2 = get_header(trim($url2));
            $url3 = strstr($res2[0],'merchantNo');
            $url4 = strstr($url3,'Server',true);
            $res3 = post_header('https://payx.jd.com/api/h5Save/so',trim($url4));
            $result = json_decode($res3[0],true);
            if($result['errCode'] == 'F600051'){
                Db::name('qr')->where('id',$value['qr_id'])->update(['status'=>1]);
                RechargeLogModel::where('id', $value['id'])->update([
                    'status' => 1,
                    'remarks'=>'已支付,自动确认'
                ]);
            }
        }
    }
    RechargeLogModel::where(['create_time' => ['<', time()-300],'status'=>0])->update(['status' => 2,'remarks'=>'超时未支付']);
    Db::name('qr')->where(['update_time'=> ['<',time()-480],'status'=>0])->update(['update_time'=>0]);
}

定时任务运行时间过长

想通过多线程的方式同时进行访问