Browse Source

_update增加错误处理

visuddhinanda 4 years ago
parent
commit
9ec692267c
1 changed files with 14 additions and 3 deletions
  1. 14 3
      app/db/table.php

+ 14 - 3
app/db/table.php

@@ -78,8 +78,14 @@ class Table
 			$updateDate,
 			$where
 		);
-
-		return true;
+		if($this->medoo->error){
+			$this->result["ok"]=false;
+			$this->result["message"]=$this->medoo->error;
+			return false;
+		}else{
+			return true;
+		}
+		
 	}
 
 	public function _show($columns,$id){
@@ -88,7 +94,12 @@ class Table
 			$columns,
 			["id"=>$id]
 		);
-		$this->result["data"] = $output;
+		if($this->medoo->error){
+			$this->result["ok"]=false;
+			$this->result["message"]=$this->medoo->error;
+		}else{
+			$this->result["data"] = $output;
+		}
 		return $this->result;
 	}