瀏覽代碼

修改excel数据加密

317699326@qq.com 4 天之前
父節點
當前提交
4a78bd75db
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      controllers/excel.go

+ 7 - 1
controllers/excel.go

@@ -8,6 +8,7 @@ import (
 	"fmt"
 	"io/ioutil"
 	"net/http"
+	"strings"
 )
 
 // ExcelController 表格详情
@@ -58,9 +59,14 @@ func (this *ExcelController) ExcelDetail() {
 		br.ErrMsg = err.Error()
 		return
 	}
+	bodyStr := string(b)
+	bodyStr = strings.TrimLeft(bodyStr, `"`)
+	bodyStr = strings.TrimRight(bodyStr, `"`)
+
+	bodyResult := utils.DesBase64Decrypt([]byte(bodyStr), utils.DesKey)
 
 	result := new(models.BaseResponse)
-	if e = json.Unmarshal(b, &result); e != nil {
+	if e = json.Unmarshal(bodyResult, &result); e != nil {
 		err = fmt.Errorf("result unmarshal err: %s\nresult: %s", e.Error(), string(b))
 		br.ErrMsg = err.Error()
 		return