0 ? implode("&",$url_param_array) : 'guid=ON'; $limit = " ORDER BY create_time DESC "; //DB $objDbh = new Db; $objDbh->setAccount(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DB); $objDisney = new DbDisney($objDbh); $extra_sql = count($extra_sql_array) > 0 ? implode( " AND ", $extra_sql_array ): false; $order_array = $objDisney->getActiceOrderCommonArray( $extra_sql, $limit ); $all_count = $objDisney->getActiveOrderCommonCount( $extra_sql ); $org_array = $objDisney->getBaseOrgArray(); $org_temp_array = array(); foreach( $org_array as $org_info ) { $org_temp_array[$org_info["org_id"]] = $org_info; } $org_array = $org_temp_array; $max_page = ceil($all_count/$disp_per_page); $url_base = $page_name."?".$url_param; $str = "订单编号,订单内容,订单金额,订单源,下单时间,支付信息,用户信息,备注" . "\n"; foreach( $order_array as $order_info ) { $str .= $order_info["order_serial_no"]."\t,".$order_info["prod_name"].$return_flag; $order_date = $order_info["start_day"]; if( mb_strlen($order_info["start_time"]) > 0 ) { $order_date .= " ".$order_info["start_time"]; } if( $order_info["prod_id"] == 1 || $order_info["prod_id"] == 2 || $order_info["prod_id"] == 18 || $order_info["prod_id"] == 16 ) { $order_date .= "-".$order_info["end_day"]." ".$order_info["end_time"]; if( mb_strlen($order_info["start_time2"]) > 0 ) { $order_date .= $return_flag.$order_info["start_day2"]." ".$order_info["start_time2"]."-".$order_info["end_day2"]." ".$order_info["end_time2"]; } } $str .= $order_date.","; $str .= $order_info["order_price"].","; if( isset($org_array[$order_info["org_id"]]) ) { $str .= $org_array[$order_info["org_id"]]["org_name"].','; } else { $str .= '-,'; } $str .= $order_info["create_time"].","; if( $order_info['is_payed'] == 1 ) { $str .= $_ary_pay_type[$order_info['pay_type']].$return_flag.'支付号:'.$order_info["pay_no"] . ','; } else if( $order_info['order_user_id'] > 0 ){ $str .= '酒店代收现金,'; } else { $str .= '未支付,'; } $str .= $order_info["cus_name"].$return_flag.$order_info["cus_mobile"].$return_flag.$order_info["cus_iden"]; $order_comment = str_replace(",",",",$order_info["comment"]); $str .= ",\"".$order_comment."\""; $str .= "\n"; } $filename = date('Ymd') . '.csv'; //设置文件名 //echo $str; export_csv($filename, $str); //导出 function export_csv($filename, $data) { header("Content-type:text/csv"); header("Content-Disposition:attachment;filename=order_list" . $filename); header('Cache-Control:must-revalidate,post-check=0,pre-check=0'); header('Expires:0'); header('Pragma:public'); $data = chr(0xEF) . chr(0xBB) . chr(0xBF) . $data; // $data = iconv("utf-8","gb2312",$data); echo $data; } ?>