From 24e2448f2c17054f4596696df067b156f4bca953 Mon Sep 17 00:00:00 2001
From: liuxiaolong <736321739@qq.com>
Date: 星期五, 20 十二月 2019 19:02:27 +0800
Subject: [PATCH] add log

---
 extend/util/util.go   |    4 ++++
 service/SysService.go |   10 +++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/extend/util/util.go b/extend/util/util.go
index 3e74a89..fb6623e 100644
--- a/extend/util/util.go
+++ b/extend/util/util.go
@@ -3,6 +3,7 @@
 import (
 	"archive/tar"
 	"archive/zip"
+	"basic.com/valib/logger.git"
 	"bytes"
 	"compress/gzip"
 	"crypto/md5"
@@ -363,11 +364,13 @@
 func DeCompress(tarFile, dest string) error {
 	srcFile, err := os.Open(tarFile)
 	if err != nil {
+		logger.Debug("open tarFile err:",err)
 		return err
 	}
 	defer srcFile.Close()
 	gr, err := gzip.NewReader(srcFile)
 	if err != nil {
+		logger.Debug("gzip.NewReader err:",err)
 		return err
 	}
 	defer gr.Close()
@@ -384,6 +387,7 @@
 		filename := dest + hdr.Name
 		file, err := createFile(filename)
 		if err != nil {
+			logger.Debug("createFile err:",err)
 			return err
 		}
 		io.Copy(file, tr)
diff --git a/service/SysService.go b/service/SysService.go
index 6108ca1..d643667 100644
--- a/service/SysService.go
+++ b/service/SysService.go
@@ -234,10 +234,10 @@
 		return false
 	}
 
-	zipFilePath := configPatchPath+"/"+identifier+ext
-	err := util.DeCompress(zipFilePath, unPackPath)
+	unPackFilePath := configPatchPath+"/"+identifier+ext
+	err := util.DeCompress(unPackFilePath, unPackPath)
 	if err !=nil {
-		logger.Debug("UnZip err:",err,"zipFile:",zipFilePath)
+		logger.Debug("UnPack err:",err,"unPackFile:",unPackFilePath)
 		return false
 	}
 
@@ -252,9 +252,9 @@
 	}
 
 	//鍒ゆ柇鏇存柊鍖呴噷鏄惁鏈夎ˉ涓佽剼鏈紝濡傛灉鏈夊垯鎵ц锛屽惁鍒欐墽琛寀pdatePatch.sh
-	updateCmd := fmt.Sprintf("./updatePatch.sh %s %s %s &",unPackPath,zipFilePath,configPatchPath+"/"+identifier)
+	updateCmd := fmt.Sprintf("./updatePatch.sh %s %s %s &",unPackPath,unPackFilePath,configPatchPath+"/"+identifier)
 	if util.Exists(unPackPath+"upgrade.sh") {
-		updateCmd = fmt.Sprintf("%supgrade.sh %s %s %s &",unPackPath,unPackPath,zipFilePath,configPatchPath+"/"+identifier)
+		updateCmd = fmt.Sprintf("%supgrade.sh %s %s %s &",unPackPath,unPackPath,unPackFilePath,configPatchPath+"/"+identifier)
 	}
 	//2.鏇存柊绯荤粺
 	b,err := ExecCmd(updateCmd)

--
Gitblit v1.8.0