Browse Source

update

master
dengbiao 1 day ago
parent
commit
cdbea17efe
2 changed files with 14 additions and 4 deletions
  1. +7
    -2
      app/hdl/hdl_demo.go
  2. +7
    -2
      app/lib/aes/check.go

+ 7
- 2
app/hdl/hdl_demo.go View File

@@ -102,14 +102,19 @@ func CreateSign(c *gin.Context) {
if string(body) != "" {
aesStr = aes.AesEncryptByECB(md.AesKey, string(body))

var bodyParams = map[string]string{}
var bodyParams = map[string]interface{}{}
err = json.Unmarshal(body, &bodyParams)
if err != nil {
e.OutErr(c, e.ERR, err.Error())
return
}
for key, value := range bodyParams {
query[key] = value
// 使用类型断言判断是否为 string 类型
if _, ok := value.(string); ok {
query[key] = value.(string)
} else {
query[key] = utils.SerializeStr(value)
}
}
}
}


+ 7
- 2
app/lib/aes/check.go View File

@@ -42,13 +42,18 @@ func CheckSign(c *gin.Context) error {
if str != "" {
c.Request.Body = ioutil.NopCloser(bytes.NewBuffer([]byte(str)))

var bodyParams = map[string]string{}
var bodyParams = map[string]interface{}{}
err = json.Unmarshal([]byte(str), &bodyParams)
if err != nil {
return err
}
for key, value := range bodyParams {
query[key] = value
// 使用类型断言判断是否为 string 类型
if _, ok := value.(string); ok {
query[key] = value.(string)
} else {
query[key] = utils.SerializeStr(value)
}
}
}
}


Loading…
Cancel
Save