0 and order_status = 146 and order_prod_type in (81,82) "; $result=$pdo->query($sql); $rowset = $result -> fetchAll(PDO::FETCH_ASSOC); $list[]=0; $list_p[]=0; foreach ($rowset as $v) { $list[]=$v['order_id']; $list_p[]=$v['parent_order_id']; } $sql ="select order_id,parent_order_id from order_main where run_date = '". date('Y-m-d', time())."' and run_time<'". date('H:i', time())."' and parent_order_id >0 and order_status = 146 and order_prod_type in (81,82) "; $result=$pdo->query($sql); $rowset = $result -> fetchAll(PDO::FETCH_ASSOC); foreach ($rowset as $v) { $list[]=$v['order_id']; $list_p[]=$v['parent_order_id']; } $sql = "update order_main set order_status = 147 where order_id in (".implode($list, ',').") or order_id in(".implode($list_p, ',').")"; $result=$pdo->query($sql); success_notify(implode($list, ',')); function success_notify($result){ file_put_contents('./order_status_out_time_update.txt', date("Y-m-d H:i:s")." ".$result.PHP_EOL,FILE_APPEND);//记录所有订单号 }