修改API响应

This commit is contained in:
liangzai
2024-10-13 22:47:49 +08:00
parent 641d7f948c
commit e6467b7004
27 changed files with 124 additions and 439 deletions

View File

@@ -95,21 +95,9 @@ func (l *IVYZ385ELogic) IVYZ385E(req *types.Request) (resp string, err *errs.App
return "", errs.ErrSystem
}
// 5、响应解析
//var respData westmodel.G32BJ05Response
//unmarshalErr := json.Unmarshal(westResp, &respData)
//if unmarshalErr != nil {
// return "", errs.ErrSystem
//}
//
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
// l.ctx = context.WithValue(l.ctx, "Charges", true)
//} else {
// return "", errs.ErrSystem
//}
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
//if aesEncrypt != nil {
// return "", errs.ErrSystem
//}
return string(westResp), nil
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, nil
}

View File

@@ -3,7 +3,6 @@ package IVYZ
import (
"context"
"encoding/hex"
"encoding/json"
"tianyuan-api/apps/api/internal/common"
"tianyuan-api/apps/api/internal/svc"
"tianyuan-api/apps/api/internal/types"
@@ -95,20 +94,6 @@ func (l *IVYZ5733Logic) IVYZ5733(req *types.Request) (resp string, err *errs.App
return "", errs.ErrSystem
}
// 5、响应解析
var respData westmodel.G09GX01Response
unmarshalErr := json.Unmarshal(westResp, &respData)
if unmarshalErr != nil {
return "", errs.ErrSystem
}
if respData.Code == 400 || respData.Code == 500 || respData.Code == 999 {
logx.Errorf("西部响应错误%v", respData)
return "", errs.ErrSystem
}
if respData.Code == 201 || respData.Code == 202 || respData.Code == 203 {
l.ctx = context.WithValue(l.ctx, "Charges", true)
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem

View File

@@ -95,21 +95,9 @@ func (l *IVYZ9363Logic) IVYZ9363(req *types.Request) (resp string, err *errs.App
return "", errs.ErrSystem
}
// 5、响应解析
//var respData westmodel.G32BJ05Response
//unmarshalErr := json.Unmarshal(westResp, &respData)
//if unmarshalErr != nil {
// return "", errs.ErrSystem
//}
//
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
// l.ctx = context.WithValue(l.ctx, "Charges", true)
//} else {
// return "", errs.ErrSystem
//}
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
//if aesEncrypt != nil {
// return "", errs.ErrSystem
//}
return string(westResp), nil
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, nil
}