Browse Source

no message

DESKTOP-9JTA2JJ\HP 5 years atrás
parent
commit
7dbd4f3f38
1 changed files with 18 additions and 4 deletions
  1. 18 4
      api/application/controllers/Alarm.php

+ 18 - 4
api/application/controllers/Alarm.php

@@ -45,9 +45,9 @@ class Alarm extends Base_Controller {
 		$type = intval($this->input->post('type',true));
 		$version = $this->version;
 		// var_dump($version);
-		if (!empty($version)) {
-			$alarmtype = alarm_translate($alarmtype);
-		}
+		// if (!empty($version)) {
+		// 	$alarmtype = alarm_translate($alarmtype);
+		// }
 
 		$page = empty($page) ? 1 : $page;
 		$count = empty($count) ? 20 : $count;
@@ -65,7 +65,21 @@ class Alarm extends Base_Controller {
 			$where[] = 'AI.status = '.$status;
 		}
 		// if(!empty($alarmtype)) $filter['alarmtype'] = $alarmtype;
-		// if(!empty($alarmtype)) $where[] = 'AI.alarmtype like "%'.$alarmtype.'%"';
+		if(!empty($alarmtype) && is_numeric($alarmtype)) {
+			$t_ty = substr($alarmtype, 0,1);
+			$t_ty2 = substr($alarmtype, 1,1);
+			if ($t_ty == 1) {
+				$t_1 = 'batstatus';
+			}elseif ($t_ty == 2) {
+				$t_1 = 'panelstatus';
+			}elseif ($t_ty == 2) {
+				$t_1 = 'lampstatus';
+			}else {
+				$t_1 = 'tempstatus';
+			}
+
+			$where[] = 'AI.'.$t_1.' = '.$t_ty2;
+		}
 		// var_dump($alarmtype);
 		// if(isset($endDate)) $filter['endDate'] = $endDate;
 		if(isset($endDate) && !empty($endDate)) $where[] = 'AI.updatetime <= "'.$endDate.'"';