= '" . $now_date . "' AND m.run_date = '" . $run_date . "' AND m.run_status = 138 and case l.sale_expired_type when 321 then if(date_add(date_add(m.run_date,interval -1 day), interval (substring_index(l.sale_expired_time,':',1)*60 + substring_index(l.sale_expired_time,':',-1)) minute) > now(),0=0,0=1) when 322 then if(date_add(m.run_date, interval m.run_minutes -(substring_index(l.sale_expired_time,':',1)*60 + substring_index(l.sale_expired_time,':',-1)) minute)>= now(),0=0,0=1) else 0=0 end AND l.line_type = " . $line_type . " GROUP BY m.run_id order by m.run_time"; $result = $pdo->query($sql); $run_info = $result->fetchAll(PDO::FETCH_ASSOC); if(count($run_info) == 0){ $code = '1'; $info = '没有返程班次'; }else{ $code = '0'; $info = '返回班次成功'; } $json['code'] = $code; $json['info'] = $info; $json['list'] = $run_info; echo json_encode($json); ?>