Commit 1aa8b7b37e2636f2ab8aff4dc8ed625929e019cc

Authored by 王家文
1 parent dfa99133
Exists in master and in 1 other branch dev-wjw

feat: 本地调试不加密解密

Showing 1 changed file with 7 additions and 3 deletions   Show diff stats
controllers/base.go
@@ -7,8 +7,6 @@ import ( @@ -7,8 +7,6 @@ import (
7 "github.com/astaxie/beego" 7 "github.com/astaxie/beego"
8 ) 8 )
9 9
10 -var debugMode = true  
11 -  
12 type BaseController struct { 10 type BaseController struct {
13 beego.Controller 11 beego.Controller
14 } 12 }
@@ -45,7 +43,9 @@ func (c *BaseController) RetCode(code string) { @@ -45,7 +43,9 @@ func (c *BaseController) RetCode(code string) {
45 func (c *BaseController) GetPostData(postData any) bool { 43 func (c *BaseController) GetPostData(postData any) bool {
46 44
47 req := c.Ctx.Input.RequestBody 45 req := c.Ctx.Input.RequestBody
48 - if debugMode { 46 +
  47 + // 本机调试不加密解密
  48 + if checkLocal() {
49 err := json.Unmarshal(req, &postData) 49 err := json.Unmarshal(req, &postData)
50 if err != nil { 50 if err != nil {
51 c.RetCode(constd.RECODE_PARAMERROR) 51 c.RetCode(constd.RECODE_PARAMERROR)
@@ -64,3 +64,7 @@ func (c *BaseController) GetPostData(postData any) bool { @@ -64,3 +64,7 @@ func (c *BaseController) GetPostData(postData any) bool {
64 } 64 }
65 return true 65 return true
66 } 66 }
  67 +
  68 +func checkLocal() bool {
  69 + return beego.AppConfig.String("env") == "local"
  70 +}