setName('xQueue:Book'); // $this->setDescription('导入章节内容'); $this->setName('xQueue:KamiOrderChanelNotify')->setDescription('[ 卡密列表 - 自动同步 ] 对cardbuy购置的卡密同步响应数据进行异步处理订单回调状态'); } /** * @param Input $input * @param Output $output * @throws \think\admin\Exception */ protected function execute(Input $input, Output $output) { ini_set('memory_limit', '1024M'); $orderService = OrderService::instance(); $where1 = [ 'status' => '7' , ]; $where[] = [ 'product_key','like','%cardbuy%' ]; list($count, $total) = [0, $orderService->db()->where($where)->where($where1)->count()]; $kami91server = Kami91OrderService::instance(); $kami91 =new \app\openapi\controller\Kami91($this->app); $orderService->db()->where($where)->where($where1)->chunk(100, function (Collection $data) use (&$count, $total,$kami91server,$kami91) { // var_dump($orderlist);die; foreach ($data->toArray() as $vo) { $info = $kami91server->db()->where(['order_id' => $vo['order_id']])->find(); if($info){ $count++; if(isset($info['status']) && $info['status'] == '6'){ #查询卡的状态是否已发送 $check = $kami91->queryFaka($vo['merchant_order_id']); if($check == 'ok'){ $msg = 'success'; if($vo['response']){ } $kami91server->upStatus($vo['order_id'], 2 ,$msg); $kami91->huidiao($vo['order_id']); } } elseif (empty($info['cardno'])){ $kami91->uphuidiao($vo['order_id']); } $this->setQueueProgress("处理完订单状态 {$vo['order_id']} ", $count / $total * 100); } } }); // $this->setQueueSuccess("处理完 {$count} 个订单状态完成!"); } }