修改API响应

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

View File

@@ -3,7 +3,6 @@ package FLXG
import (
"context"
"encoding/hex"
"encoding/json"
"tianyuan-api/apps/api/internal/common"
"tianyuan-api/apps/api/internal/validator"
"tianyuan-api/apps/api/internal/westmodel"
@@ -96,16 +95,6 @@ func (l *FLXG162ALogic) FLXG162A(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" {
return "", errs.ErrSystem
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem

View File

@@ -3,7 +3,6 @@ package FLXG
import (
"context"
"encoding/hex"
"encoding/json"
"tianyuan-api/apps/api/internal/common"
"tianyuan-api/apps/api/internal/validator"
"tianyuan-api/apps/api/internal/westmodel"
@@ -99,19 +98,18 @@ func (l *FLXG3D56Logic) FLXG3D56(req *types.Request) (resp string, err *errs.App
}
// 5、响应解析
var respData westmodel.G26BJ05Response
unmarshalErr := json.Unmarshal(westResp, &respData)
if unmarshalErr != nil {
return "", errs.ErrSystem
}
if respData.Data.Code != "00" && respData.Data.Code != "100002" {
return "", errs.ErrDataSource
}
//var respData westmodel.G26BJ05Response
//unmarshalErr := json.Unmarshal(westResp, &respData)
//if unmarshalErr != nil {
// return "", errs.ErrSystem
//}
//
//if respData.Data.Code != "00" && respData.Data.Code != "100002" {
// return "", errs.ErrDataSource
//}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem
}
return encryptData, nil
}

View File

@@ -3,7 +3,6 @@ package FLXG
import (
"context"
"encoding/hex"
"encoding/json"
"tianyuan-api/apps/api/internal/common"
"tianyuan-api/apps/api/internal/validator"
"tianyuan-api/apps/api/internal/westmodel"
@@ -96,16 +95,6 @@ func (l *FLXG54F5Logic) FLXG54F5(req *types.Request) (resp string, err *errs.App
return "", errs.ErrSystem
}
// 5、响应解析
var respData westmodel.G03HZ01Response
unmarshalErr := json.Unmarshal(westResp, &respData)
if unmarshalErr != nil {
return "", errs.ErrSystem
}
if respData.Code != "0000" {
return "", errs.ErrSystem
}
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
if aesEncrypt != nil {
return "", errs.ErrSystem

View File

@@ -95,21 +95,9 @@ func (l *FLXG5876Logic) FLXG5876(req *types.Request) (resp string, err *errs.App
return "", errs.ErrSystem
}
// 5、响应解析
//var respData westmodel.G26BJ05Response
//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

@@ -95,21 +95,9 @@ func (l *FLXG9687Logic) FLXG9687(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

@@ -95,21 +95,9 @@ func (l *FLXG970FLogic) FLXG970F(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

@@ -95,21 +95,9 @@ func (l *FLXGC9D1Logic) FLXGC9D1(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

@@ -95,21 +95,9 @@ func (l *FLXGCA3DLogic) FLXGCA3D(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

@@ -95,21 +95,9 @@ func (l *FLXGDEC7Logic) FLXGDEC7(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
}