ShuanghongS vor 7 Monaten
Ursprung
Commit
cbc56e4d41
2 geänderte Dateien mit 70 neuen und 1 gelöschten Zeilen
  1. 1 1
      main_new_version.php
  2. 69 0
      service/tools.class.php

+ 1 - 1
main_new_version.php

@@ -622,7 +622,7 @@ switch ($action) {
                         END AS new_status
                     FROM public.kln_ocean $sqlWhere";
             //$sqlWhere  and last_status_315_update_time is not null";
-            $sql .= " ORDER BY eta,id desc DESC limit " . $ps . " offset " . ($cp - 1) * $ps;
+            $sql .= " ORDER BY eta desc,id DESC limit " . $ps . " offset " . ($cp - 1) * $ps;
             //$sql .= " ORDER BY last_status_315_update_time DESC limit " . $ps . " offset " . ($cp - 1) * $ps;
             $rss = common::excuteListSql($sql);
             //RecentStatusList

+ 69 - 0
service/tools.class.php

@@ -209,6 +209,14 @@ class tools {
             //判断该规则是否存在
             $exist = common::excuteObjectSql("select user_login,id from public.notifications_rules where notifications_type = 'Subscribe' and rules_type = '".$rules_type."'
                     and  lower(user_login) = '".strtolower(_getLoginName())."'");
+
+            //检查参数是否正常
+            $err = $this->checkedNotificationParam(); 
+            if(!empty($err)){
+                $data = array("msg" =>"Parameter error: ".$err);
+                common::echo_json_encode(500,$data);
+                exit();
+            }      
             $updateOrInsert = empty($exist) ? "insert" : "update";        
             $sql = $this->getNotificationsRulesUpdateSql($updateOrInsert,$rules_type,"Subscribe",$exist['id']);
             $rs = common::excuteUpdateSql($sql);
@@ -384,6 +392,14 @@ class tools {
 
         if ($operate == "monitoring_rules_do") {
             $rules_type = common::check_input($_POST["rules_type"]);
+            //检查参数是否正常
+            $err = $this->checkedNotificationParam(); 
+            if(!empty($err)){
+                 $data = array("msg" =>"Parameter error: ".$err);
+                 common::echo_json_encode(500,$data);
+                 exit();
+            } 
+
             //检查编辑提交的Monitoring规则,是否允许保存
             $msg = $this->checkedMonitoringRulesSave($rules_type);
             if(!empty($msg)){
@@ -845,6 +861,59 @@ class tools {
         return $arrTmp;
     }
 
+    public function checkedNotificationParam(){
+        $rules_type = common::check_input($_POST["rules_type"]);
+        //先判断异常数据
+        $msg = "";
+        if ($rules_type == "Departure/Arrival_Delay"){
+            $ocean_atd_sub_etd = common::check_input($_POST['ocean_atd_sub_etd']);
+            if (ctype_digit($ocean_atd_sub_etd)) {
+                $msg = "Ocean Delayed(ATD-ETD) is not Number";
+            }
+           
+            $ocean_ata_sub_eta = common::check_input($_POST['ocean_ata_sub_eta']);
+            if (ctype_digit($ocean_ata_sub_eta)) {
+                $msg = "Ocean Delayed(ATA-ETA) is not Number";
+            }
+
+            $air_atd_sub_etd = common::check_input($_POST['air_atd_sub_etd']);
+            if (ctype_digit($air_atd_sub_etd)) {
+                $msg = "Air Delayed(ATD-ETD) is not Number";
+            }
+
+            $air_ata_sub_eta = common::check_input($_POST['air_ata_sub_eta']);
+            if (ctype_digit($air_ata_sub_eta)) {
+                $msg = "Air Delayed(ATA-ETA) is not Number";
+            }
+        }
+
+        if ($rules_type == "ETD/ETA_Change"){
+            $ocean_etd_old_sub_new = common::check_input($_POST['ocean_etd_old_sub_new']);
+            if (ctype_digit($ocean_etd_old_sub_new)) {
+                $msg = "Ocean Notify(ETD) is not Number";
+            }
+           
+            $ocean_eta_old_sub_new = common::check_input($_POST['ocean_eta_old_sub_new']);
+            if (ctype_digit($ocean_eta_old_sub_new)) {
+                $msg = "Ocean Notify(ETA) is not Number";
+            }
+            
+
+            $air_etd_old_sub_new = common::check_input($_POST['air_etd_old_sub_new']);
+            if (ctype_digit($air_etd_old_sub_new)) {
+                $msg = "Air Notify(ETD) is not Number";
+            }
+            
+            $air_eta_old_sub_new = common::check_input($_POST['air_eta_old_sub_new']);
+            if (ctype_digit($air_eta_old_sub_new)) {
+                $msg = "Air Notify(ETA) is not Number";
+            }
+            
+        }
+
+        return $msg;
+    }
+
     public function getNotificationsRulesUpdateSql($updateOrInsert,$rules_type,$notifications_type,$id){
         $sql = "";
         //先删后加 这个逻辑有移除