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