f
This commit is contained in:
@@ -32,6 +32,61 @@ func generateAuthDateRange() string {
|
||||
return fmt.Sprintf("%s-%s", start, end)
|
||||
}
|
||||
|
||||
// callTianyuanApiWithLog 调用天元API并记录日志
|
||||
func (a *ApiRequestService) callTianyuanApiWithLog(ctx context.Context, featureID, apiID string, params map[string]interface{}) (*tianyuanapi.Response, error) {
|
||||
startTime := time.Now()
|
||||
resp, err := a.tianyuanapi.CallInterface(apiID, params)
|
||||
responseTime := time.Since(startTime).Milliseconds()
|
||||
|
||||
// 如果没有提供featureID,尝试从缓存中获取
|
||||
if featureID == "" {
|
||||
a.apiFeatureMapMutex.RLock()
|
||||
featureID = a.apiFeatureMapCache[apiID]
|
||||
a.apiFeatureMapMutex.RUnlock()
|
||||
}
|
||||
|
||||
// 构建调用记录选项
|
||||
callStatus := int64(0) // 默认失败
|
||||
errorCode := ""
|
||||
errorMessage := ""
|
||||
responseData := interface{}(nil)
|
||||
transactionID := ""
|
||||
|
||||
if err != nil {
|
||||
// 调用失败
|
||||
errorMessage = err.Error()
|
||||
// 尝试从错误信息中提取错误码
|
||||
if code := tianyuanapi.GetCodeByError(err); code != -1 {
|
||||
errorCode = fmt.Sprintf("%d", code)
|
||||
}
|
||||
} else {
|
||||
// 调用成功
|
||||
callStatus = 1
|
||||
responseData = resp.Data
|
||||
transactionID = resp.TransactionID
|
||||
}
|
||||
|
||||
// 异步记录调用日志(避免影响主流程)
|
||||
go func() {
|
||||
logOpts := CallLogOptions{
|
||||
FeatureID: featureID,
|
||||
ApiID: apiID,
|
||||
CallStatus: callStatus,
|
||||
ResponseTime: responseTime,
|
||||
ErrorCode: errorCode,
|
||||
ErrorMessage: errorMessage,
|
||||
RequestParams: params,
|
||||
ResponseData: responseData,
|
||||
TransactionID: transactionID,
|
||||
}
|
||||
if recordErr := a.tianyuanapiCallLogService.RecordCall(context.Background(), logOpts); recordErr != nil {
|
||||
logx.Errorf("记录天元API调用日志失败,api_id=%s, err=%v", apiID, recordErr)
|
||||
}
|
||||
}()
|
||||
|
||||
return resp, err
|
||||
}
|
||||
|
||||
type ApiRequestService struct {
|
||||
config config.Config
|
||||
featureModel model.FeatureModel
|
||||
@@ -39,16 +94,22 @@ type ApiRequestService struct {
|
||||
userFeatureWhitelistModel model.UserFeatureWhitelistModel
|
||||
whitelistService *WhitelistService
|
||||
tianyuanapi *tianyuanapi.Client
|
||||
tianyuanapiCallLogService *TianyuanapiCallLogService
|
||||
apiFeatureMapCache map[string]string // apiID -> featureID 缓存
|
||||
apiFeatureMapMutex sync.RWMutex
|
||||
}
|
||||
|
||||
// NewApiRequestService 是一个构造函数,用于初始化 ApiRequestService
|
||||
func NewApiRequestService(c config.Config, featureModel model.FeatureModel, productFeatureModel model.ProductFeatureModel, userFeatureWhitelistModel model.UserFeatureWhitelistModel, tianyuanapi *tianyuanapi.Client) *ApiRequestService {
|
||||
func NewApiRequestService(c config.Config, featureModel model.FeatureModel, productFeatureModel model.ProductFeatureModel, userFeatureWhitelistModel model.UserFeatureWhitelistModel, tianyuanapi *tianyuanapi.Client, tianyuanapiCallLogService *TianyuanapiCallLogService, whitelistService *WhitelistService) *ApiRequestService {
|
||||
return &ApiRequestService{
|
||||
config: c,
|
||||
featureModel: featureModel,
|
||||
productFeatureModel: productFeatureModel,
|
||||
userFeatureWhitelistModel: userFeatureWhitelistModel,
|
||||
tianyuanapi: tianyuanapi,
|
||||
tianyuanapiCallLogService: tianyuanapiCallLogService,
|
||||
whitelistService: whitelistService,
|
||||
apiFeatureMapCache: make(map[string]string),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,15 +122,21 @@ type APIResponseData struct {
|
||||
}
|
||||
|
||||
// ProcessRequests 处理请求
|
||||
func (a *ApiRequestService) ProcessRequests(params []byte, productID string) ([]byte, error) {
|
||||
var ctx, cancel = context.WithCancel(context.Background())
|
||||
func (a *ApiRequestService) ProcessRequests(ctx context.Context, params []byte, productID string) ([]byte, error) {
|
||||
var cancel context.CancelFunc
|
||||
ctx, cancel = context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
// 从params中提取id_card,用于白名单检查
|
||||
idCard := gjson.GetBytes(params, "id_card").String()
|
||||
|
||||
// 查询白名单(如果提供了id_card),集中由 WhitelistService 处理
|
||||
whitelistedFeatureApiIds, _ := a.whitelistService.GetWhitelistedFeatureApisByIdCard(ctx, idCard)
|
||||
var whitelistedFeatureApiIds map[string]bool
|
||||
if a.whitelistService != nil {
|
||||
whitelistedFeatureApiIds, _ = a.whitelistService.GetWhitelistedFeatureApisByIdCard(ctx, idCard)
|
||||
} else {
|
||||
whitelistedFeatureApiIds = make(map[string]bool)
|
||||
}
|
||||
|
||||
build := a.productFeatureModel.SelectBuilder().Where(squirrel.Eq{
|
||||
"product_id": productID,
|
||||
@@ -95,6 +162,13 @@ func (a *ApiRequestService) ProcessRequests(params []byte, productID string) ([]
|
||||
if len(featureList) == 0 {
|
||||
return nil, errors.New("处理请求错误,产品无对应接口功能")
|
||||
}
|
||||
|
||||
// 缓存apiID到featureID的映射关系,供后续调用记录使用
|
||||
a.apiFeatureMapMutex.Lock()
|
||||
for _, feature := range featureList {
|
||||
a.apiFeatureMapCache[feature.ApiId] = feature.Id
|
||||
}
|
||||
a.apiFeatureMapMutex.Unlock()
|
||||
var (
|
||||
wg sync.WaitGroup
|
||||
resultsCh = make(chan APIResponseData, len(featureList))
|
||||
@@ -140,7 +214,7 @@ func (a *ApiRequestService) ProcessRequests(params []byte, productID string) ([]
|
||||
tryCount := 0
|
||||
for {
|
||||
tryCount++
|
||||
resp, preprocessErr = a.PreprocessRequestApi(params, feature.ApiId)
|
||||
resp, preprocessErr = a.PreprocessRequestApi(ctx, params, feature.ApiId)
|
||||
if preprocessErr == nil {
|
||||
break
|
||||
}
|
||||
@@ -197,7 +271,7 @@ func (a *ApiRequestService) ProcessRequests(params []byte, productID string) ([]
|
||||
}
|
||||
|
||||
// ------------------------------------请求处理器--------------------------
|
||||
var requestProcessors = map[string]func(*ApiRequestService, []byte) ([]byte, error){
|
||||
var requestProcessors = map[string]func(*ApiRequestService, context.Context, []byte) ([]byte, error){
|
||||
"PersonEnterprisePro": (*ApiRequestService).ProcessPersonEnterpriseProRequest,
|
||||
"BehaviorRiskScan": (*ApiRequestService).ProcessBehaviorRiskScanRequest,
|
||||
"YYSYBE08": (*ApiRequestService).ProcessYYSYBE08Request,
|
||||
@@ -232,16 +306,16 @@ var requestProcessors = map[string]func(*ApiRequestService, []byte) ([]byte, err
|
||||
}
|
||||
|
||||
// PreprocessRequestApi 调用指定的请求处理函数
|
||||
func (a *ApiRequestService) PreprocessRequestApi(params []byte, apiID string) ([]byte, error) {
|
||||
func (a *ApiRequestService) PreprocessRequestApi(ctx context.Context, params []byte, apiID string) ([]byte, error) {
|
||||
if processor, exists := requestProcessors[apiID]; exists {
|
||||
return processor(a, params) // 调用 ApiRequestService 方法
|
||||
return processor(a, ctx, params) // 调用 ApiRequestService 方法
|
||||
}
|
||||
|
||||
return nil, errors.New("api请求, 未找到相应的处理程序")
|
||||
}
|
||||
|
||||
// PersonEnterprisePro 人企业关系加强版
|
||||
func (a *ApiRequestService) ProcessPersonEnterpriseProRequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessPersonEnterpriseProRequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
// 设置最大调用次数上限
|
||||
maxApiCalls := 20 // 允许最多查询20个企业
|
||||
@@ -250,7 +324,7 @@ func (a *ApiRequestService) ProcessPersonEnterpriseProRequest(params []byte) ([]
|
||||
return nil, errors.New("api请求, PersonEnterprisePro, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("QYGLB4C0", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "QYGLB4C0", map[string]interface{}{
|
||||
"id_card": idCard.String(),
|
||||
})
|
||||
if err != nil {
|
||||
@@ -452,7 +526,7 @@ func (a *ApiRequestService) ProcessPersonEnterpriseProRequest(params []byte) ([]
|
||||
}
|
||||
|
||||
// 调用QYGL8271接口获取企业涉诉信息
|
||||
lawsuitResp, err := a.tianyuanapi.CallInterface("QYGL8271", map[string]interface{}{
|
||||
lawsuitResp, err := a.callTianyuanApiWithLog(ctx, "", "QYGL8271", map[string]interface{}{
|
||||
"ent_name": orgName.String(),
|
||||
"ent_code": creditCode.String(),
|
||||
"auth_date": generateAuthDateRange(),
|
||||
@@ -576,14 +650,14 @@ func (a *ApiRequestService) ProcessPersonEnterpriseProRequest(params []byte) ([]
|
||||
}
|
||||
|
||||
// ProcesFLXG0V4BRequest 个人司法涉诉(详版)
|
||||
func (a *ApiRequestService) ProcessFLXG0V4BRequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessFLXG0V4BRequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
name := gjson.GetBytes(params, "name")
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
if !name.Exists() || !idCard.Exists() {
|
||||
return nil, errors.New("api请求, FLXG0V4B, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("FLXG0V4B", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "FLXG0V4B", map[string]interface{}{
|
||||
"name": name.String(),
|
||||
"id_card": idCard.String(),
|
||||
"auth_date": generateAuthDateRange(),
|
||||
@@ -599,13 +673,13 @@ func (a *ApiRequestService) ProcessFLXG0V4BRequest(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessFLXG0687Request 反诈反赌核验
|
||||
func (a *ApiRequestService) ProcessFLXG0687Request(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessFLXG0687Request(ctx context.Context, params []byte) ([]byte, error) {
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
if !idCard.Exists() {
|
||||
return nil, errors.New("api请求, FLXG0687, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("FLXG0687", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "FLXG0687", map[string]interface{}{
|
||||
"id_card": idCard.String(),
|
||||
})
|
||||
|
||||
@@ -627,7 +701,7 @@ func (a *ApiRequestService) ProcessFLXG0687Request(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessFLXG3D56Request 违约失信
|
||||
func (a *ApiRequestService) ProcessFLXG3D56Request(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessFLXG3D56Request(ctx context.Context, params []byte) ([]byte, error) {
|
||||
name := gjson.GetBytes(params, "name")
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
mobile := gjson.GetBytes(params, "mobile")
|
||||
@@ -635,7 +709,7 @@ func (a *ApiRequestService) ProcessFLXG3D56Request(params []byte) ([]byte, error
|
||||
return nil, errors.New("api请求, FLXG3D56, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("FLXG3D56", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "FLXG3D56", map[string]interface{}{
|
||||
"name": name.String(),
|
||||
"id_card": idCard.String(),
|
||||
"mobile_no": mobile.String(),
|
||||
@@ -682,14 +756,14 @@ func (a *ApiRequestService) ProcessFLXG3D56Request(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessIVYZ5733Request 婚姻状况
|
||||
func (a *ApiRequestService) ProcessIVYZ5733Request(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessIVYZ5733Request(ctx context.Context, params []byte) ([]byte, error) {
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
name := gjson.GetBytes(params, "name")
|
||||
if !idCard.Exists() || !name.Exists() {
|
||||
return nil, errors.New("api请求, IVYZ5733, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("IVYZ5733", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "IVYZ5733", map[string]interface{}{
|
||||
"id_card": idCard.String(),
|
||||
"name": name.String(),
|
||||
})
|
||||
@@ -738,14 +812,14 @@ func (a *ApiRequestService) ProcessIVYZ5733Request(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessIVYZ9A2BRequest 学历查询
|
||||
func (a *ApiRequestService) ProcessIVYZ9A2BRequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessIVYZ9A2BRequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
name := gjson.GetBytes(params, "name")
|
||||
if !idCard.Exists() || !name.Exists() {
|
||||
return nil, errors.New("api请求, IVYZ9A2B, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("IVYZ9A2B", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "IVYZ9A2B", map[string]interface{}{
|
||||
"id_card": idCard.String(),
|
||||
"name": name.String(),
|
||||
})
|
||||
@@ -809,14 +883,14 @@ func (a *ApiRequestService) ProcessIVYZ9A2BRequest(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessYYSYBE08Request 二要素
|
||||
func (a *ApiRequestService) ProcessYYSYBE08Request(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessYYSYBE08Request(ctx context.Context, params []byte) ([]byte, error) {
|
||||
name := gjson.GetBytes(params, "name")
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
if !name.Exists() || !idCard.Exists() {
|
||||
return nil, errors.New("api请求, YYSYBE08, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("YYSYBE08", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "YYSYBE08", map[string]interface{}{
|
||||
"name": name.String(),
|
||||
"id_card": idCard.String(),
|
||||
})
|
||||
@@ -850,7 +924,7 @@ func (a *ApiRequestService) ProcessYYSYBE08Request(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessJRZQ0A03Request 借贷申请
|
||||
func (a *ApiRequestService) ProcessJRZQ0A03Request(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessJRZQ0A03Request(ctx context.Context, params []byte) ([]byte, error) {
|
||||
name := gjson.GetBytes(params, "name")
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
mobile := gjson.GetBytes(params, "mobile")
|
||||
@@ -858,7 +932,7 @@ func (a *ApiRequestService) ProcessJRZQ0A03Request(params []byte) ([]byte, error
|
||||
return nil, errors.New("api请求, JRZQ0A03, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("JRZQ0A03", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "JRZQ0A03", map[string]interface{}{
|
||||
"name": name.String(),
|
||||
"id_card": idCard.String(),
|
||||
"mobile_no": mobile.String(),
|
||||
@@ -907,7 +981,7 @@ func (a *ApiRequestService) ProcessJRZQ0A03Request(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessJRZQ8203Request 借贷行为
|
||||
func (a *ApiRequestService) ProcessJRZQ8203Request(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessJRZQ8203Request(ctx context.Context, params []byte) ([]byte, error) {
|
||||
name := gjson.GetBytes(params, "name")
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
mobile := gjson.GetBytes(params, "mobile")
|
||||
@@ -915,7 +989,7 @@ func (a *ApiRequestService) ProcessJRZQ8203Request(params []byte) ([]byte, error
|
||||
return nil, errors.New("api请求, JRZQ8203, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("JRZQ8203", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "JRZQ8203", map[string]interface{}{
|
||||
"name": name.String(),
|
||||
"id_card": idCard.String(),
|
||||
"mobile_no": mobile.String(),
|
||||
@@ -964,7 +1038,7 @@ func (a *ApiRequestService) ProcessJRZQ8203Request(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessJRZQ4AA8Request 还款压力
|
||||
func (a *ApiRequestService) ProcessJRZQ4AA8Request(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessJRZQ4AA8Request(ctx context.Context, params []byte) ([]byte, error) {
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
name := gjson.GetBytes(params, "name")
|
||||
mobile := gjson.GetBytes(params, "mobile")
|
||||
@@ -972,7 +1046,7 @@ func (a *ApiRequestService) ProcessJRZQ4AA8Request(params []byte) ([]byte, error
|
||||
return nil, errors.New("api请求, JRZQ4AA8, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("JRZQ4AA8", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "JRZQ4AA8", map[string]interface{}{
|
||||
"id_card": idCard.String(),
|
||||
"name": name.String(),
|
||||
"mobile_no": mobile.String(),
|
||||
@@ -1013,7 +1087,7 @@ func (a *ApiRequestService) ProcessJRZQ4AA8Request(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessQYGL8271Request 企业涉诉
|
||||
func (a *ApiRequestService) ProcessQYGL8271Request(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessQYGL8271Request(ctx context.Context, params []byte) ([]byte, error) {
|
||||
entName := gjson.GetBytes(params, "ent_name")
|
||||
entCode := gjson.GetBytes(params, "ent_code")
|
||||
|
||||
@@ -1021,7 +1095,7 @@ func (a *ApiRequestService) ProcessQYGL8271Request(params []byte) ([]byte, error
|
||||
return nil, errors.New("api请求, QYGL8271, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("QYGL8271", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "QYGL8271", map[string]interface{}{
|
||||
"ent_name": entName.String(),
|
||||
"ent_code": entCode.String(),
|
||||
})
|
||||
@@ -1073,13 +1147,13 @@ func (a *ApiRequestService) ProcessQYGL8271Request(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessQYGL6F2DRequest 人企关联
|
||||
func (a *ApiRequestService) ProcessQYGL6F2DRequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessQYGL6F2DRequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
if !idCard.Exists() {
|
||||
return nil, errors.New("api请求, QYGL6F2D, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("QYGL6F2D", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "QYGL6F2D", map[string]interface{}{
|
||||
"id_card": idCard.String(),
|
||||
})
|
||||
|
||||
@@ -1114,13 +1188,13 @@ func (a *ApiRequestService) ProcessQYGL6F2DRequest(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessQCXG7A2BRequest 名下车辆
|
||||
func (a *ApiRequestService) ProcessQCXG7A2BRequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessQCXG7A2BRequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
if !idCard.Exists() {
|
||||
return nil, errors.New("api请求, QCXG7A2B, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("QCXG7A2B", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "QCXG7A2B", map[string]interface{}{
|
||||
"id_card": idCard.String(),
|
||||
})
|
||||
|
||||
@@ -1132,7 +1206,7 @@ func (a *ApiRequestService) ProcessQCXG7A2BRequest(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessYYSY09CDRequest 三要素
|
||||
func (a *ApiRequestService) ProcessYYSY09CDRequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessYYSY09CDRequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
name := gjson.GetBytes(params, "name")
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
mobile := gjson.GetBytes(params, "mobile")
|
||||
@@ -1140,7 +1214,7 @@ func (a *ApiRequestService) ProcessYYSY09CDRequest(params []byte) ([]byte, error
|
||||
return nil, errors.New("api请求, YYSY09CD, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("YYSY09CD", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "YYSY09CD", map[string]interface{}{
|
||||
"name": name.String(),
|
||||
"id_card": idCard.String(),
|
||||
"mobile_no": mobile.String(),
|
||||
@@ -1175,7 +1249,7 @@ func (a *ApiRequestService) ProcessYYSY09CDRequest(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessBehaviorRiskScanRequest 行为风险扫描
|
||||
func (a *ApiRequestService) ProcessBehaviorRiskScanRequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessBehaviorRiskScanRequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
name := gjson.GetBytes(params, "name")
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
|
||||
@@ -1197,7 +1271,7 @@ func (a *ApiRequestService) ProcessBehaviorRiskScanRequest(params []byte) ([]byt
|
||||
// 反赌反诈
|
||||
go func() {
|
||||
defer wg.Done()
|
||||
respBytes, err := a.ProcessFLXG0687Request(params)
|
||||
respBytes, err := a.ProcessFLXG0687Request(ctx, params)
|
||||
results <- apiResult{name: "anti_fraud_gaming", data: respBytes, err: err}
|
||||
}()
|
||||
|
||||
@@ -1242,7 +1316,7 @@ func (a *ApiRequestService) ProcessBehaviorRiskScanRequest(params []byte) ([]byt
|
||||
}
|
||||
|
||||
// ProcessDWBG8B4DRequest 谛听多维报告
|
||||
func (a *ApiRequestService) ProcessDWBG8B4DRequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessDWBG8B4DRequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
name := gjson.GetBytes(params, "name")
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
mobile := gjson.GetBytes(params, "mobile")
|
||||
@@ -1251,7 +1325,7 @@ func (a *ApiRequestService) ProcessDWBG8B4DRequest(params []byte) ([]byte, error
|
||||
return nil, errors.New("api请求, DWBG8B4D, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("DWBG8B4D", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "DWBG8B4D", map[string]interface{}{
|
||||
"name": name.String(),
|
||||
"id_card": idCard.String(),
|
||||
"mobile_no": mobile.String(),
|
||||
@@ -1267,7 +1341,7 @@ func (a *ApiRequestService) ProcessDWBG8B4DRequest(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessDWBG6A2CRequest 司南报告服务
|
||||
func (a *ApiRequestService) ProcessDWBG6A2CRequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessDWBG6A2CRequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
name := gjson.GetBytes(params, "name")
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
mobile := gjson.GetBytes(params, "mobile")
|
||||
@@ -1276,7 +1350,7 @@ func (a *ApiRequestService) ProcessDWBG6A2CRequest(params []byte) ([]byte, error
|
||||
return nil, errors.New("api请求, DWBG6A2C, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("DWBG6A2C", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "DWBG6A2C", map[string]interface{}{
|
||||
"name": name.String(),
|
||||
"id_card": idCard.String(),
|
||||
"mobile_no": mobile.String(),
|
||||
@@ -1292,7 +1366,7 @@ func (a *ApiRequestService) ProcessDWBG6A2CRequest(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessJRZQ4B6CRequest 探针C风险评估
|
||||
func (a *ApiRequestService) ProcessJRZQ4B6CRequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessJRZQ4B6CRequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
name := gjson.GetBytes(params, "name")
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
mobile := gjson.GetBytes(params, "mobile")
|
||||
@@ -1300,7 +1374,7 @@ func (a *ApiRequestService) ProcessJRZQ4B6CRequest(params []byte) ([]byte, error
|
||||
return nil, errors.New("api请求, JRZQ4B6C, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("JRZQ4B6C", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "JRZQ4B6C", map[string]interface{}{
|
||||
"name": name.String(),
|
||||
"id_card": idCard.String(),
|
||||
"mobile_no": mobile.String(),
|
||||
@@ -1316,7 +1390,7 @@ func (a *ApiRequestService) ProcessJRZQ4B6CRequest(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessJRZQ09J8Request 收入评估
|
||||
func (a *ApiRequestService) ProcessJRZQ09J8Request(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessJRZQ09J8Request(ctx context.Context, params []byte) ([]byte, error) {
|
||||
name := gjson.GetBytes(params, "name")
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
mobile := gjson.GetBytes(params, "mobile")
|
||||
@@ -1324,7 +1398,7 @@ func (a *ApiRequestService) ProcessJRZQ09J8Request(params []byte) ([]byte, error
|
||||
return nil, errors.New("api请求, JRZQ09J8, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("JRZQ09J8", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "JRZQ09J8", map[string]interface{}{
|
||||
"name": name.String(),
|
||||
"id_card": idCard.String(),
|
||||
"mobile_no": mobile.String(),
|
||||
@@ -1340,7 +1414,7 @@ func (a *ApiRequestService) ProcessJRZQ09J8Request(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessJRZQ5E9FRequest 借选指数
|
||||
func (a *ApiRequestService) ProcessJRZQ5E9FRequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessJRZQ5E9FRequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
name := gjson.GetBytes(params, "name")
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
mobile := gjson.GetBytes(params, "mobile")
|
||||
@@ -1348,7 +1422,7 @@ func (a *ApiRequestService) ProcessJRZQ5E9FRequest(params []byte) ([]byte, error
|
||||
return nil, errors.New("api请求, JRZQ5E9F, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("JRZQ5E9F", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "JRZQ5E9F", map[string]interface{}{
|
||||
"name": name.String(),
|
||||
"id_card": idCard.String(),
|
||||
"mobile_no": mobile.String(),
|
||||
@@ -1364,13 +1438,13 @@ func (a *ApiRequestService) ProcessJRZQ5E9FRequest(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessQYGL3F8ERequest 人企关系加强版2
|
||||
func (a *ApiRequestService) ProcessQYGL3F8ERequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessQYGL3F8ERequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
if !idCard.Exists() {
|
||||
return nil, errors.New("api请求, QYGL3F8E, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("QYGL3F8E", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "QYGL3F8E", map[string]interface{}{
|
||||
"id_card": idCard.String(),
|
||||
})
|
||||
|
||||
@@ -1383,14 +1457,14 @@ func (a *ApiRequestService) ProcessQYGL3F8ERequest(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessIVYZ81NCRequest 婚姻,登记时间版
|
||||
func (a *ApiRequestService) ProcessIVYZ81NCRequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessIVYZ81NCRequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
name := gjson.GetBytes(params, "name")
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
if !name.Exists() || !idCard.Exists() {
|
||||
return nil, errors.New("api请求, IVYZ81NC, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("IVYZ81NC", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "IVYZ81NC", map[string]interface{}{
|
||||
"name": name.String(),
|
||||
"id_card": idCard.String(),
|
||||
})
|
||||
@@ -1404,14 +1478,14 @@ func (a *ApiRequestService) ProcessIVYZ81NCRequest(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessIVYZ7F3ARequest 学历查询版B
|
||||
func (a *ApiRequestService) ProcessIVYZ7F3ARequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessIVYZ7F3ARequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
name := gjson.GetBytes(params, "name")
|
||||
if !idCard.Exists() || !name.Exists() {
|
||||
return nil, errors.New("api请求, IVYZ7F3A, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("IVYZ7F3A", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "IVYZ7F3A", map[string]interface{}{
|
||||
"id_card": idCard.String(),
|
||||
"name": name.String(),
|
||||
"authorized": "1",
|
||||
@@ -1426,7 +1500,7 @@ func (a *ApiRequestService) ProcessIVYZ7F3ARequest(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessDWBG7F3ARequest 多头借贷行业风险版
|
||||
func (a *ApiRequestService) ProcessDWBG7F3ARequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessDWBG7F3ARequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
name := gjson.GetBytes(params, "name")
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
mobile := gjson.GetBytes(params, "mobile")
|
||||
@@ -1434,7 +1508,7 @@ func (a *ApiRequestService) ProcessDWBG7F3ARequest(params []byte) ([]byte, error
|
||||
return nil, errors.New("api请求, DWBG7F3A, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("DWBG7F3A", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "DWBG7F3A", map[string]interface{}{
|
||||
"name": name.String(),
|
||||
"id_card": idCard.String(),
|
||||
"mobile_no": mobile.String(),
|
||||
@@ -1449,7 +1523,7 @@ func (a *ApiRequestService) ProcessDWBG7F3ARequest(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessJRZQ8A2DRequest 特殊名单验证B
|
||||
func (a *ApiRequestService) ProcessJRZQ8A2DRequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessJRZQ8A2DRequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
name := gjson.GetBytes(params, "name")
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
mobile := gjson.GetBytes(params, "mobile")
|
||||
@@ -1457,7 +1531,7 @@ func (a *ApiRequestService) ProcessJRZQ8A2DRequest(params []byte) ([]byte, error
|
||||
return nil, errors.New("api请求, JRZQ8A2D, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("JRZQ8A2D", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "JRZQ8A2D", map[string]interface{}{
|
||||
"name": name.String(),
|
||||
"id_card": idCard.String(),
|
||||
"mobile_no": mobile.String(),
|
||||
@@ -1473,13 +1547,13 @@ func (a *ApiRequestService) ProcessJRZQ8A2DRequest(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessYYSY8B1CRequest 手机在网时长B
|
||||
func (a *ApiRequestService) ProcessYYSY8B1CRequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessYYSY8B1CRequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
mobile := gjson.GetBytes(params, "mobile")
|
||||
if !mobile.Exists() {
|
||||
return nil, errors.New("api请求, YYSY8B1C, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("YYSY8B1C", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "YYSY8B1C", map[string]interface{}{
|
||||
"mobile_no": mobile.String(),
|
||||
})
|
||||
|
||||
@@ -1492,13 +1566,13 @@ func (a *ApiRequestService) ProcessYYSY8B1CRequest(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessYYSY7D3ERequest 携号转网查询
|
||||
func (a *ApiRequestService) ProcessYYSY7D3ERequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessYYSY7D3ERequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
mobile := gjson.GetBytes(params, "mobile")
|
||||
if !mobile.Exists() {
|
||||
return nil, errors.New("api请求, YYSY7D3E, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("YYSY7D3E", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "YYSY7D3E", map[string]interface{}{
|
||||
"mobile_no": mobile.String(),
|
||||
})
|
||||
|
||||
@@ -1511,7 +1585,7 @@ func (a *ApiRequestService) ProcessYYSY7D3ERequest(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessFLXG7E8FRequest 个人司法涉诉查询
|
||||
func (a *ApiRequestService) ProcessFLXG7E8FRequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessFLXG7E8FRequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
name := gjson.GetBytes(params, "name")
|
||||
mobile := gjson.GetBytes(params, "mobile")
|
||||
@@ -1519,7 +1593,7 @@ func (a *ApiRequestService) ProcessFLXG7E8FRequest(params []byte) ([]byte, error
|
||||
return nil, errors.New("api请求, FLXG7E8F, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("FLXG7E8F", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "FLXG7E8F", map[string]interface{}{
|
||||
"id_card": idCard.String(),
|
||||
"name": name.String(),
|
||||
"mobile_no": mobile.String(),
|
||||
@@ -1534,7 +1608,7 @@ func (a *ApiRequestService) ProcessFLXG7E8FRequest(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessIVYZ8I9JRequest 互联网行为推测
|
||||
func (a *ApiRequestService) ProcessIVYZ8I9JRequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessIVYZ8I9JRequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
name := gjson.GetBytes(params, "name")
|
||||
mobile := gjson.GetBytes(params, "mobile")
|
||||
@@ -1542,7 +1616,7 @@ func (a *ApiRequestService) ProcessIVYZ8I9JRequest(params []byte) ([]byte, error
|
||||
return nil, errors.New("api请求, IVYZ8I9J, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("IVYZ8I9J", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "IVYZ8I9J", map[string]interface{}{
|
||||
"id_card": idCard.String(),
|
||||
"name": name.String(),
|
||||
"mobile_no": mobile.String(),
|
||||
@@ -1557,7 +1631,7 @@ func (a *ApiRequestService) ProcessIVYZ8I9JRequest(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessJRZQ7F1ARequest 全景雷达
|
||||
func (a *ApiRequestService) ProcessJRZQ7F1ARequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessJRZQ7F1ARequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
name := gjson.GetBytes(params, "name")
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
mobile := gjson.GetBytes(params, "mobile")
|
||||
@@ -1565,7 +1639,7 @@ func (a *ApiRequestService) ProcessJRZQ7F1ARequest(params []byte) ([]byte, error
|
||||
return nil, errors.New("api请求, JRZQ7F1A, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("JRZQ7F1A", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "JRZQ7F1A", map[string]interface{}{
|
||||
"name": name.String(),
|
||||
"id_card": idCard.String(),
|
||||
"mobile_no": mobile.String(),
|
||||
@@ -1581,14 +1655,14 @@ func (a *ApiRequestService) ProcessJRZQ7F1ARequest(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessIVYZ3P9MRequest 学历实时查询
|
||||
func (a *ApiRequestService) ProcessIVYZ3P9MRequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessIVYZ3P9MRequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
name := gjson.GetBytes(params, "name")
|
||||
if !idCard.Exists() || !name.Exists() {
|
||||
return nil, errors.New("api请求, IVYZ3P9M, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("IVYZ3P9M", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "IVYZ3P9M", map[string]interface{}{
|
||||
"id_card": idCard.String(),
|
||||
"name": name.String(),
|
||||
})
|
||||
@@ -1601,7 +1675,7 @@ func (a *ApiRequestService) ProcessIVYZ3P9MRequest(params []byte) ([]byte, error
|
||||
}
|
||||
|
||||
// ProcessJRZQ6F2ARequest 借贷申请
|
||||
func (a *ApiRequestService) ProcessJRZQ6F2ARequest(params []byte) ([]byte, error) {
|
||||
func (a *ApiRequestService) ProcessJRZQ6F2ARequest(ctx context.Context, params []byte) ([]byte, error) {
|
||||
name := gjson.GetBytes(params, "name")
|
||||
idCard := gjson.GetBytes(params, "id_card")
|
||||
mobile := gjson.GetBytes(params, "mobile")
|
||||
@@ -1609,7 +1683,7 @@ func (a *ApiRequestService) ProcessJRZQ6F2ARequest(params []byte) ([]byte, error
|
||||
return nil, errors.New("api请求, JRZQ6F2A, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("JRZQ6F2A", map[string]interface{}{
|
||||
resp, err := a.callTianyuanApiWithLog(ctx, "", "JRZQ6F2A", map[string]interface{}{
|
||||
"name": name.String(),
|
||||
"id_card": idCard.String(),
|
||||
"mobile_no": mobile.String(),
|
||||
|
||||
Reference in New Issue
Block a user