|
@@ -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."'
|
|
$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())."'");
|
|
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";
|
|
$updateOrInsert = empty($exist) ? "insert" : "update";
|
|
|
$sql = $this->getNotificationsRulesUpdateSql($updateOrInsert,$rules_type,"Subscribe",$exist['id']);
|
|
$sql = $this->getNotificationsRulesUpdateSql($updateOrInsert,$rules_type,"Subscribe",$exist['id']);
|
|
|
$rs = common::excuteUpdateSql($sql);
|
|
$rs = common::excuteUpdateSql($sql);
|
|
@@ -384,6 +392,14 @@ class tools {
|
|
|
|
|
|
|
|
if ($operate == "monitoring_rules_do") {
|
|
if ($operate == "monitoring_rules_do") {
|
|
|
$rules_type = common::check_input($_POST["rules_type"]);
|
|
$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规则,是否允许保存
|
|
//检查编辑提交的Monitoring规则,是否允许保存
|
|
|
$msg = $this->checkedMonitoringRulesSave($rules_type);
|
|
$msg = $this->checkedMonitoringRulesSave($rules_type);
|
|
|
if(!empty($msg)){
|
|
if(!empty($msg)){
|
|
@@ -845,6 +861,59 @@ class tools {
|
|
|
return $arrTmp;
|
|
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){
|
|
public function getNotificationsRulesUpdateSql($updateOrInsert,$rules_type,$notifications_type,$id){
|
|
|
$sql = "";
|
|
$sql = "";
|
|
|
//先删后加 这个逻辑有移除
|
|
//先删后加 这个逻辑有移除
|