fix: bff test encrypt
CI / changes (push) Successful in 1s
CI / docker-bff (push) Successful in 3m8s
CI / docker-product (push) Has been skipped
CI / docker-admin (push) Has been skipped

This commit is contained in:
zzw
2026-08-14 10:50:23 +08:00
parent 4dbfe7be41
commit 2cd2a5f6ff
2 changed files with 4 additions and 6 deletions
-5
View File
@@ -16,8 +16,3 @@ type NacosConf struct {
RegisterIP string `json:",optional"` RegisterIP string `json:",optional"`
ConfigID string `json:",optional"` ConfigID string `json:",optional"`
} }
type ResponseConf struct {
IsDebug bool `json:",default=true"`
EncryptKey string `json:",optional"`
}
+4 -1
View File
@@ -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") { if code == utils.Ok.Code && !utils.GetConfigBool("encrypt.debug") {
jsonData, err := json.Marshal(data) jsonData, err := json.Marshal(data)
if err != nil { if err != nil {
fmt.Printf("response encrypt: json.Marshal failed: %v\n", err)
msg = utils.ErrorEncryptAesError.Msg msg = utils.ErrorEncryptAesError.Msg
code = utils.ErrorEncryptAesError.Code code = utils.ErrorEncryptAesError.Code
} else { } else {
key := utils.GetConfigString("encrypt.encrypt_key")
res, enErr := utils.Crypto{}.Encrypt(jsonData) res, enErr := utils.Crypto{}.Encrypt(jsonData)
fmt.Printf("res: %v\n", res)
if enErr != nil { 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 msg = utils.ErrorEncryptAesError.Msg
code = utils.ErrorEncryptAesError.Code code = utils.ErrorEncryptAesError.Code
} else { } else {