fix: bff test encrypt
This commit is contained in:
@@ -16,8 +16,3 @@ type NacosConf struct {
|
||||
RegisterIP string `json:",optional"`
|
||||
ConfigID string `json:",optional"`
|
||||
}
|
||||
|
||||
type ResponseConf struct {
|
||||
IsDebug bool `json:",default=true"`
|
||||
EncryptKey string `json:",optional"`
|
||||
}
|
||||
|
||||
@@ -34,12 +34,15 @@ func (b *BaseController) OutPut(w http.ResponseWriter, code int32, data any, msg
|
||||
if code == utils.Ok.Code && !utils.GetConfigBool("encrypt.debug") {
|
||||
jsonData, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
fmt.Printf("response encrypt: json.Marshal failed: %v\n", err)
|
||||
msg = utils.ErrorEncryptAesError.Msg
|
||||
code = utils.ErrorEncryptAesError.Code
|
||||
} else {
|
||||
key := utils.GetConfigString("encrypt.encrypt_key")
|
||||
res, enErr := utils.Crypto{}.Encrypt(jsonData)
|
||||
fmt.Printf("res: %v\n", res)
|
||||
if enErr != nil {
|
||||
fmt.Printf("response encrypt failed: keyLen=%d keyEmpty=%v errCode=%d errMsg=%s\n",
|
||||
len(key), key == "", enErr.GetCode(), enErr.GetMsg())
|
||||
msg = utils.ErrorEncryptAesError.Msg
|
||||
code = utils.ErrorEncryptAesError.Code
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user