fix comb86pm
add flxg0687
This commit is contained in:
parent
b2c89a2c69
commit
62730da767
@ -85,6 +85,9 @@ service api-api {
|
|||||||
|
|
||||||
@handler FLXG0V4B
|
@handler FLXG0V4B
|
||||||
post /FLXG0V4B (request) returns (string)
|
post /FLXG0V4B (request) returns (string)
|
||||||
|
|
||||||
|
@handler FLXG0687
|
||||||
|
post /FLXG0687 (request) returns (string)
|
||||||
}
|
}
|
||||||
|
|
||||||
@server (
|
@server (
|
||||||
@ -169,6 +172,6 @@ service api-api {
|
|||||||
post /COMB298Y (request) returns (string)
|
post /COMB298Y (request) returns (string)
|
||||||
|
|
||||||
@handler COMB86PM
|
@handler COMB86PM
|
||||||
post /COMB86P (request) returns (string)
|
post /COMB86PM (request) returns (string)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
31
apps/api/internal/handler/FLXG/flxg0687handler.go
Normal file
31
apps/api/internal/handler/FLXG/flxg0687handler.go
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
package FLXG
|
||||||
|
|
||||||
|
import (
|
||||||
|
"net/http"
|
||||||
|
"tianyuan-api/pkg/errs"
|
||||||
|
"tianyuan-api/pkg/response"
|
||||||
|
|
||||||
|
"tianyuan-api/apps/api/internal/logic/FLXG"
|
||||||
|
"tianyuan-api/apps/api/internal/svc"
|
||||||
|
"tianyuan-api/apps/api/internal/types"
|
||||||
|
|
||||||
|
"github.com/zeromicro/go-zero/rest/httpx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func FLXG0687Handler(svcCtx *svc.ServiceContext) http.HandlerFunc {
|
||||||
|
return func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
var req types.Request
|
||||||
|
if err := httpx.Parse(r, &req); err != nil {
|
||||||
|
response.Fail(r.Context(), w, errs.ErrParamValidation, nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
l := FLXG.NewFLXG0687Logic(r.Context(), svcCtx)
|
||||||
|
resp, err := l.FLXG0687(&req)
|
||||||
|
if err != nil {
|
||||||
|
response.Fail(r.Context(), w, err, resp)
|
||||||
|
} else {
|
||||||
|
response.Success(r.Context(), w, resp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -29,7 +29,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
Method: http.MethodPost,
|
Method: http.MethodPost,
|
||||||
Path: "/COMB86P",
|
Path: "/COMB86PM",
|
||||||
Handler: COMB.COMB86PMHandler(serverCtx),
|
Handler: COMB.COMB86PMHandler(serverCtx),
|
||||||
},
|
},
|
||||||
}...,
|
}...,
|
||||||
@ -41,6 +41,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
|
|||||||
rest.WithMiddlewares(
|
rest.WithMiddlewares(
|
||||||
[]rest.Middleware{serverCtx.ApiAuthInterceptor},
|
[]rest.Middleware{serverCtx.ApiAuthInterceptor},
|
||||||
[]rest.Route{
|
[]rest.Route{
|
||||||
|
{
|
||||||
|
Method: http.MethodPost,
|
||||||
|
Path: "/FLXG0687",
|
||||||
|
Handler: FLXG.FLXG0687Handler(serverCtx),
|
||||||
|
},
|
||||||
{
|
{
|
||||||
Method: http.MethodPost,
|
Method: http.MethodPost,
|
||||||
Path: "/FLXG0V3B",
|
Path: "/FLXG0V3B",
|
||||||
|
@ -84,14 +84,14 @@ func (l *COMB86PMLogic) COMB86PM(req *types.Request) (resp string, err *errs.App
|
|||||||
// 准备并发请求
|
// 准备并发请求
|
||||||
apiRequests := []APIRequest{
|
apiRequests := []APIRequest{
|
||||||
{SourceId: "G31BJ05", ServiceId: "FLXG9687", Mapping: westmodel.FLXG9687FieldMapping, Wrap: "data", Service: "west"}, // 电诈风险预警
|
{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: "G03HZ01", ServiceId: "FLXG54F5", Mapping: westmodel.FLXG54F5FieldMapping, Wrap: "data", Service: "west"}, // 手机号码风险
|
||||||
{SourceId: "G22SC01", ServiceId: "FLXG0V4B", Mapping: westmodel.FLXG0V4BFieldMapping, 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: "G27BJ05", ServiceId: "JRZQ0A03", Mapping: westmodel.JRZQ0A03FieldMapping, Wrap: "data", Service: "west"}, // 借贷意向
|
||||||
{SourceId: "G28BJ05", ServiceId: "JRZQ8203", Mapping: westmodel.JRZQ8203FieldMapping, 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: "G26BJ05", ServiceId: "FLXG3D56", Mapping: westmodel.FLXG3D56FieldMapping, Wrap: "data", Service: "west"}, // 特殊名单
|
||||||
{SourceId: "G09XM02", ServiceId: "IVYZ5733", Mapping: westmodel.IVYZ5733FieldMapping, 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: "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
|
||||||
|
}
|
@ -38,6 +38,9 @@ type FLXG162ARequest struct {
|
|||||||
IDCard string `json:"id_card" validate:"required,validIDCard"`
|
IDCard string `json:"id_card" validate:"required,validIDCard"`
|
||||||
Name string `json:"name" validate:"required,min=1,validName"`
|
Name string `json:"name" validate:"required,min=1,validName"`
|
||||||
}
|
}
|
||||||
|
type FLXG0687Request struct {
|
||||||
|
IDCard string `json:"id_card" validate:"required,validIDCard"`
|
||||||
|
}
|
||||||
type FLXG970FRequest struct {
|
type FLXG970FRequest struct {
|
||||||
IDCard string `json:"id_card" validate:"required,validIDCard"`
|
IDCard string `json:"id_card" validate:"required,validIDCard"`
|
||||||
Name string `json:"name" validate:"required,min=1,validName"`
|
Name string `json:"name" validate:"required,min=1,validName"`
|
||||||
|
Loading…
Reference in New Issue
Block a user