增加api optional Json

This commit is contained in:
2025-05-21 18:42:39 +08:00
parent 190bd0cb0f
commit 75ea50fff9
7 changed files with 154 additions and 9 deletions

View File

@@ -94,7 +94,17 @@ func (l *FLXG0V4BLogic) FLXG0V4B(req *types.Request) (resp string, err *errs.App
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G22SC01", apiRequest, l.svcCtx.Config.WestConfig.SecretId)
if callAPIErr != nil {
if callAPIErr.Code == errs.ErrDataSource.Code {
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
var resultResp []byte
if req.Options.Json {
var parseErr *errs.AppError
resultResp, parseErr = common.ParseWestResponse(westResp)
if parseErr != nil {
return "", parseErr
}
} else {
resultResp = westResp
}
encryptData, aesEncrypt := crypto.AesEncrypt(resultResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
@@ -103,7 +113,18 @@ func (l *FLXG0V4BLogic) FLXG0V4B(req *types.Request) (resp string, err *errs.App
return "", callAPIErr
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
var resultResp []byte
if req.Options.Json {
var parseErr *errs.AppError
resultResp, parseErr = common.ParseJsonResponse(westResp)
if parseErr != nil {
return "", parseErr
}
} else {
resultResp = westResp
}
encryptData, aesEncrypt := crypto.AesEncrypt(resultResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}