diff --git a/wxc2_omc/performance/ppsDailyReport/dailyReportDown.php b/wxc2_omc/performance/ppsDailyReport/dailyReportDown.php index fcb131d..6802b0f 100755 --- a/wxc2_omc/performance/ppsDailyReport/dailyReportDown.php +++ b/wxc2_omc/performance/ppsDailyReport/dailyReportDown.php @@ -158,10 +158,16 @@ if(!$array){
| Index | "; - echo "USSD Code | "; - echo "Session Num | "; - echo "Session Duration | "; - echo "Error Timeout | "; - echo "Error System | "; - echo "Error Message | "; + echo ""; + echo " | Index | "; + echo "USSD Code | "; + echo "Session Num | "; + echo "Session Duration | "; + echo "Error Timeout | "; + echo "Error System | "; + echo "Error Message | "; + echo "Average Duration | "; + echo "TPS | "; + ?>
| 1"; - + $average1=$array['session_num_1']?$array['session_duration_1']/($array['session_num_1']):0; + $tps1=$array['session_num_1']/(3600*24); echo " | $array[ussd_code_1] | "; echo "$array[session_num_1] | "; echo "$array[session_duration_1] | "; echo "$array[error_timeout_1] | "; echo "$array[error_system_1] | "; echo "$array[error_message_1] | "; + echo "$average1 | "; + echo "$tps1 | "; // echo "$incoming_call_nums | "; @@ -491,6 +503,8 @@ echo "";$i | "; echo "{$array['ussd_code_' . $i]} | "; @@ -499,6 +513,8 @@ echo ""; echo "{$array['error_timeout_' . $i]} | "; echo "{$array['error_system_' . $i]} | "; echo "{$array['error_message_' . $i]} | "; + echo "{$average} | "; + echo "{$tps} | "; echo ""; } ?> diff --git a/wxc2_omc/performance/ppsDailyReport/downCSTA.php b/wxc2_omc/performance/ppsDailyReport/downCSTA.php new file mode 100644 index 0000000..da117c6 --- /dev/null +++ b/wxc2_omc/performance/ppsDailyReport/downCSTA.php @@ -0,0 +1,124 @@ + 0) { + // 读取第一条记录 + $row = mysqli_fetch_array($res, MYSQLI_ASSOC); + + // 处理标题 + $title = ['Index','USSD Code','Session Num','Session Duration','Error Timeout','Error System','Error Message','Average Duration','TPS']; // 获取字段名 + $file_name = 'PPS-USSD.csv'; + $file = fopen($file_name, 'w'); + fputcsv($file, $title); // 写入标题行 + + for ($i = 1; $i <= 8; $i++) { + $average=$row['session_num_' . $i]?$row['session_duration_' . $i]/$row['session_num_' . $i]:0; + $tps=$row['session_num_' . $i]/(3600*24); + fputcsv($file, [$i,$row['ussd_code_' . $i],$row['session_num_' . $i],$row['session_duration_' . $i],$row['error_timeout_' . $i],$row['error_system_' . $i],$row['error_message_' . $i],$average,$tps]); + } + + fclose($file); + // 检查文件是否存在 + if (file_exists($file_name)) { + header("Content-type: application/csv"); + //use for download csv in https + header('Expires: 0'); + header('Pragma: public'); + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); + header('Cache-Control: public'); + header("Content-Disposition: attachment; filename=$file_name"); + readfile($file_name); + } else { + // 文件不存在时的处理 + echo "Error: File does not exist."; + } + } + break; + default: + break; + } + +?> \ No newline at end of file