temp
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user