Browse Source

新增加密

longyu 3 years ago
parent
commit
fba15892ed
2 changed files with 3 additions and 13 deletions
  1. 3 9
      controller/response/base.go
  2. 0 4
      go.mod

+ 3 - 9
controller/response/base.go

@@ -5,6 +5,7 @@ import (
 	"fmt"
 	"github.com/gin-gonic/gin"
 	"hongze/hongze_yb/global"
+	"hongze/hongze_yb/utils"
 	"strings"
 )
 
@@ -42,15 +43,8 @@ func result(code int, resultData ResultData, c *gin.Context) {
 		logSlice = append(logSlice, fmt.Sprint("ErrMsg:", resultData.ErrMsg))
 	}
 	global.LOG.Info(strings.Join(logSlice, ";"))
-
-	//测试环境,数据不进行加密
-	/*if global.CONFIG.Serve.RunMode == "debug" {
-		c.JSON(code, resultData)
-	} else {
-		responseResult := utils.DesBase64Encrypt(jsonByte)
-		c.JSON(code, responseResult)
-	}*/
-	c.JSON(code, resultData)
+	encryptResult := utils.DesBase64Encrypt(jsonByte)
+	c.JSON(code, string(encryptResult))
 	c.Abort()
 }
 

+ 0 - 4
go.mod

@@ -10,9 +10,7 @@ require (
 	github.com/gin-gonic/gin v1.7.4
 	github.com/go-playground/validator/v10 v10.9.0 // indirect
 	github.com/go-redis/redis/v8 v8.11.4
-	github.com/go-sql-driver/mysql v1.6.0 // indirect
 	github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
-	github.com/golang/protobuf v1.5.2 // indirect
 	github.com/jonboulle/clockwork v0.2.2 // indirect
 	github.com/json-iterator/go v1.1.12 // indirect
 	github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible
@@ -29,10 +27,8 @@ require (
 	golang.org/x/image v0.0.0-20190802002840-cff245a6509b
 	golang.org/x/sys v0.0.0-20211107104306-e0b2ad06fe42 // indirect
 	golang.org/x/text v0.3.7 // indirect
-	google.golang.org/protobuf v1.27.1 // indirect
 	gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
 	gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
-	gopkg.in/yaml.v2 v2.4.0 // indirect
 	gorm.io/driver/mysql v1.1.3
 	gorm.io/gorm v1.22.2
 )