fix comb86pm
add flxg0687
This commit is contained in:
@@ -84,14 +84,14 @@ func (l *COMB86PMLogic) COMB86PM(req *types.Request) (resp string, err *errs.App
|
||||
// 准备并发请求
|
||||
apiRequests := []APIRequest{
|
||||
{SourceId: "G31BJ05", ServiceId: "FLXG9687", Mapping: westmodel.FLXG9687FieldMapping, Wrap: "data", Service: "west"}, // 电诈风险预警
|
||||
{SourceId: "RIS031", ServiceId: "FLXG0687", Mapping: westmodel.FLXG0687FieldMapping, Wrap: "", Service: "yushan"}, // 反赌反诈
|
||||
{SourceId: "RIS031", ServiceId: "FLXG0687", Mapping: westmodel.FLXG0687FieldMapping, Wrap: "", Service: "yushan"}, // 反赌反诈
|
||||
{SourceId: "G03HZ01", ServiceId: "FLXG54F5", Mapping: westmodel.FLXG54F5FieldMapping, Wrap: "data", Service: "west"}, // 手机号码风险
|
||||
{SourceId: "G22SC01", ServiceId: "FLXG0V4B", Mapping: westmodel.FLXG0V4BFieldMapping, Wrap: "data", Service: "west"}, // 个人涉诉
|
||||
{SourceId: "G27BJ05", ServiceId: "JRZQ0A03", Mapping: westmodel.JRZQ0A03FieldMapping, Wrap: "data", Service: "west"}, // 借贷意向
|
||||
{SourceId: "G28BJ05", ServiceId: "JRZQ8203", Mapping: westmodel.JRZQ8203FieldMapping, Wrap: "data", Service: "west"}, // 借贷行为
|
||||
{SourceId: "G26BJ05", ServiceId: "FLXG3D56", Mapping: westmodel.FLXG3D56FieldMapping, Wrap: "data", Service: "west"}, // 特殊名单
|
||||
{SourceId: "G09XM02", ServiceId: "IVYZ5733", Mapping: westmodel.IVYZ5733FieldMapping, Wrap: "data", Service: "west"}, // 单人婚姻
|
||||
{SourceId: "G15BJ02", ServiceId: "YYSY6F2E", Mapping: westmodel.YYSY6F2EFieldMapping, Wrap: "data", Service: "west"}, // 运营商三要素详版
|
||||
{SourceId: "G27BJ05", ServiceId: "JRZQ0A03", Mapping: westmodel.JRZQ0A03FieldMapping, Wrap: "data", Service: "west"}, // 借贷意向
|
||||
{SourceId: "G28BJ05", ServiceId: "JRZQ8203", Mapping: westmodel.JRZQ8203FieldMapping, Wrap: "data", Service: "west"}, // 借贷行为
|
||||
{SourceId: "G26BJ05", ServiceId: "FLXG3D56", Mapping: westmodel.FLXG3D56FieldMapping, Wrap: "data", Service: "west"}, // 特殊名单
|
||||
{SourceId: "G09XM02", ServiceId: "IVYZ5733", Mapping: westmodel.IVYZ5733FieldMapping, Wrap: "data", Service: "west"}, // 单人婚姻
|
||||
{SourceId: "G15BJ02", ServiceId: "YYSY6F2E", Mapping: westmodel.YYSY6F2EFieldMapping, Wrap: "data", Service: "west"}, // 运营商三要素详版
|
||||
}
|
||||
|
||||
// 为每个请求构建对应的请求参数
|
||||
|
||||
100
apps/api/internal/logic/FLXG/flxg0687logic.go
Normal file
100
apps/api/internal/logic/FLXG/flxg0687logic.go
Normal file
@@ -0,0 +1,100 @@
|
||||
package FLXG
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
|
||||
"tianyuan-api/apps/api/internal/svc"
|
||||
"tianyuan-api/apps/api/internal/types"
|
||||
"tianyuan-api/apps/api/internal/validator"
|
||||
"tianyuan-api/pkg/crypto"
|
||||
"tianyuan-api/pkg/errs"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type FLXG0687Logic struct {
|
||||
logx.Logger
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
}
|
||||
|
||||
func NewFLXG0687Logic(ctx context.Context, svcCtx *svc.ServiceContext) *FLXG0687Logic {
|
||||
return &FLXG0687Logic{
|
||||
Logger: logx.WithContext(ctx),
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
func (l *FLXG0687Logic) FLXG0687(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 "", errs.ErrSystem
|
||||
}
|
||||
transactionID, ok := l.ctx.Value("transactionID").(string)
|
||||
if !ok {
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
userId, userIdOk := l.ctx.Value("userId").(int64)
|
||||
if !userIdOk {
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
productCode, productCodeOk := l.ctx.Value("productCode").(string)
|
||||
if !productCodeOk || productCode == "" {
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
defer func() {
|
||||
if err != nil {
|
||||
status = "failed"
|
||||
charges = false
|
||||
} else {
|
||||
status = "success"
|
||||
charges = true
|
||||
}
|
||||
sendApiRequestMessageErr := l.svcCtx.ApiRequestMqsService.SendApiRequestMessage(l.ctx, transactionID, userId, productCode, status, charges, remark)
|
||||
if sendApiRequestMessageErr != nil {
|
||||
logx.Errorf("发送 API 请求消息失败: %v", err)
|
||||
}
|
||||
}()
|
||||
// 1、解密
|
||||
key, decodeErr := hex.DecodeString(secretKey)
|
||||
if decodeErr != nil {
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
decryptData, aesDecryptErr := crypto.AesDecrypt(req.Data, key)
|
||||
if aesDecryptErr != nil || len(decryptData) == 0 {
|
||||
return "", errs.ErrParamDecryption
|
||||
}
|
||||
|
||||
// 2、校验
|
||||
var data validator.FLXG0687Request
|
||||
if validatorErr := validator.ValidateAndParse(decryptData, &data); validatorErr != nil {
|
||||
return "", errs.ErrParamValidation
|
||||
}
|
||||
// 3、组装羽山请求参数
|
||||
yushanReq := map[string]interface{}{
|
||||
"keyWord": data.IDCard,
|
||||
"type": 3,
|
||||
}
|
||||
respData, reqErr := l.svcCtx.YushanService.Request("RIS031", yushanReq)
|
||||
if reqErr != nil {
|
||||
logx.Errorf("羽山 RIS031 请求失败:err:%v", reqErr)
|
||||
if appErr, ok := reqErr.(*errs.AppError); ok {
|
||||
return "", appErr
|
||||
}
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
if len(respData) == 0 {
|
||||
return "", errs.ErrNotFound
|
||||
}
|
||||
|
||||
encryptData, aesEncrypt := crypto.AesEncrypt(respData, key)
|
||||
if aesEncrypt != nil {
|
||||
return "", errs.ErrSystem
|
||||
}
|
||||
return encryptData, nil
|
||||
}
|
||||
Reference in New Issue
Block a user