temp
This commit is contained in:
parent
c35864c47b
commit
641d7f948c
64
aes.go
64
aes.go
@ -96,37 +96,37 @@ func main() {
|
||||
|
||||
var data interface{}
|
||||
|
||||
decrypt, err := AesDecrypt("4m/PoMtbeJKATgzUBDfYDUk404jaEa8D6l4LH1J8+u8/Fc5VPA24qWEX+T4Q47APxpedOi5Rsah2Z/op1guL0i4m/VCHii1ysYi2Y7OBvL+bd2LvY7fmAuctmx2YN7V66zyD3yAXYJBez4Ui1xMahsLbgrdprRvIqn/vgcOA+SPZM41qWNdxthczO/SlNkYQs0oAiNSzhSOaB2nX6hKmvWciLdRE3wBi75Lfnuni2FK2FtWnWvDw8MqreEO9xazz8cVXPwdqpIbS61dQOntkFF3QSSGt1lAvCtOrcKd06gEq14QOfFfMGM4Ck/Z+fiB1pXPBV7SAHp8PBcSyr0qtv2VBXid+dWe55EJetkPhJgOg1BaBJHZImAFsTakEnP9ZH67xsiWVajN5hThTsZunzrFyj8Wmn60EvBVJ+oQnKOJ35dt2c2LLRHG/O3/lkMBuiAVp/xtlO5R8vMshpMgM1g==", key)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = json.Unmarshal(decrypt, &data)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
fmt.Println(data)
|
||||
//decrypt, err := AesDecrypt("ELKXVN8ZOhxUUsLWbHVIhbvTT94rU+u69vuE9JonsQYSAcNFKn4xQXoyRKd7mJCRIQ/4rlSj5A1KqHlR7jLIcyHaCCdvbEF1pGVw4oRpw6i8sFPWSjvnUuOUgKsaniJ6lb1SYBpZRlBSzG36NiAufdEeH0gcHDu9x9IGzkmdXk8=", key)
|
||||
//if err != nil {
|
||||
// return
|
||||
//}
|
||||
//err = json.Unmarshal(decrypt, &data)
|
||||
//if err != nil {
|
||||
// return
|
||||
//}
|
||||
//fmt.Println(data)
|
||||
|
||||
//data = map[string]interface{}{
|
||||
// "id_card": "45212220000827423X",
|
||||
// "name": "张荣宏",
|
||||
// "time_range": "5",
|
||||
// "mobile_no": "18276151590",
|
||||
//}
|
||||
//
|
||||
//// 将结构体转为 JSON 字符串
|
||||
//jsonData, err := json.Marshal(data)
|
||||
//if err != nil {
|
||||
// fmt.Println("JSON 序列化错误:", err)
|
||||
// return
|
||||
//}
|
||||
//
|
||||
//// 对 JSON 数据进行加密
|
||||
//encryptedData, err := AesEncrypt(jsonData, key)
|
||||
//if err != nil {
|
||||
// fmt.Println("加密错误:", err)
|
||||
// return
|
||||
//}
|
||||
//
|
||||
//// 输出加密后的结果
|
||||
//fmt.Println("加密后的数据:", encryptedData)
|
||||
data = map[string]interface{}{
|
||||
"id_card": "45212220000827423X",
|
||||
"name": "张荣宏",
|
||||
"time_range": "5",
|
||||
"mobile_no": "18276151590",
|
||||
}
|
||||
|
||||
// 将结构体转为 JSON 字符串
|
||||
jsonData, err := json.Marshal(data)
|
||||
if err != nil {
|
||||
fmt.Println("JSON 序列化错误:", err)
|
||||
return
|
||||
}
|
||||
|
||||
// 对 JSON 数据进行加密
|
||||
encryptedData, err := AesEncrypt(jsonData, key)
|
||||
if err != nil {
|
||||
fmt.Println("加密错误:", err)
|
||||
return
|
||||
}
|
||||
|
||||
// 输出加密后的结果
|
||||
fmt.Println("加密后的数据:", encryptedData)
|
||||
}
|
||||
|
@ -11,10 +11,6 @@ type request {
|
||||
data string `json:"data"`
|
||||
}
|
||||
|
||||
type response {
|
||||
data string `json:"data"`
|
||||
}
|
||||
|
||||
@server (
|
||||
group: IVYZ
|
||||
prefix: /api/v1
|
||||
@ -22,22 +18,22 @@ type response {
|
||||
)
|
||||
service api-api {
|
||||
@handler IVYZ0B03
|
||||
post /IVYZ0B03 (request) returns (response)
|
||||
post /IVYZ0B03 (request) returns (string)
|
||||
|
||||
@handler IVYZ5733
|
||||
post /IVYZ5733 (request) returns (response)
|
||||
post /IVYZ5733 (request) returns (string)
|
||||
|
||||
@handler IVYZ9363
|
||||
post /IVYZ9363 (request) returns (response)
|
||||
post /IVYZ9363 (request) returns (string)
|
||||
|
||||
@handler IVYZ385E
|
||||
post /IVYZ385E (request) returns (response)
|
||||
post /IVYZ385E (request) returns (string)
|
||||
|
||||
@handler IVYZ2125
|
||||
post /IVYZ2125 (request) returns (response)
|
||||
post /IVYZ2125 (request) returns (string)
|
||||
|
||||
@handler IVYZADEE
|
||||
post /IVYZADEE (request) returns (response)
|
||||
post /IVYZADEE (request) returns (string)
|
||||
}
|
||||
|
||||
@server (
|
||||
@ -47,34 +43,34 @@ service api-api {
|
||||
)
|
||||
service api-api {
|
||||
@handler FLXGCA3D
|
||||
post /FLXGCA3D (request) returns (response)
|
||||
post /FLXGCA3D (request) returns (string)
|
||||
|
||||
@handler FLXG970F
|
||||
post /FLXG970F (request) returns (response)
|
||||
post /FLXG970F (request) returns (string)
|
||||
|
||||
@handler FLXG75FE
|
||||
post /FLXG75FE (request) returns (response)
|
||||
post /FLXG75FE (request) returns (string)
|
||||
|
||||
@handler FLXGDEC7
|
||||
post /FLXGDEC7 (request) returns (response)
|
||||
post /FLXGDEC7 (request) returns (string)
|
||||
|
||||
@handler FLXG5876
|
||||
post /FLXG5876 (request) returns (response)
|
||||
post /FLXG5876 (request) returns (string)
|
||||
|
||||
@handler FLXG54F5
|
||||
post /FLXG54F5 (request) returns (response)
|
||||
post /FLXG54F5 (request) returns (string)
|
||||
|
||||
@handler FLXGC9D1
|
||||
post /FLXGC9D1 (request) returns (response)
|
||||
post /FLXGC9D1 (request) returns (string)
|
||||
|
||||
@handler FLXG9687
|
||||
post /FLXG9687 (request) returns (response)
|
||||
post /FLXG9687 (request) returns (string)
|
||||
|
||||
@handler FLXG162A
|
||||
post /FLXG162A (request) returns (response)
|
||||
post /FLXG162A (request) returns (string)
|
||||
|
||||
@handler FLXG3D56
|
||||
post /FLXG3D56 (request) returns (response)
|
||||
post /FLXG3D56 (request) returns (string)
|
||||
}
|
||||
|
||||
@server (
|
||||
@ -84,19 +80,19 @@ service api-api {
|
||||
)
|
||||
service api-api {
|
||||
@handler QYGLB4C0
|
||||
post /QYGLB4C0 (request) returns (response)
|
||||
post /QYGLB4C0 (request) returns (string)
|
||||
|
||||
@handler QYGL8261
|
||||
post /QYGL8261 (request) returns (response)
|
||||
post /QYGL8261 (request) returns (string)
|
||||
|
||||
@handler QYGL45BD
|
||||
post /QYGL45BD (request) returns (response)
|
||||
post /QYGL45BD (request) returns (string)
|
||||
|
||||
@handler QYGL2ACD
|
||||
post /QYGL2ACD (request) returns (response)
|
||||
post /QYGL2ACD (request) returns (string)
|
||||
|
||||
@handler QYGL6F2D
|
||||
post /QYGL6F2D (request) returns (response)
|
||||
post /QYGL6F2D (request) returns (string)
|
||||
}
|
||||
|
||||
@server (
|
||||
@ -106,22 +102,22 @@ service api-api {
|
||||
)
|
||||
service api-api {
|
||||
@handler YYSY6F2E
|
||||
post /YYSY6F2E (request) returns (response)
|
||||
post /YYSY6F2E (request) returns (string)
|
||||
|
||||
@handler YYSY09CD
|
||||
post /YYSY09CD (request) returns (response)
|
||||
post /YYSY09CD (request) returns (string)
|
||||
|
||||
@handler YYSYBE08
|
||||
post /YYSYBE08 (request) returns (response)
|
||||
post /YYSYBE08 (request) returns (string)
|
||||
|
||||
@handler YYSYD50F
|
||||
post /YYSYD50F (request) returns (response)
|
||||
post /YYSYD50F (request) returns (string)
|
||||
|
||||
@handler YYSYF7DB
|
||||
post /YYSYF7DB (request) returns (response)
|
||||
post /YYSYF7DB (request) returns (string)
|
||||
|
||||
@handler YYSY4B37
|
||||
post /YYSY4B37 (request) returns (response)
|
||||
post /YYSY4B37 (request) returns (string)
|
||||
}
|
||||
|
||||
@server (
|
||||
@ -131,15 +127,15 @@ service api-api {
|
||||
)
|
||||
service api-api {
|
||||
@handler JRZQDCBE
|
||||
post /JRZQDCBE (request) returns (response)
|
||||
post /JRZQDCBE (request) returns (string)
|
||||
|
||||
@handler JRZQ0A03
|
||||
post /JRZQ0A03 (request) returns (response)
|
||||
post /JRZQ0A03 (request) returns (string)
|
||||
|
||||
@handler JRZQ8203
|
||||
post /JRZQ8203 (request) returns (response)
|
||||
post /JRZQ8203 (request) returns (string)
|
||||
|
||||
@handler JRZQ4AA8
|
||||
post /JRZQ4AA8 (request) returns (response)
|
||||
post /JRZQ4AA8 (request) returns (string)
|
||||
}
|
||||
|
||||
|
@ -30,25 +30,25 @@ func NewFLXG162ALogic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG162A
|
||||
}
|
||||
}
|
||||
|
||||
func (l *FLXG162ALogic) FLXG162A(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *FLXG162ALogic) FLXG162A(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -66,17 +66,17 @@ func (l *FLXG162ALogic) FLXG162A(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.FLXG162ARequest
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -84,7 +84,7 @@ func (l *FLXG162ALogic) FLXG162A(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -93,24 +93,22 @@ func (l *FLXG162ALogic) FLXG162A(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G32BJ05", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
var respData westmodel.G32BJ05Response
|
||||
unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
if unmarshalErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
if respData.Data.Code != "00" && respData.Data.Code != "100002" {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
if aesEncrypt != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
return &types.Response{
|
||||
Data: encryptData,
|
||||
}, nil
|
||||
return encryptData, nil
|
||||
}
|
||||
|
@ -31,25 +31,25 @@ func NewFLXG3D56Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG3D56
|
||||
}
|
||||
|
||||
// FLXG3D56 特殊名单
|
||||
func (l *FLXG3D56Logic) FLXG3D56(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *FLXG3D56Logic) FLXG3D56(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
defer func() {
|
||||
@ -68,17 +68,17 @@ func (l *FLXG3D56Logic) FLXG3D56(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.FLXG3D56Request
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -86,7 +86,7 @@ func (l *FLXG3D56Logic) FLXG3D56(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -95,25 +95,23 @@ func (l *FLXG3D56Logic) FLXG3D56(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G26BJ05", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
var respData westmodel.G26BJ05Response
|
||||
unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
if unmarshalErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
if respData.Data.Code != "00" && respData.Data.Code != "100002" {
|
||||
return nil, errs.ErrDataSource
|
||||
return "", errs.ErrDataSource
|
||||
}
|
||||
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
if aesEncrypt != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
return &types.Response{
|
||||
Data: encryptData,
|
||||
}, nil
|
||||
return encryptData, nil
|
||||
}
|
||||
|
@ -30,25 +30,25 @@ func NewFLXG54F5Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG54F5
|
||||
}
|
||||
}
|
||||
|
||||
func (l *FLXG54F5Logic) FLXG54F5(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *FLXG54F5Logic) FLXG54F5(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -66,17 +66,17 @@ func (l *FLXG54F5Logic) FLXG54F5(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.FLXG54F5Request
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -84,7 +84,7 @@ func (l *FLXG54F5Logic) FLXG54F5(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -93,24 +93,22 @@ func (l *FLXG54F5Logic) FLXG54F5(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G03HZ01", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
var respData westmodel.G03HZ01Response
|
||||
unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
if unmarshalErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
if respData.Code != "0000" {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
if aesEncrypt != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
return &types.Response{
|
||||
Data: encryptData,
|
||||
}, nil
|
||||
return encryptData, nil
|
||||
}
|
||||
|
@ -29,25 +29,25 @@ func NewFLXG5876Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG5876
|
||||
}
|
||||
}
|
||||
|
||||
func (l *FLXG5876Logic) FLXG5876(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *FLXG5876Logic) FLXG5876(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -65,17 +65,17 @@ func (l *FLXG5876Logic) FLXG5876(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.FLXG5876Request
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -83,7 +83,7 @@ func (l *FLXG5876Logic) FLXG5876(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -92,26 +92,24 @@ func (l *FLXG5876Logic) FLXG5876(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G03XM02", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G26BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ func NewFLXG75FELogic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG75FE
|
||||
}
|
||||
}
|
||||
|
||||
func (l *FLXG75FELogic) FLXG75FE(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *FLXG75FELogic) FLXG75FE(req *types.Request) (resp string, err *errs.AppError) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return
|
||||
|
@ -29,25 +29,25 @@ func NewFLXG9687Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG9687
|
||||
}
|
||||
}
|
||||
|
||||
func (l *FLXG9687Logic) FLXG9687(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *FLXG9687Logic) FLXG9687(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -65,17 +65,17 @@ func (l *FLXG9687Logic) FLXG9687(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.FLXG9687Request
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -83,7 +83,7 @@ func (l *FLXG9687Logic) FLXG9687(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -92,26 +92,24 @@ func (l *FLXG9687Logic) FLXG9687(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G31BJ05", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G32BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -29,25 +29,25 @@ func NewFLXG970FLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG970F
|
||||
}
|
||||
}
|
||||
|
||||
func (l *FLXG970FLogic) FLXG970F(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *FLXG970FLogic) FLXG970F(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -65,17 +65,17 @@ func (l *FLXG970FLogic) FLXG970F(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.FLXG970FRequest
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -83,7 +83,7 @@ func (l *FLXG970FLogic) FLXG970F(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -92,26 +92,24 @@ func (l *FLXG970FLogic) FLXG970F(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("WEST00028", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G32BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -29,25 +29,25 @@ func NewFLXGC9D1Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXGC9D1
|
||||
}
|
||||
}
|
||||
|
||||
func (l *FLXGC9D1Logic) FLXGC9D1(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *FLXGC9D1Logic) FLXGC9D1(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -65,17 +65,17 @@ func (l *FLXGC9D1Logic) FLXGC9D1(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.FLXGC9D1Request
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -83,7 +83,7 @@ func (l *FLXGC9D1Logic) FLXGC9D1(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -92,26 +92,24 @@ func (l *FLXGC9D1Logic) FLXGC9D1(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G30BJ05", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G32BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -29,25 +29,25 @@ func NewFLXGCA3DLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXGCA3D
|
||||
}
|
||||
}
|
||||
|
||||
func (l *FLXGCA3DLogic) FLXGCA3D(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *FLXGCA3DLogic) FLXGCA3D(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -65,17 +65,17 @@ func (l *FLXGCA3DLogic) FLXGCA3D(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.FLXGCA3DRequest
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -83,7 +83,7 @@ func (l *FLXGCA3DLogic) FLXGCA3D(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -92,26 +92,24 @@ func (l *FLXGCA3DLogic) FLXGCA3D(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G22BJ03", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G32BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -29,25 +29,25 @@ func NewFLXGDEC7Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXGDEC7
|
||||
}
|
||||
}
|
||||
|
||||
func (l *FLXGDEC7Logic) FLXGDEC7(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *FLXGDEC7Logic) FLXGDEC7(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -65,17 +65,17 @@ func (l *FLXGDEC7Logic) FLXGDEC7(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.FLXGDEC7Request
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -83,7 +83,7 @@ func (l *FLXGDEC7Logic) FLXGDEC7(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -92,26 +92,24 @@ func (l *FLXGDEC7Logic) FLXGDEC7(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G23BJ03", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G32BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -24,26 +24,26 @@ func NewIVYZ0B03Logic(ctx context.Context, svcCtx *svc.ServiceContext) *IVYZ0B03
|
||||
}
|
||||
}
|
||||
|
||||
func (l *IVYZ0B03Logic) IVYZ0B03(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *IVYZ0B03Logic) IVYZ0B03(req *types.Request) (resp string, err *errs.AppError) {
|
||||
return
|
||||
//var status string
|
||||
//var charges bool
|
||||
//var remark = ""
|
||||
//secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
//if !ok {
|
||||
// return &types.Response{}, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
//if !ok {
|
||||
// return &types.Response{}, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
//if !userIdOk {
|
||||
// return &types.Response{}, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
//if !productCodeOk || productCode == "" {
|
||||
// return &types.Response{}, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//defer func() {
|
||||
// if err != nil {
|
||||
@ -61,17 +61,17 @@ func (l *IVYZ0B03Logic) IVYZ0B03(req *types.Request) (resp *types.Response, err
|
||||
//// 1、解密
|
||||
//key, decodeErr := hex.DecodeString(secretKey)
|
||||
//if decodeErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
//if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
// return nil, errs.ErrParamDecryption
|
||||
// return "", errs.ErrParamDecryption
|
||||
//}
|
||||
//
|
||||
//// 2、校验
|
||||
//var data validator.FLXGDEC7Request
|
||||
//if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
// return nil, errs.ErrParamValidation
|
||||
// return "", errs.ErrParamValidation
|
||||
//}
|
||||
//
|
||||
//// 3、西部加密
|
||||
@ -79,7 +79,7 @@ func (l *IVYZ0B03Logic) IVYZ0B03(req *types.Request) (resp *types.Response, err
|
||||
//encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
//if encryptStructFieldsErr != nil {
|
||||
// logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//// 4、发送请求到西部
|
||||
@ -88,24 +88,24 @@ func (l *IVYZ0B03Logic) IVYZ0B03(req *types.Request) (resp *types.Response, err
|
||||
//
|
||||
//westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G23BJ03", apiRequest)
|
||||
//if callAPIErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//// 5、响应解析
|
||||
////var respData westmodel.G32BJ05Response
|
||||
////unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
////if unmarshalErr != nil {
|
||||
//// return nil, errs.ErrSystem
|
||||
//// return "", errs.ErrSystem
|
||||
////}
|
||||
////
|
||||
////if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
//// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
////} else {
|
||||
//// return nil, errs.ErrSystem
|
||||
//// return "", errs.ErrSystem
|
||||
////}
|
||||
////encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
////if aesEncrypt != nil {
|
||||
//// return nil, errs.ErrSystem
|
||||
//// return "", errs.ErrSystem
|
||||
////}
|
||||
//return &types.Response{
|
||||
// Data: string(westResp),
|
||||
|
@ -25,26 +25,26 @@ func NewIVYZ2125Logic(ctx context.Context, svcCtx *svc.ServiceContext) *IVYZ2125
|
||||
}
|
||||
|
||||
// IVYZ2125 活体+人像核验组件
|
||||
func (l *IVYZ2125Logic) IVYZ2125(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *IVYZ2125Logic) IVYZ2125(req *types.Request) (resp string, err *errs.AppError) {
|
||||
return
|
||||
//var status string
|
||||
//var charges bool
|
||||
//var remark = ""
|
||||
//secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
//if !ok {
|
||||
// return &types.Response{}, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
//if !ok {
|
||||
// return &types.Response{}, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
//if !userIdOk {
|
||||
// return &types.Response{}, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
//if !productCodeOk || productCode == "" {
|
||||
// return &types.Response{}, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//defer func() {
|
||||
// if err != nil {
|
||||
@ -62,17 +62,17 @@ func (l *IVYZ2125Logic) IVYZ2125(req *types.Request) (resp *types.Response, err
|
||||
//// 1、解密
|
||||
//key, decodeErr := hex.DecodeString(secretKey)
|
||||
//if decodeErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
//if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
// return nil, errs.ErrParamDecryption
|
||||
// return "", errs.ErrParamDecryption
|
||||
//}
|
||||
//
|
||||
//// 2、校验
|
||||
//var data validator.FLXGDEC7Request
|
||||
//if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
// return nil, errs.ErrParamValidation
|
||||
// return "", errs.ErrParamValidation
|
||||
//}
|
||||
//
|
||||
//// 3、西部加密
|
||||
@ -80,7 +80,7 @@ func (l *IVYZ2125Logic) IVYZ2125(req *types.Request) (resp *types.Response, err
|
||||
//encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
//if encryptStructFieldsErr != nil {
|
||||
// logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//// 4、发送请求到西部
|
||||
@ -89,24 +89,24 @@ func (l *IVYZ2125Logic) IVYZ2125(req *types.Request) (resp *types.Response, err
|
||||
//
|
||||
//westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G23BJ03", apiRequest)
|
||||
//if callAPIErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//// 5、响应解析
|
||||
////var respData westmodel.G32BJ05Response
|
||||
////unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
////if unmarshalErr != nil {
|
||||
//// return nil, errs.ErrSystem
|
||||
//// return "", errs.ErrSystem
|
||||
////}
|
||||
////
|
||||
////if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
//// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
////} else {
|
||||
//// return nil, errs.ErrSystem
|
||||
//// return "", errs.ErrSystem
|
||||
////}
|
||||
////encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
////if aesEncrypt != nil {
|
||||
//// return nil, errs.ErrSystem
|
||||
//// return "", errs.ErrSystem
|
||||
////}
|
||||
//return &types.Response{
|
||||
// Data: string(westResp),
|
||||
|
@ -29,25 +29,25 @@ func NewIVYZ385ELogic(ctx context.Context, svcCtx *svc.ServiceContext) *IVYZ385E
|
||||
}
|
||||
}
|
||||
|
||||
func (l *IVYZ385ELogic) IVYZ385E(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *IVYZ385ELogic) IVYZ385E(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -65,17 +65,17 @@ func (l *IVYZ385ELogic) IVYZ385E(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.IVYZ385ERequest
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -83,7 +83,7 @@ func (l *IVYZ385ELogic) IVYZ385E(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -92,26 +92,24 @@ func (l *IVYZ385ELogic) IVYZ385E(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("WEST00020", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G32BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -29,25 +29,25 @@ func NewIVYZ5733Logic(ctx context.Context, svcCtx *svc.ServiceContext) *IVYZ5733
|
||||
}
|
||||
}
|
||||
|
||||
func (l *IVYZ5733Logic) IVYZ5733(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *IVYZ5733Logic) IVYZ5733(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -65,17 +65,17 @@ func (l *IVYZ5733Logic) IVYZ5733(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.IVYZ5733Request
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -83,7 +83,7 @@ func (l *IVYZ5733Logic) IVYZ5733(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -92,28 +92,26 @@ func (l *IVYZ5733Logic) IVYZ5733(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G09GX01", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
var respData westmodel.G09GX01Response
|
||||
unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
if unmarshalErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
if respData.Code == 400 || respData.Code == 500 || respData.Code == 999 {
|
||||
logx.Errorf("西部响应错误%v", respData)
|
||||
return nil, errs.ErrSystem
|
||||
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 nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
return &types.Response{
|
||||
Data: encryptData,
|
||||
}, nil
|
||||
return encryptData, nil
|
||||
}
|
||||
|
@ -29,25 +29,25 @@ func NewIVYZ9363Logic(ctx context.Context, svcCtx *svc.ServiceContext) *IVYZ9363
|
||||
}
|
||||
}
|
||||
|
||||
func (l *IVYZ9363Logic) IVYZ9363(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *IVYZ9363Logic) IVYZ9363(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -65,17 +65,17 @@ func (l *IVYZ9363Logic) IVYZ9363(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.IVYZ9363Request
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -83,7 +83,7 @@ func (l *IVYZ9363Logic) IVYZ9363(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -92,26 +92,24 @@ func (l *IVYZ9363Logic) IVYZ9363(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G10GX01", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G32BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -24,26 +24,26 @@ func NewIVYZADEELogic(ctx context.Context, svcCtx *svc.ServiceContext) *IVYZADEE
|
||||
}
|
||||
}
|
||||
|
||||
func (l *IVYZADEELogic) IVYZADEE(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *IVYZADEELogic) IVYZADEE(req *types.Request) (resp string, err *errs.AppError) {
|
||||
return
|
||||
//var status string
|
||||
//var charges bool
|
||||
//var remark = ""
|
||||
//secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
//if !ok {
|
||||
// return &types.Response{}, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
//if !ok {
|
||||
// return &types.Response{}, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
//if !userIdOk {
|
||||
// return &types.Response{}, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
//if !productCodeOk || productCode == "" {
|
||||
// return &types.Response{}, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//defer func() {
|
||||
// if err != nil {
|
||||
@ -61,17 +61,17 @@ func (l *IVYZADEELogic) IVYZADEE(req *types.Request) (resp *types.Response, err
|
||||
//// 1、解密
|
||||
//key, decodeErr := hex.DecodeString(secretKey)
|
||||
//if decodeErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
//if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
// return nil, errs.ErrParamDecryption
|
||||
// return "", errs.ErrParamDecryption
|
||||
//}
|
||||
//
|
||||
//// 2、校验
|
||||
//var data validator.FLXGDEC7Request
|
||||
//if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
// return nil, errs.ErrParamValidation
|
||||
// return "", errs.ErrParamValidation
|
||||
//}
|
||||
//
|
||||
//// 3、西部加密
|
||||
@ -79,7 +79,7 @@ func (l *IVYZADEELogic) IVYZADEE(req *types.Request) (resp *types.Response, err
|
||||
//encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
//if encryptStructFieldsErr != nil {
|
||||
// logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//// 4、发送请求到西部
|
||||
@ -88,24 +88,24 @@ func (l *IVYZADEELogic) IVYZADEE(req *types.Request) (resp *types.Response, err
|
||||
//
|
||||
//westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("idCardThreeElements", apiRequest)
|
||||
//if callAPIErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//// 5、响应解析
|
||||
////var respData westmodel.G32BJ05Response
|
||||
////unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
////if unmarshalErr != nil {
|
||||
//// return nil, errs.ErrSystem
|
||||
//// return "", errs.ErrSystem
|
||||
////}
|
||||
////
|
||||
////if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
//// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
////} else {
|
||||
//// return nil, errs.ErrSystem
|
||||
//// return "", errs.ErrSystem
|
||||
////}
|
||||
////encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
////if aesEncrypt != nil {
|
||||
//// return nil, errs.ErrSystem
|
||||
//// return "", errs.ErrSystem
|
||||
////}
|
||||
//return &types.Response{
|
||||
// Data: string(westResp),
|
||||
|
@ -29,25 +29,25 @@ func NewJRZQ0A03Logic(ctx context.Context, svcCtx *svc.ServiceContext) *JRZQ0A03
|
||||
}
|
||||
}
|
||||
|
||||
func (l *JRZQ0A03Logic) JRZQ0A03(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *JRZQ0A03Logic) JRZQ0A03(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -65,17 +65,17 @@ func (l *JRZQ0A03Logic) JRZQ0A03(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.JRZQ0A03Request
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -83,7 +83,7 @@ func (l *JRZQ0A03Logic) JRZQ0A03(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -92,26 +92,24 @@ func (l *JRZQ0A03Logic) JRZQ0A03(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G27BJ05", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G32BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -29,25 +29,25 @@ func NewJRZQ4AA8Logic(ctx context.Context, svcCtx *svc.ServiceContext) *JRZQ4AA8
|
||||
}
|
||||
}
|
||||
|
||||
func (l *JRZQ4AA8Logic) JRZQ4AA8(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *JRZQ4AA8Logic) JRZQ4AA8(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -65,17 +65,17 @@ func (l *JRZQ4AA8Logic) JRZQ4AA8(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.JRZQ4AA8Request
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -83,7 +83,7 @@ func (l *JRZQ4AA8Logic) JRZQ4AA8(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -92,26 +92,24 @@ func (l *JRZQ4AA8Logic) JRZQ4AA8(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G29BJ05", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G32BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -29,25 +29,25 @@ func NewJRZQ8203Logic(ctx context.Context, svcCtx *svc.ServiceContext) *JRZQ8203
|
||||
}
|
||||
}
|
||||
|
||||
func (l *JRZQ8203Logic) JRZQ8203(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *JRZQ8203Logic) JRZQ8203(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -65,17 +65,17 @@ func (l *JRZQ8203Logic) JRZQ8203(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.JRZQ8203Request
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -83,7 +83,7 @@ func (l *JRZQ8203Logic) JRZQ8203(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -92,26 +92,24 @@ func (l *JRZQ8203Logic) JRZQ8203(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G28BJ05", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G32BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -29,25 +29,25 @@ func NewJRZQDCBELogic(ctx context.Context, svcCtx *svc.ServiceContext) *JRZQDCBE
|
||||
}
|
||||
}
|
||||
|
||||
func (l *JRZQDCBELogic) JRZQDCBE(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *JRZQDCBELogic) JRZQDCBE(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -65,17 +65,17 @@ func (l *JRZQDCBELogic) JRZQDCBE(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.JRZQDBCERequest
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -83,7 +83,7 @@ func (l *JRZQDCBELogic) JRZQDCBE(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -92,26 +92,24 @@ func (l *JRZQDCBELogic) JRZQDCBE(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G20GZ01", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G32BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -29,25 +29,25 @@ func NewQYGL2ACDLogic(ctx context.Context, svcCtx *svc.ServiceContext) *QYGL2ACD
|
||||
}
|
||||
}
|
||||
|
||||
func (l *QYGL2ACDLogic) QYGL2ACD(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *QYGL2ACDLogic) QYGL2ACD(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -65,17 +65,17 @@ func (l *QYGL2ACDLogic) QYGL2ACD(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.QYGL2ACDRequest
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -83,7 +83,7 @@ func (l *QYGL2ACDLogic) QYGL2ACD(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -92,26 +92,24 @@ func (l *QYGL2ACDLogic) QYGL2ACD(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("WEST00022", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G32BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -29,25 +29,25 @@ func NewQYGL45BDLogic(ctx context.Context, svcCtx *svc.ServiceContext) *QYGL45BD
|
||||
}
|
||||
}
|
||||
|
||||
func (l *QYGL45BDLogic) QYGL45BD(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *QYGL45BDLogic) QYGL45BD(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -65,17 +65,17 @@ func (l *QYGL45BDLogic) QYGL45BD(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.QYGL45BDRequest
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -83,7 +83,7 @@ func (l *QYGL45BDLogic) QYGL45BD(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -92,26 +92,24 @@ func (l *QYGL45BDLogic) QYGL45BD(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("WEST00021", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G32BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -29,25 +29,25 @@ func NewQYGL6F2DLogic(ctx context.Context, svcCtx *svc.ServiceContext) *QYGL6F2D
|
||||
}
|
||||
}
|
||||
|
||||
func (l *QYGL6F2DLogic) QYGL6F2D(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *QYGL6F2DLogic) QYGL6F2D(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -65,17 +65,17 @@ func (l *QYGL6F2DLogic) QYGL6F2D(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.QYGL6F2DRequest
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -83,7 +83,7 @@ func (l *QYGL6F2DLogic) QYGL6F2D(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -92,26 +92,24 @@ func (l *QYGL6F2DLogic) QYGL6F2D(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G05XM02", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G32BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -29,25 +29,25 @@ func NewQYGL8261Logic(ctx context.Context, svcCtx *svc.ServiceContext) *QYGL8261
|
||||
}
|
||||
}
|
||||
|
||||
func (l *QYGL8261Logic) QYGL8261(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *QYGL8261Logic) QYGL8261(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -65,17 +65,17 @@ func (l *QYGL8261Logic) QYGL8261(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.QYGL8261Request
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -83,7 +83,7 @@ func (l *QYGL8261Logic) QYGL8261(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -92,26 +92,24 @@ func (l *QYGL8261Logic) QYGL8261(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("Q03BJ03", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G32BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -29,25 +29,25 @@ func NewQYGLB4C0Logic(ctx context.Context, svcCtx *svc.ServiceContext) *QYGLB4C0
|
||||
}
|
||||
}
|
||||
|
||||
func (l *QYGLB4C0Logic) QYGLB4C0(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *QYGLB4C0Logic) QYGLB4C0(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -65,17 +65,17 @@ func (l *QYGLB4C0Logic) QYGLB4C0(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.QYGLB4C0Request
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -83,7 +83,7 @@ func (l *QYGLB4C0Logic) QYGLB4C0(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -92,26 +92,24 @@ func (l *QYGLB4C0Logic) QYGLB4C0(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G05HZ01", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G32BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -30,25 +30,25 @@ func NewYYSY09CDLogic(ctx context.Context, svcCtx *svc.ServiceContext) *YYSY09CD
|
||||
}
|
||||
|
||||
// YYSY09CD 三要素简版
|
||||
func (l *YYSY09CDLogic) YYSY09CD(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *YYSY09CDLogic) YYSY09CD(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -66,17 +66,17 @@ func (l *YYSY09CDLogic) YYSY09CD(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.YYSY09CDRequest
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -84,7 +84,7 @@ func (l *YYSY09CDLogic) YYSY09CD(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -93,26 +93,24 @@ func (l *YYSY09CDLogic) YYSY09CD(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G16BJ02", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G32BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -29,25 +29,25 @@ func NewYYSY4B37Logic(ctx context.Context, svcCtx *svc.ServiceContext) *YYSY4B37
|
||||
}
|
||||
}
|
||||
|
||||
func (l *YYSY4B37Logic) YYSY4B37(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *YYSY4B37Logic) YYSY4B37(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -65,17 +65,17 @@ func (l *YYSY4B37Logic) YYSY4B37(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.YYSY4B37Request
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -83,7 +83,7 @@ func (l *YYSY4B37Logic) YYSY4B37(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -92,26 +92,24 @@ func (l *YYSY4B37Logic) YYSY4B37(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G02BJ02", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G32BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -30,25 +30,25 @@ func NewYYSY6F2ELogic(ctx context.Context, svcCtx *svc.ServiceContext) *YYSY6F2E
|
||||
}
|
||||
|
||||
// YYSY6F2E 三要素详版
|
||||
func (l *YYSY6F2ELogic) YYSY6F2E(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *YYSY6F2ELogic) YYSY6F2E(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -66,17 +66,17 @@ func (l *YYSY6F2ELogic) YYSY6F2E(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.YYSY6F2ERequest
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -84,7 +84,7 @@ func (l *YYSY6F2ELogic) YYSY6F2E(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -93,26 +93,24 @@ func (l *YYSY6F2ELogic) YYSY6F2E(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G15BJ02", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G32BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -29,25 +29,25 @@ func NewYYSYBE08Logic(ctx context.Context, svcCtx *svc.ServiceContext) *YYSYBE08
|
||||
}
|
||||
}
|
||||
|
||||
func (l *YYSYBE08Logic) YYSYBE08(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *YYSYBE08Logic) YYSYBE08(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -65,17 +65,17 @@ func (l *YYSYBE08Logic) YYSYBE08(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.YYSYBE08Request
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -83,7 +83,7 @@ func (l *YYSYBE08Logic) YYSYBE08(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -92,26 +92,24 @@ func (l *YYSYBE08Logic) YYSYBE08(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G17BJ02", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G32BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -29,25 +29,25 @@ func NewYYSYD50FLogic(ctx context.Context, svcCtx *svc.ServiceContext) *YYSYD50F
|
||||
}
|
||||
}
|
||||
|
||||
func (l *YYSYD50FLogic) YYSYD50F(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *YYSYD50FLogic) YYSYD50F(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -65,17 +65,17 @@ func (l *YYSYD50FLogic) YYSYD50F(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.YYSYD50FRequest
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -83,7 +83,7 @@ func (l *YYSYD50FLogic) YYSYD50F(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -92,26 +92,24 @@ func (l *YYSYD50FLogic) YYSYD50F(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G18BJ02", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G32BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -27,25 +27,25 @@ func NewYYSYF7DBLogic(ctx context.Context, svcCtx *svc.ServiceContext) *YYSYF7DB
|
||||
}
|
||||
}
|
||||
|
||||
func (l *YYSYF7DBLogic) YYSYF7DB(req *types.Request) (resp *types.Response, err *errs.AppError) {
|
||||
func (l *YYSYF7DBLogic) YYSYF7DB(req *types.Request) (resp string, err *errs.AppError) {
|
||||
var status string
|
||||
var charges bool
|
||||
var remark = ""
|
||||
secretKey, ok := l.ctx.Value("secretKey").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return &types.Response{}, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
@ -63,17 +63,17 @@ func (l *YYSYF7DBLogic) YYSYF7DB(req *types.Request) (resp *types.Response, err
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return nil, errs.ErrParamDecryption
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.YYSYF7DBRequest
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return nil, errs.ErrParamValidation
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
|
||||
// 3、西部加密
|
||||
@ -81,7 +81,7 @@ func (l *YYSYF7DBLogic) YYSYF7DB(req *types.Request) (resp *types.Response, err
|
||||
encryptedFields, encryptStructFieldsErr := common.EncryptStructFields(data, westConfig.Key)
|
||||
if encryptStructFieldsErr != nil {
|
||||
logx.Errorf("西部加密错误:%v", encryptStructFieldsErr)
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 4、发送请求到西部
|
||||
@ -90,26 +90,24 @@ func (l *YYSYF7DBLogic) YYSYF7DB(req *types.Request) (resp *types.Response, err
|
||||
|
||||
westResp, callAPIErr := l.svcCtx.WestDexService.CallAPI("G19BJ02", apiRequest)
|
||||
if callAPIErr != nil {
|
||||
return nil, errs.ErrSystem
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
|
||||
// 5、响应解析
|
||||
//var respData westmodel.G32BJ05Response
|
||||
//unmarshalErr := json.Unmarshal(westResp, &respData)
|
||||
//if unmarshalErr != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//
|
||||
//if respData.Data.Code == "00" || respData.Data.Code == "100002" {
|
||||
// l.ctx = context.WithValue(l.ctx, "Charges", true)
|
||||
//} else {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
//encryptData, aesEncrypt := crypto.AesEncrypt(westResp, key)
|
||||
//if aesEncrypt != nil {
|
||||
// return nil, errs.ErrSystem
|
||||
// return "", errs.ErrSystem
|
||||
//}
|
||||
return &types.Response{
|
||||
Data: string(westResp),
|
||||
}, nil
|
||||
return string(westResp), nil
|
||||
}
|
||||
|
@ -6,7 +6,3 @@ package types
|
||||
type Request struct {
|
||||
Data string `json:"data"`
|
||||
}
|
||||
|
||||
type Response struct {
|
||||
Data string `json:"data"`
|
||||
}
|
||||
|
@ -27,6 +27,14 @@ func PKCS7UnPadding(origData []byte) ([]byte, error) {
|
||||
if unpadding > length {
|
||||
return nil, errors.New("unpadding size is invalid")
|
||||
}
|
||||
|
||||
// 检查填充字节是否一致
|
||||
for i := 0; i < unpadding; i++ {
|
||||
if origData[length-1-i] != byte(unpadding) {
|
||||
return nil, errors.New("invalid padding")
|
||||
}
|
||||
}
|
||||
|
||||
return origData[:(length - unpadding)], nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user