dengbiao pirms 4 dienas
vecāks
revīzija
cdbea17efe
2 mainītis faili ar 14 papildinājumiem un 4 dzēšanām
  1. +7
    -2
      app/hdl/hdl_demo.go
  2. +7
    -2
      app/lib/aes/check.go

+ 7
- 2
app/hdl/hdl_demo.go Parādīt failu

@@ -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 Parādīt failu

@@ -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)
}
}
}
}


Notiek ielāde…
Atcelt
Saglabāt