Browse Source

:bug: 推送没存历史记录

visuddhinanda 5 years ago
parent
commit
bc4b0f3b55
2 changed files with 5 additions and 5 deletions
  1. 0 1
      app/commit/commit.php
  2. 5 4
      app/usent/function.php

+ 0 - 1
app/commit/commit.php

@@ -70,7 +70,6 @@ if($stmt){
 					#有写入权限 直接写入
 					$newData["id"] = UUID::v4();
 					$insertData[] = $newData;
-					
 					$insertHistoray[] = $newData;
 				}
 				else{

+ 5 - 4
app/usent/function.php

@@ -23,8 +23,8 @@ function update_historay($sent_id, $user_id, $text, $landmark)
 
 class Sent_DB
 {
-    public $dbh_sent;
-	public $dbh_his;
+    private $dbh_sent;
+	private $dbh_his;
 	private $errorMsg="";
     public function __construct() {
         $this->dbh_sent = new PDO(_FILE_DB_SENTENCE_, "", "",array(PDO::ATTR_PERSISTENT=>true));
@@ -230,10 +230,11 @@ class Sent_DB
 							mTime(),
 							$data["landmark"]));
 		}
+		$this->dbh_his->commit();
 		if (!$stmt || ($stmt && $stmt->errorCode() != 0)) {
 			/*  识别错误  */
-			$this->dbh_sent->rollBack();
-			$error = $this->dbh_sent->errorInfo();
+			$this->dbh_his->rollBack();
+			$error = $this->dbh_his->errorInfo();
 			$this->errorMsg = $error[2];
 			return false;
 		} else {