From fba6465aa52f07b098263a4c3a06e9427e20cce7 Mon Sep 17 00:00:00 2001 From: root Date: Fri, 21 Feb 2025 17:11:56 +0800 Subject: [PATCH] ussd perform --- .../ppsDailyReport/dailyReportDown.php | 42 ++++-- .../performance/ppsDailyReport/downCSTA.php | 124 ++++++++++++++++++ 2 files changed, 153 insertions(+), 13 deletions(-) create mode 100644 wxc2_omc/performance/ppsDailyReport/downCSTA.php 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){   - -
- -
+ + + "> + + + + + + + @@ -461,27 +467,33 @@ echo "";  "; - echo ""; - echo " "; - echo " "; - echo " "; - echo " "; - echo " "; - echo " "; + echo ""; + echo ""; + echo " "; + echo " "; + echo " "; + echo " "; + echo " "; + echo " "; + echo " "; + echo " "; + ?> 1"; - + $average1=$array['session_num_1']?$array['session_duration_1']/($array['session_num_1']):0; + $tps1=$array['session_num_1']/(3600*24); echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; + echo ""; + echo ""; // echo ""; @@ -491,6 +503,8 @@ echo ""; "; echo ""; echo ""; @@ -499,6 +513,8 @@ echo ""; echo ""; echo ""; echo ""; + echo ""; + echo ""; 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
IndexUSSD CodeSession NumSession DurationError TimeoutError SystemError Message IndexUSSD CodeSession NumSession DurationError TimeoutError SystemError MessageAverage DurationTPS
$array[ussd_code_1]$array[session_num_1]$array[session_duration_1]$array[error_timeout_1]$array[error_system_1]$array[error_message_1]$average1$tps1$incoming_call_nums
$i{$array['ussd_code_' . $i]}{$array['error_timeout_' . $i]}{$array['error_system_' . $i]}{$array['error_message_' . $i]}{$average}{$tps}