2026-01-22 16:04:12 +08:00
|
|
|
|
package service
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
|
"context"
|
2026-02-06 13:34:49 +08:00
|
|
|
|
"encoding/hex"
|
2026-01-22 16:04:12 +08:00
|
|
|
|
"encoding/json"
|
|
|
|
|
|
"errors"
|
|
|
|
|
|
"fmt"
|
|
|
|
|
|
"sort"
|
|
|
|
|
|
"strings"
|
|
|
|
|
|
"sync"
|
|
|
|
|
|
"sync/atomic"
|
|
|
|
|
|
"time"
|
|
|
|
|
|
"tyc-server/app/main/api/internal/config"
|
|
|
|
|
|
tianyuanapi "tyc-server/app/main/api/internal/service/tianyuanapi_sdk"
|
|
|
|
|
|
"tyc-server/app/main/model"
|
2026-02-06 13:34:49 +08:00
|
|
|
|
"tyc-server/pkg/lzkit/crypto"
|
2026-01-22 16:04:12 +08:00
|
|
|
|
|
|
|
|
|
|
"github.com/Masterminds/squirrel"
|
|
|
|
|
|
"github.com/tidwall/gjson"
|
|
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
// 辅助函数:将天远API响应转换为JSON字节数组
|
|
|
|
|
|
func convertTianyuanResponse(resp *tianyuanapi.Response) ([]byte, error) {
|
|
|
|
|
|
return json.Marshal(resp.Data)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 生成认证时间范围:当前时间前后两天的YYYYMMDD-YYMMDD格式
|
|
|
|
|
|
func generateAuthDateRange() string {
|
|
|
|
|
|
now := time.Now()
|
|
|
|
|
|
start := now.AddDate(0, 0, -2).Format("20060102")
|
|
|
|
|
|
end := now.AddDate(0, 0, 2).Format("20060102")
|
|
|
|
|
|
return fmt.Sprintf("%s-%s", start, end)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
type ApiRequestService struct {
|
|
|
|
|
|
config config.Config
|
|
|
|
|
|
featureModel model.FeatureModel
|
|
|
|
|
|
productFeatureModel model.ProductFeatureModel
|
|
|
|
|
|
tianyuanapi *tianyuanapi.Client
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// NewApiRequestService 是一个构造函数,用于初始化 ApiRequestService
|
|
|
|
|
|
func NewApiRequestService(c config.Config, featureModel model.FeatureModel, productFeatureModel model.ProductFeatureModel, tianyuanapi *tianyuanapi.Client) *ApiRequestService {
|
|
|
|
|
|
return &ApiRequestService{
|
|
|
|
|
|
config: c,
|
|
|
|
|
|
featureModel: featureModel,
|
|
|
|
|
|
productFeatureModel: productFeatureModel,
|
|
|
|
|
|
tianyuanapi: tianyuanapi,
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-12 15:42:09 +08:00
|
|
|
|
// keysOfMap 返回 map 的 key 列表,便于 debug 日志展示参数结构而不是完整明文
|
|
|
|
|
|
func keysOfMap(m map[string]interface{}) []string {
|
|
|
|
|
|
keys := make([]string, 0, len(m))
|
|
|
|
|
|
for k := range m {
|
|
|
|
|
|
keys = append(keys, k)
|
|
|
|
|
|
}
|
|
|
|
|
|
sort.Strings(keys)
|
|
|
|
|
|
return keys
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-22 16:04:12 +08:00
|
|
|
|
type APIResponseData struct {
|
|
|
|
|
|
ApiID string `json:"apiID"`
|
|
|
|
|
|
Data json.RawMessage `json:"data"` // 这里用 RawMessage 来存储原始的 data
|
|
|
|
|
|
Success bool `json:"success"`
|
|
|
|
|
|
Timestamp string `json:"timestamp"`
|
|
|
|
|
|
Error string `json:"error,omitempty"`
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessRequests 处理请求
|
2026-02-12 15:16:54 +08:00
|
|
|
|
// orderNo: 当前查询对应的订单号,用于为异步车辆类接口生成回调地址(return_url)
|
|
|
|
|
|
func (a *ApiRequestService) ProcessRequests(params []byte, productID int64, orderNo string) ([]APIResponseData, error) {
|
2026-01-22 16:04:12 +08:00
|
|
|
|
var ctx, cancel = context.WithCancel(context.Background())
|
|
|
|
|
|
defer cancel()
|
|
|
|
|
|
build := a.productFeatureModel.SelectBuilder().Where(squirrel.Eq{
|
|
|
|
|
|
"product_id": productID,
|
|
|
|
|
|
})
|
|
|
|
|
|
productFeatureList, findProductFeatureErr := a.productFeatureModel.FindAll(ctx, build, "")
|
|
|
|
|
|
if findProductFeatureErr != nil {
|
|
|
|
|
|
return nil, findProductFeatureErr
|
|
|
|
|
|
}
|
|
|
|
|
|
var featureIDs []int64
|
|
|
|
|
|
isImportantMap := make(map[int64]int64, len(productFeatureList))
|
|
|
|
|
|
for _, pf := range productFeatureList {
|
|
|
|
|
|
featureIDs = append(featureIDs, pf.FeatureId)
|
|
|
|
|
|
isImportantMap[pf.FeatureId] = pf.IsImportant
|
|
|
|
|
|
}
|
|
|
|
|
|
if len(featureIDs) == 0 {
|
|
|
|
|
|
return nil, errors.New("featureIDs 是空的")
|
|
|
|
|
|
}
|
|
|
|
|
|
builder := a.featureModel.SelectBuilder().Where(squirrel.Eq{"id": featureIDs})
|
|
|
|
|
|
featureList, findFeatureErr := a.featureModel.FindAll(ctx, builder, "")
|
|
|
|
|
|
if findFeatureErr != nil {
|
|
|
|
|
|
return nil, findFeatureErr
|
|
|
|
|
|
}
|
|
|
|
|
|
if len(featureList) == 0 {
|
|
|
|
|
|
return nil, errors.New("处理请求错误,产品无对应接口功能")
|
|
|
|
|
|
}
|
2026-02-12 15:16:54 +08:00
|
|
|
|
|
|
|
|
|
|
// 在原始 params 上附加 order_no,供异步车辆类接口自动生成回调地址使用
|
|
|
|
|
|
var baseParams map[string]interface{}
|
|
|
|
|
|
if err := json.Unmarshal(params, &baseParams); err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("解析查询参数失败: %w", err)
|
|
|
|
|
|
}
|
|
|
|
|
|
if orderNo != "" {
|
|
|
|
|
|
baseParams["order_no"] = orderNo
|
|
|
|
|
|
}
|
|
|
|
|
|
paramsWithOrder, err := json.Marshal(baseParams)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("序列化查询参数失败: %w", err)
|
|
|
|
|
|
}
|
2026-01-22 16:04:12 +08:00
|
|
|
|
var (
|
|
|
|
|
|
wg sync.WaitGroup
|
|
|
|
|
|
resultsCh = make(chan APIResponseData, len(featureList))
|
|
|
|
|
|
errorsCh = make(chan error, len(featureList))
|
|
|
|
|
|
errorCount int32
|
|
|
|
|
|
errorLimit = len(featureList)
|
|
|
|
|
|
retryNum = 5
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
for i, feature := range featureList {
|
|
|
|
|
|
wg.Add(1)
|
|
|
|
|
|
go func(i int, feature *model.Feature) {
|
|
|
|
|
|
defer wg.Done()
|
|
|
|
|
|
|
|
|
|
|
|
select {
|
|
|
|
|
|
case <-ctx.Done():
|
|
|
|
|
|
return
|
|
|
|
|
|
default:
|
|
|
|
|
|
}
|
|
|
|
|
|
result := APIResponseData{
|
|
|
|
|
|
ApiID: feature.ApiId,
|
|
|
|
|
|
Success: false,
|
|
|
|
|
|
}
|
|
|
|
|
|
timestamp := time.Now().Format("2006-01-02 15:04:05")
|
|
|
|
|
|
var (
|
|
|
|
|
|
resp json.RawMessage
|
|
|
|
|
|
preprocessErr error
|
|
|
|
|
|
)
|
|
|
|
|
|
// 若 isImportantMap[feature.ID] == 1,则表示需要在出错时重试
|
|
|
|
|
|
isImportant := isImportantMap[feature.Id] == 1
|
|
|
|
|
|
tryCount := 0
|
|
|
|
|
|
for {
|
|
|
|
|
|
tryCount++
|
2026-02-12 15:16:54 +08:00
|
|
|
|
resp, preprocessErr = a.PreprocessRequestApi(paramsWithOrder, feature.ApiId)
|
2026-01-22 16:04:12 +08:00
|
|
|
|
if preprocessErr == nil {
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
if isImportant && tryCount < retryNum {
|
|
|
|
|
|
continue
|
|
|
|
|
|
} else {
|
|
|
|
|
|
break
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if preprocessErr != nil {
|
|
|
|
|
|
result.Timestamp = timestamp
|
|
|
|
|
|
result.Error = preprocessErr.Error()
|
|
|
|
|
|
result.Data = resp
|
|
|
|
|
|
resultsCh <- result
|
|
|
|
|
|
errorsCh <- fmt.Errorf("请求失败: %v", preprocessErr)
|
|
|
|
|
|
atomic.AddInt32(&errorCount, 1)
|
|
|
|
|
|
if atomic.LoadInt32(&errorCount) >= int32(errorLimit) {
|
|
|
|
|
|
cancel()
|
|
|
|
|
|
}
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
result.Data = resp
|
|
|
|
|
|
result.Success = true
|
|
|
|
|
|
result.Timestamp = timestamp
|
|
|
|
|
|
resultsCh <- result
|
|
|
|
|
|
}(i, feature)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
go func() {
|
|
|
|
|
|
wg.Wait()
|
|
|
|
|
|
close(resultsCh)
|
|
|
|
|
|
close(errorsCh)
|
|
|
|
|
|
}()
|
|
|
|
|
|
// 收集所有结果并合并z
|
|
|
|
|
|
var responseData []APIResponseData
|
|
|
|
|
|
for result := range resultsCh {
|
|
|
|
|
|
responseData = append(responseData, result)
|
|
|
|
|
|
}
|
|
|
|
|
|
if atomic.LoadInt32(&errorCount) >= int32(errorLimit) {
|
|
|
|
|
|
var allErrors []error
|
|
|
|
|
|
for err := range errorsCh {
|
|
|
|
|
|
allErrors = append(allErrors, err)
|
|
|
|
|
|
}
|
|
|
|
|
|
return nil, fmt.Errorf("请求失败次数超过 %d 次: %v", errorLimit, allErrors)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return responseData, nil
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------请求处理器--------------------------
|
|
|
|
|
|
var requestProcessors = map[string]func(*ApiRequestService, []byte) ([]byte, error){
|
|
|
|
|
|
"PersonEnterprisePro": (*ApiRequestService).ProcessPersonEnterpriseProRequest,
|
|
|
|
|
|
"BehaviorRiskScan": (*ApiRequestService).ProcessBehaviorRiskScanRequest,
|
|
|
|
|
|
"YYSYBE08": (*ApiRequestService).ProcessYYSYBE08Request,
|
|
|
|
|
|
"YYSY09CD": (*ApiRequestService).ProcessYYSY09CDRequest,
|
2026-02-06 13:34:49 +08:00
|
|
|
|
"QCXGGB2Q": (*ApiRequestService).ProcessQCXGGB2QRequest,
|
|
|
|
|
|
"QCXGYTS2": (*ApiRequestService).ProcessQCXGYTS2Request,
|
|
|
|
|
|
"QCXG5F3A": (*ApiRequestService).ProcessQCXG5F3ARequest,
|
2026-01-22 16:04:12 +08:00
|
|
|
|
"FLXG0687": (*ApiRequestService).ProcessFLXG0687Request,
|
|
|
|
|
|
"FLXG3D56": (*ApiRequestService).ProcessFLXG3D56Request,
|
|
|
|
|
|
"FLXG0V4B": (*ApiRequestService).ProcesFLXG0V4BRequest,
|
|
|
|
|
|
"QYGL8271": (*ApiRequestService).ProcessQYGL8271Request,
|
|
|
|
|
|
"IVYZ5733": (*ApiRequestService).ProcessIVYZ5733Request,
|
|
|
|
|
|
"IVYZ9A2B": (*ApiRequestService).ProcessIVYZ9A2BRequest,
|
|
|
|
|
|
"JRZQ0A03": (*ApiRequestService).ProcessJRZQ0A03Request,
|
|
|
|
|
|
"QYGL6F2D": (*ApiRequestService).ProcessQYGL6F2DRequest,
|
|
|
|
|
|
"JRZQ8203": (*ApiRequestService).ProcessJRZQ8203Request,
|
|
|
|
|
|
"JRZQ4AA8": (*ApiRequestService).ProcessJRZQ4AA8Request,
|
|
|
|
|
|
"QCXG7A2B": (*ApiRequestService).ProcessQCXG7A2BRequest,
|
|
|
|
|
|
"DWBG8B4D": (*ApiRequestService).ProcessDWBG8B4DRequest,
|
|
|
|
|
|
"DWBG6A2C": (*ApiRequestService).ProcessDWBG6A2CRequest,
|
|
|
|
|
|
"JRZQ4B6C": (*ApiRequestService).ProcessJRZQ4B6CRequest,
|
|
|
|
|
|
"JRZQ09J8": (*ApiRequestService).ProcessJRZQ09J8Request,
|
|
|
|
|
|
"JRZQ5E9F": (*ApiRequestService).ProcessJRZQ5E9FRequest,
|
|
|
|
|
|
"QYGL3F8E": (*ApiRequestService).ProcessQYGL3F8ERequest,
|
|
|
|
|
|
"IVYZ81NC": (*ApiRequestService).ProcessIVYZ81NCRequest,
|
|
|
|
|
|
"IVYZ7F3A": (*ApiRequestService).ProcessIVYZ7F3ARequest,
|
|
|
|
|
|
"IVYZ3P9M": (*ApiRequestService).ProcessIVYZ3P9MRequest,
|
|
|
|
|
|
"FLXG7E8F": (*ApiRequestService).ProcessFLXG7E8FRequest,
|
2026-01-22 16:33:21 +08:00
|
|
|
|
"QCXG9P1C": (*ApiRequestService).ProcessQCXG9P1CFRequest,
|
2026-02-06 13:34:49 +08:00
|
|
|
|
// 车辆类接口(传参后续配置,先透传缓存 params)
|
|
|
|
|
|
"QCXG4D2E": (*ApiRequestService).ProcessQCXG4D2ERequest,
|
|
|
|
|
|
"QCXG5U0Z": (*ApiRequestService).ProcessQCXG5U0ZRequest,
|
|
|
|
|
|
"QCXG1U4U": (*ApiRequestService).ProcessQCXG1U4URequest,
|
|
|
|
|
|
"QCXGY7F2": (*ApiRequestService).ProcessQCXGY7F2Request,
|
|
|
|
|
|
"QCXG1H7Y": (*ApiRequestService).ProcessQCXG1H7YRequest,
|
|
|
|
|
|
"QCXG4I1Z": (*ApiRequestService).ProcessQCXG4I1ZRequest,
|
|
|
|
|
|
"QCXG3Y6B": (*ApiRequestService).ProcessQCXG3Y6BRequest,
|
|
|
|
|
|
"QCXG3Z3L": (*ApiRequestService).ProcessQCXG3Z3LRequest,
|
|
|
|
|
|
"QCXGP00W": (*ApiRequestService).ProcessQCXGP00WRequest,
|
|
|
|
|
|
"QCXG6B4E": (*ApiRequestService).ProcessQCXG6B4ERequest,
|
2026-02-12 15:16:54 +08:00
|
|
|
|
// 核验工具(verify feature.md)
|
|
|
|
|
|
"IVYZ9K7F": (*ApiRequestService).ProcessIVYZ9K7FRequest,
|
|
|
|
|
|
"IVYZA1B3": (*ApiRequestService).ProcessIVYZA1B3Request,
|
|
|
|
|
|
"IVYZ6M8P": (*ApiRequestService).ProcessIVYZ6M8PRequest,
|
|
|
|
|
|
"JRZQ8B3C": (*ApiRequestService).ProcessJRZQ8B3CRequest,
|
|
|
|
|
|
"YYSY3M8S": (*ApiRequestService).ProcessYYSY3M8SRequest,
|
|
|
|
|
|
"YYSYK9R4": (*ApiRequestService).ProcessYYSYK9R4Request,
|
|
|
|
|
|
"YYSYF2T7": (*ApiRequestService).ProcessYYSYF2T7Request,
|
|
|
|
|
|
"YYSYK8R3": (*ApiRequestService).ProcessYYSYK8R3Request,
|
|
|
|
|
|
"YYSYS9W1": (*ApiRequestService).ProcessYYSYS9W1Request,
|
|
|
|
|
|
"YYSYE7V5": (*ApiRequestService).ProcessYYSYE7V5Request,
|
|
|
|
|
|
"YYSYP0T4": (*ApiRequestService).ProcessYYSYP0T4Request,
|
|
|
|
|
|
"YYSY6F2B": (*ApiRequestService).ProcessYYSY6F2BRequest,
|
|
|
|
|
|
"YYSY9E4A": (*ApiRequestService).ProcessYYSY9E4ARequest,
|
|
|
|
|
|
"QYGL5F6A": (*ApiRequestService).ProcessQYGL5F6ARequest,
|
|
|
|
|
|
"JRZQACAB": (*ApiRequestService).ProcessJRZQACABRequest,
|
|
|
|
|
|
"JRZQ0B6Y": (*ApiRequestService).ProcessJRZQ0B6YRequest,
|
2026-02-12 18:57:13 +08:00
|
|
|
|
// 新增司法涉诉类接口
|
|
|
|
|
|
"QYGL66SL": (*ApiRequestService).ProcessQYGL66SLRequest,
|
|
|
|
|
|
"FLXG3A9B": (*ApiRequestService).ProcessFLXG3A9BRequest,
|
|
|
|
|
|
"QYGL2S0W": (*ApiRequestService).ProcessQYGL2S0WRequest,
|
2026-01-22 16:04:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// PreprocessRequestApi 调用指定的请求处理函数
|
|
|
|
|
|
func (a *ApiRequestService) PreprocessRequestApi(params []byte, apiID string) ([]byte, error) {
|
|
|
|
|
|
if processor, exists := requestProcessors[apiID]; exists {
|
|
|
|
|
|
return processor(a, params) // 调用 ApiRequestService 方法
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return nil, errors.New("api请求, 未找到相应的处理程序")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// PersonEnterprisePro 人企业关系加强版
|
|
|
|
|
|
func (a *ApiRequestService) ProcessPersonEnterpriseProRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
idCard := gjson.GetBytes(params, "id_card")
|
|
|
|
|
|
// 设置最大调用次数上限
|
|
|
|
|
|
maxApiCalls := 20 // 允许最多查询20个企业
|
|
|
|
|
|
|
|
|
|
|
|
if !idCard.Exists() {
|
|
|
|
|
|
return nil, errors.New("api请求, PersonEnterprisePro, 获取相关参数失败")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("QYGLB4C0", map[string]interface{}{
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
})
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
respBytes, err := convertTianyuanResponse(resp)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 处理股东人企关系的响应数据
|
|
|
|
|
|
code := gjson.GetBytes(respBytes, "code")
|
|
|
|
|
|
if !code.Exists() {
|
|
|
|
|
|
return nil, fmt.Errorf("响应中缺少 code 字段")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 判断 code 是否等于 "0000"
|
|
|
|
|
|
if code.String() == "0000" {
|
|
|
|
|
|
// 获取 data 字段的值
|
|
|
|
|
|
data := gjson.GetBytes(respBytes, "data")
|
|
|
|
|
|
if !data.Exists() {
|
|
|
|
|
|
return nil, fmt.Errorf("响应中缺少 data 字段")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 使用gjson获取企业列表
|
|
|
|
|
|
datalistResult := gjson.Get(data.Raw, "datalist")
|
|
|
|
|
|
if !datalistResult.Exists() {
|
|
|
|
|
|
return nil, fmt.Errorf("datalist字段不存在")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取所有企业并进行排序
|
|
|
|
|
|
companies := datalistResult.Array()
|
|
|
|
|
|
|
|
|
|
|
|
// 创建企业对象切片,用于排序
|
|
|
|
|
|
type CompanyWithPriority struct {
|
|
|
|
|
|
Index int
|
|
|
|
|
|
Data gjson.Result
|
|
|
|
|
|
RelationshipVal int // 关系权重值
|
|
|
|
|
|
RelationCount int // 关系数量
|
|
|
|
|
|
AdminPenalty int // 行政处罚数量
|
|
|
|
|
|
Executed int // 被执行人数量
|
|
|
|
|
|
Dishonest int // 失信被执行人数量
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
companiesWithPriority := make([]CompanyWithPriority, 0, len(companies))
|
|
|
|
|
|
|
|
|
|
|
|
// 遍历企业,计算优先级
|
|
|
|
|
|
for i, companyJson := range companies {
|
|
|
|
|
|
// 统计行政处罚、被执行人、失信被执行人
|
|
|
|
|
|
adminPenalty := 0
|
|
|
|
|
|
executed := 0
|
|
|
|
|
|
dishonest := 0
|
|
|
|
|
|
|
|
|
|
|
|
// 检查行政处罚字段是否存在并获取数组长度
|
|
|
|
|
|
adminPenaltyResult := companyJson.Get("adminPenalty")
|
|
|
|
|
|
if adminPenaltyResult.Exists() && adminPenaltyResult.IsArray() {
|
|
|
|
|
|
adminPenalty = len(adminPenaltyResult.Array())
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 检查被执行人字段是否存在并获取数组长度
|
|
|
|
|
|
executedPersonResult := companyJson.Get("executedPerson")
|
|
|
|
|
|
if executedPersonResult.Exists() && executedPersonResult.IsArray() {
|
|
|
|
|
|
executed = len(executedPersonResult.Array())
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 检查失信被执行人字段是否存在并获取数组长度
|
|
|
|
|
|
dishonestExecutedPersonResult := companyJson.Get("dishonestExecutedPerson")
|
|
|
|
|
|
if dishonestExecutedPersonResult.Exists() && dishonestExecutedPersonResult.IsArray() {
|
|
|
|
|
|
dishonest = len(dishonestExecutedPersonResult.Array())
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 计算relationship权重
|
|
|
|
|
|
relationshipVal := 0
|
|
|
|
|
|
relationCount := 0
|
|
|
|
|
|
|
|
|
|
|
|
// 获取relationship数组
|
|
|
|
|
|
relationshipResult := companyJson.Get("relationship")
|
|
|
|
|
|
if relationshipResult.Exists() && relationshipResult.IsArray() {
|
|
|
|
|
|
relationships := relationshipResult.Array()
|
|
|
|
|
|
// 统计各类关系的数量和权重
|
|
|
|
|
|
for _, rel := range relationships {
|
|
|
|
|
|
relationCount++
|
|
|
|
|
|
relStr := rel.String()
|
|
|
|
|
|
|
|
|
|
|
|
// 根据关系类型设置权重,权重顺序:
|
|
|
|
|
|
// 股东(6) > 历史股东(5) > 法人(4) > 历史法人(3) > 高管(2) > 历史高管(1)
|
|
|
|
|
|
switch relStr {
|
|
|
|
|
|
case "sh": // 股东
|
|
|
|
|
|
if relationshipVal < 6 {
|
|
|
|
|
|
relationshipVal = 6
|
|
|
|
|
|
}
|
|
|
|
|
|
case "his_sh": // 历史股东
|
|
|
|
|
|
if relationshipVal < 5 {
|
|
|
|
|
|
relationshipVal = 5
|
|
|
|
|
|
}
|
|
|
|
|
|
case "lp": // 法人
|
|
|
|
|
|
if relationshipVal < 4 {
|
|
|
|
|
|
relationshipVal = 4
|
|
|
|
|
|
}
|
|
|
|
|
|
case "his_lp": // 历史法人
|
|
|
|
|
|
if relationshipVal < 3 {
|
|
|
|
|
|
relationshipVal = 3
|
|
|
|
|
|
}
|
|
|
|
|
|
case "tm": // 高管
|
|
|
|
|
|
if relationshipVal < 2 {
|
|
|
|
|
|
relationshipVal = 2
|
|
|
|
|
|
}
|
|
|
|
|
|
case "his_tm": // 历史高管
|
|
|
|
|
|
if relationshipVal < 1 {
|
|
|
|
|
|
relationshipVal = 1
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
companiesWithPriority = append(companiesWithPriority, CompanyWithPriority{
|
|
|
|
|
|
Index: i,
|
|
|
|
|
|
Data: companyJson,
|
|
|
|
|
|
RelationshipVal: relationshipVal,
|
|
|
|
|
|
RelationCount: relationCount,
|
|
|
|
|
|
AdminPenalty: adminPenalty,
|
|
|
|
|
|
Executed: executed,
|
|
|
|
|
|
Dishonest: dishonest,
|
|
|
|
|
|
})
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 按优先级排序
|
|
|
|
|
|
sort.Slice(companiesWithPriority, func(i, j int) bool {
|
|
|
|
|
|
// 首先根据是否有失信被执行人排序
|
|
|
|
|
|
if companiesWithPriority[i].Dishonest != companiesWithPriority[j].Dishonest {
|
|
|
|
|
|
return companiesWithPriority[i].Dishonest > companiesWithPriority[j].Dishonest
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 然后根据是否有被执行人排序
|
|
|
|
|
|
if companiesWithPriority[i].Executed != companiesWithPriority[j].Executed {
|
|
|
|
|
|
return companiesWithPriority[i].Executed > companiesWithPriority[j].Executed
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 然后根据是否有行政处罚排序
|
|
|
|
|
|
if companiesWithPriority[i].AdminPenalty != companiesWithPriority[j].AdminPenalty {
|
|
|
|
|
|
return companiesWithPriority[i].AdminPenalty > companiesWithPriority[j].AdminPenalty
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 然后按relationship类型排序
|
|
|
|
|
|
if companiesWithPriority[i].RelationshipVal != companiesWithPriority[j].RelationshipVal {
|
|
|
|
|
|
return companiesWithPriority[i].RelationshipVal > companiesWithPriority[j].RelationshipVal
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 最后按relationship数量排序
|
|
|
|
|
|
return companiesWithPriority[i].RelationCount > companiesWithPriority[j].RelationCount
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
// 限制处理的企业数量
|
|
|
|
|
|
processCount := len(companiesWithPriority)
|
|
|
|
|
|
if processCount > maxApiCalls {
|
|
|
|
|
|
processCount = maxApiCalls
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 只处理前N个优先级高的企业
|
|
|
|
|
|
prioritizedCompanies := companiesWithPriority[:processCount]
|
|
|
|
|
|
|
|
|
|
|
|
// 使用WaitGroup和chan处理并发
|
|
|
|
|
|
var wg sync.WaitGroup
|
|
|
|
|
|
results := make(chan struct {
|
|
|
|
|
|
index int
|
|
|
|
|
|
data []byte
|
|
|
|
|
|
err error
|
|
|
|
|
|
}, processCount)
|
|
|
|
|
|
|
|
|
|
|
|
// 对按优先级排序的前N个企业进行涉诉信息查询
|
|
|
|
|
|
for _, company := range prioritizedCompanies {
|
|
|
|
|
|
wg.Add(1)
|
|
|
|
|
|
go func(origIndex int, companyInfo gjson.Result) {
|
|
|
|
|
|
defer wg.Done()
|
|
|
|
|
|
logx.Infof("开始处理企业[%d],企业名称: %s,统一社会信用代码: %s", origIndex, companyInfo.Get("basicInfo.name").String(), companyInfo.Get("basicInfo.creditCode").String())
|
|
|
|
|
|
// 提取企业名称和统一社会信用代码
|
|
|
|
|
|
orgName := companyInfo.Get("basicInfo.name")
|
|
|
|
|
|
creditCode := companyInfo.Get("basicInfo.creditCode")
|
|
|
|
|
|
|
|
|
|
|
|
if !orgName.Exists() || !creditCode.Exists() {
|
|
|
|
|
|
results <- struct {
|
|
|
|
|
|
index int
|
|
|
|
|
|
data []byte
|
|
|
|
|
|
err error
|
|
|
|
|
|
}{origIndex, nil, fmt.Errorf("企业名称或统一社会信用代码不存在")}
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 解析原始公司信息为map
|
|
|
|
|
|
var companyMap map[string]interface{}
|
|
|
|
|
|
if err := json.Unmarshal([]byte(companyInfo.Raw), &companyMap); err != nil {
|
|
|
|
|
|
results <- struct {
|
|
|
|
|
|
index int
|
|
|
|
|
|
data []byte
|
|
|
|
|
|
err error
|
|
|
|
|
|
}{origIndex, nil, fmt.Errorf("解析企业信息失败: %v", err)}
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 调用QYGL8271接口获取企业涉诉信息
|
|
|
|
|
|
lawsuitResp, err := a.tianyuanapi.CallInterface("QYGL8271", map[string]interface{}{
|
|
|
|
|
|
"ent_name": orgName.String(),
|
|
|
|
|
|
"ent_code": creditCode.String(),
|
|
|
|
|
|
"auth_date": generateAuthDateRange(),
|
|
|
|
|
|
})
|
|
|
|
|
|
// 无论是否有错误,都继续处理
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
// 可能是正常没有涉诉数据,设置为空对象
|
|
|
|
|
|
logx.Infof("企业[%s]涉诉信息查询结果: %v", orgName.String(), err)
|
|
|
|
|
|
companyMap["lawsuitInfo"] = map[string]interface{}{}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 转换响应数据
|
|
|
|
|
|
lawsuitRespBytes, err := convertTianyuanResponse(lawsuitResp)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
logx.Errorf("转换企业[%s]涉诉响应失败: %v", orgName.String(), err)
|
|
|
|
|
|
companyMap["lawsuitInfo"] = map[string]interface{}{}
|
|
|
|
|
|
} else if len(lawsuitRespBytes) == 0 || string(lawsuitRespBytes) == "{}" || string(lawsuitRespBytes) == "null" {
|
|
|
|
|
|
// 无涉诉数据
|
|
|
|
|
|
companyMap["lawsuitInfo"] = map[string]interface{}{}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 解析涉诉信息
|
|
|
|
|
|
var lawsuitInfo interface{}
|
|
|
|
|
|
if err := json.Unmarshal(lawsuitRespBytes, &lawsuitInfo); err != nil {
|
|
|
|
|
|
logx.Errorf("解析企业[%s]涉诉信息失败: %v", orgName.String(), err)
|
|
|
|
|
|
companyMap["lawsuitInfo"] = map[string]interface{}{}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 添加涉诉信息到企业信息中
|
|
|
|
|
|
companyMap["lawsuitInfo"] = lawsuitInfo
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 序列化更新后的企业信息
|
|
|
|
|
|
companyData, err := json.Marshal(companyMap)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
results <- struct {
|
|
|
|
|
|
index int
|
|
|
|
|
|
data []byte
|
|
|
|
|
|
err error
|
|
|
|
|
|
}{origIndex, nil, fmt.Errorf("序列化企业信息失败: %v", err)}
|
|
|
|
|
|
return
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
results <- struct {
|
|
|
|
|
|
index int
|
|
|
|
|
|
data []byte
|
|
|
|
|
|
err error
|
|
|
|
|
|
}{origIndex, companyData, nil}
|
|
|
|
|
|
}(company.Index, company.Data)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 关闭结果通道
|
|
|
|
|
|
go func() {
|
|
|
|
|
|
wg.Wait()
|
|
|
|
|
|
close(results)
|
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
|
|
// 解析原始数据为map
|
|
|
|
|
|
var dataMap map[string]interface{}
|
|
|
|
|
|
if err := json.Unmarshal([]byte(data.Raw), &dataMap); err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("解析data字段失败: %v", err)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取原始企业列表
|
|
|
|
|
|
originalDatalist, ok := dataMap["datalist"].([]interface{})
|
|
|
|
|
|
if !ok {
|
|
|
|
|
|
return nil, fmt.Errorf("无法获取原始企业列表")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 创建结果映射,用于保存已处理的企业
|
|
|
|
|
|
processedCompanies := make(map[int]interface{})
|
|
|
|
|
|
|
|
|
|
|
|
// 收集处理过的企业数据
|
|
|
|
|
|
for result := range results {
|
|
|
|
|
|
if result.err != nil {
|
|
|
|
|
|
logx.Errorf("处理企业失败: %v", result.err)
|
|
|
|
|
|
continue
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if result.data != nil {
|
|
|
|
|
|
var companyMap interface{}
|
|
|
|
|
|
if err := json.Unmarshal(result.data, &companyMap); err == nil {
|
|
|
|
|
|
processedCompanies[result.index] = companyMap
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 更新企业列表
|
|
|
|
|
|
// 处理过的用新数据,未处理的保留原样
|
|
|
|
|
|
updatedDatalist := make([]interface{}, len(originalDatalist))
|
|
|
|
|
|
for i, company := range originalDatalist {
|
|
|
|
|
|
if processed, exists := processedCompanies[i]; exists {
|
|
|
|
|
|
// 已处理的企业,使用新数据
|
|
|
|
|
|
updatedDatalist[i] = processed
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 未处理的企业,保留原始数据并添加空的涉诉信息
|
|
|
|
|
|
companyMap, ok := company.(map[string]interface{})
|
|
|
|
|
|
if ok {
|
|
|
|
|
|
// 为未处理的企业添加空的涉诉信息
|
|
|
|
|
|
companyMap["lawsuitInfo"] = map[string]interface{}{}
|
|
|
|
|
|
updatedDatalist[i] = companyMap
|
|
|
|
|
|
} else {
|
|
|
|
|
|
updatedDatalist[i] = company
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 更新原始数据中的企业列表
|
|
|
|
|
|
dataMap["datalist"] = updatedDatalist
|
|
|
|
|
|
|
|
|
|
|
|
// 序列化最终结果
|
|
|
|
|
|
result, err := json.Marshal(dataMap)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("序列化最终结果失败: %v", err)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result, nil
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// code不等于"0000",返回错误
|
|
|
|
|
|
return nil, fmt.Errorf("响应code错误: %s", code.String())
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcesFLXG0V4BRequest 个人司法涉诉(详版)
|
|
|
|
|
|
func (a *ApiRequestService) ProcesFLXG0V4BRequest(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{}{
|
|
|
|
|
|
"name": name.String(),
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
"auth_date": generateAuthDateRange(),
|
|
|
|
|
|
})
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
respBytes, err := json.Marshal(resp.Data)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
return respBytes, nil
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessFLXG0687Request 反诈反赌核验
|
|
|
|
|
|
func (a *ApiRequestService) ProcessFLXG0687Request(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{}{
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
respBytes, err := convertTianyuanResponse(resp)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Value := gjson.GetBytes(respBytes, "value")
|
|
|
|
|
|
if !Value.Exists() {
|
|
|
|
|
|
return nil, fmt.Errorf("自然人反诈反赌核验查询失败")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return []byte(Value.Raw), nil
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessFLXG3D56Request 违约失信
|
|
|
|
|
|
func (a *ApiRequestService) ProcessFLXG3D56Request(params []byte) ([]byte, error) {
|
|
|
|
|
|
name := gjson.GetBytes(params, "name")
|
|
|
|
|
|
idCard := gjson.GetBytes(params, "id_card")
|
|
|
|
|
|
mobile := gjson.GetBytes(params, "mobile")
|
|
|
|
|
|
if !name.Exists() || !idCard.Exists() || !mobile.Exists() {
|
|
|
|
|
|
return nil, errors.New("api请求, FLXG3D56, 获取相关参数失败")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("FLXG3D56", map[string]interface{}{
|
|
|
|
|
|
"name": name.String(),
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
"mobile_no": mobile.String(),
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
respBytes, err := convertTianyuanResponse(resp)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
codeResult := gjson.GetBytes(respBytes, "code")
|
|
|
|
|
|
if !codeResult.Exists() {
|
|
|
|
|
|
return nil, fmt.Errorf("code 字段不存在")
|
|
|
|
|
|
}
|
|
|
|
|
|
if codeResult.String() != "00" {
|
|
|
|
|
|
return nil, fmt.Errorf("未匹配到相关结果")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取 data 字段
|
|
|
|
|
|
dataResult := gjson.GetBytes(respBytes, "data")
|
|
|
|
|
|
if !dataResult.Exists() {
|
|
|
|
|
|
return nil, fmt.Errorf("data 字段不存在")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 将 data 字段解析为 map
|
|
|
|
|
|
var dataMap map[string]interface{}
|
|
|
|
|
|
if err := json.Unmarshal([]byte(dataResult.Raw), &dataMap); err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("解析 data 字段失败: %v", err)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 删除指定字段
|
|
|
|
|
|
delete(dataMap, "swift_number")
|
|
|
|
|
|
delete(dataMap, "DataStrategy")
|
|
|
|
|
|
|
|
|
|
|
|
// 重新编码为 JSON
|
|
|
|
|
|
modifiedData, err := json.Marshal(dataMap)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("编码修改后的 data 失败: %v", err)
|
|
|
|
|
|
}
|
|
|
|
|
|
return modifiedData, nil
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessIVYZ5733Request 婚姻状况
|
|
|
|
|
|
func (a *ApiRequestService) ProcessIVYZ5733Request(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{}{
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
"name": name.String(),
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
respBytes, err := convertTianyuanResponse(resp)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
result := gjson.GetBytes(respBytes, "data.data")
|
|
|
|
|
|
if !result.Exists() {
|
|
|
|
|
|
return nil, fmt.Errorf("婚姻状态查询失败")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取原始结果
|
|
|
|
|
|
rawResult := result.String()
|
|
|
|
|
|
|
|
|
|
|
|
// 根据结果转换状态码
|
|
|
|
|
|
var statusCode string
|
|
|
|
|
|
switch {
|
|
|
|
|
|
case strings.HasPrefix(rawResult, "INR"):
|
|
|
|
|
|
statusCode = "0" // 匹配不成功
|
|
|
|
|
|
case strings.HasPrefix(rawResult, "IA"):
|
|
|
|
|
|
statusCode = "1" // 结婚
|
|
|
|
|
|
case strings.HasPrefix(rawResult, "IB"):
|
|
|
|
|
|
statusCode = "2" // 离婚
|
|
|
|
|
|
default:
|
|
|
|
|
|
return nil, fmt.Errorf("婚姻状态查询失败,未知状态码: %s", statusCode)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 构建新的返回结果
|
|
|
|
|
|
response := map[string]string{
|
|
|
|
|
|
"status": statusCode,
|
|
|
|
|
|
}
|
|
|
|
|
|
// 序列化为JSON
|
|
|
|
|
|
jsonResponse, err := json.Marshal(response)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("序列化结果失败: %v", err)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return jsonResponse, nil
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessIVYZ9A2BRequest 学历查询
|
|
|
|
|
|
func (a *ApiRequestService) ProcessIVYZ9A2BRequest(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{}{
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
"name": name.String(),
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
respBytes, err := convertTianyuanResponse(resp)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 解析响应
|
|
|
|
|
|
codeResult := gjson.GetBytes(respBytes, "data.education_background.code")
|
|
|
|
|
|
if !codeResult.Exists() {
|
|
|
|
|
|
return nil, fmt.Errorf("教育经历核验查询失败: 返回数据缺少code字段")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
code := codeResult.String()
|
|
|
|
|
|
var result map[string]interface{}
|
|
|
|
|
|
|
|
|
|
|
|
switch code {
|
|
|
|
|
|
case "9100":
|
|
|
|
|
|
// 查询成功有结果
|
|
|
|
|
|
eduResultArray := gjson.GetBytes(respBytes, "data.education_background.data").Array()
|
|
|
|
|
|
var processedEduData []interface{}
|
|
|
|
|
|
|
|
|
|
|
|
// 提取每个元素中Raw字段的实际内容
|
|
|
|
|
|
for _, item := range eduResultArray {
|
|
|
|
|
|
var eduInfo interface{}
|
|
|
|
|
|
if err := json.Unmarshal([]byte(item.Raw), &eduInfo); err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("解析教育信息失败: %v", err)
|
|
|
|
|
|
}
|
|
|
|
|
|
processedEduData = append(processedEduData, eduInfo)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
result = map[string]interface{}{
|
|
|
|
|
|
"data": processedEduData,
|
|
|
|
|
|
"status": 1,
|
|
|
|
|
|
}
|
|
|
|
|
|
case "9000":
|
|
|
|
|
|
// 查询成功无结果
|
|
|
|
|
|
result = map[string]interface{}{
|
|
|
|
|
|
"data": []interface{}{},
|
|
|
|
|
|
"status": 0,
|
|
|
|
|
|
}
|
|
|
|
|
|
default:
|
|
|
|
|
|
// 其他情况视为错误
|
|
|
|
|
|
errMsg := gjson.GetBytes(respBytes, "data.education_background.msg").String()
|
|
|
|
|
|
return nil, fmt.Errorf("教育经历核验查询失败: %s (code: %s)", errMsg, code)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 将结果转为JSON字节
|
|
|
|
|
|
jsonResult, err := json.Marshal(result)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("处理教育经历查询结果失败: %v", err)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return jsonResult, nil
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessYYSYBE08Request 二要素
|
|
|
|
|
|
func (a *ApiRequestService) ProcessYYSYBE08Request(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{}{
|
|
|
|
|
|
"name": name.String(),
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
respBytes, err := convertTianyuanResponse(resp)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 使用gjson获取resultCode
|
|
|
|
|
|
resultCode := gjson.GetBytes(respBytes, "ctidRequest.ctidAuth.resultCode")
|
|
|
|
|
|
if !resultCode.Exists() {
|
|
|
|
|
|
return nil, errors.New("获取resultCode失败")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取resultCode的第一个字符
|
|
|
|
|
|
resultCodeStr := resultCode.String()
|
|
|
|
|
|
if len(resultCodeStr) == 0 {
|
|
|
|
|
|
return nil, errors.New("resultCode为空")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
firstChar := string(resultCodeStr[0])
|
|
|
|
|
|
if firstChar != "0" && firstChar != "5" {
|
|
|
|
|
|
return nil, errors.New("resultCode的第一个字符既不是0也不是5")
|
|
|
|
|
|
}
|
|
|
|
|
|
return []byte(firstChar), nil
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessJRZQ0A03Request 借贷申请
|
|
|
|
|
|
func (a *ApiRequestService) ProcessJRZQ0A03Request(params []byte) ([]byte, error) {
|
|
|
|
|
|
name := gjson.GetBytes(params, "name")
|
|
|
|
|
|
idCard := gjson.GetBytes(params, "id_card")
|
|
|
|
|
|
mobile := gjson.GetBytes(params, "mobile")
|
|
|
|
|
|
if !name.Exists() || !idCard.Exists() || !mobile.Exists() {
|
|
|
|
|
|
return nil, errors.New("api请求, JRZQ0A03, 获取相关参数失败")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("JRZQ0A03", map[string]interface{}{
|
|
|
|
|
|
"name": name.String(),
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
"mobile_no": mobile.String(),
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
respBytes, err := convertTianyuanResponse(resp)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取 code 字段
|
|
|
|
|
|
codeResult := gjson.GetBytes(respBytes, "code")
|
|
|
|
|
|
if !codeResult.Exists() {
|
|
|
|
|
|
return nil, fmt.Errorf("code 字段不存在")
|
|
|
|
|
|
}
|
|
|
|
|
|
if codeResult.String() != "00" {
|
|
|
|
|
|
return nil, fmt.Errorf("未匹配到相关结果")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取 data 字段
|
|
|
|
|
|
dataResult := gjson.GetBytes(respBytes, "data")
|
|
|
|
|
|
if !dataResult.Exists() {
|
|
|
|
|
|
return nil, fmt.Errorf("data 字段不存在")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 将 data 字段解析为 map
|
|
|
|
|
|
var dataMap map[string]interface{}
|
|
|
|
|
|
if err := json.Unmarshal([]byte(dataResult.Raw), &dataMap); err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("解析 data 字段失败: %v", err)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 删除指定字段
|
|
|
|
|
|
delete(dataMap, "swift_number")
|
|
|
|
|
|
delete(dataMap, "DataStrategy")
|
|
|
|
|
|
|
|
|
|
|
|
// 重新编码为 JSON
|
|
|
|
|
|
modifiedData, err := json.Marshal(dataMap)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("编码修改后的 data 失败: %v", err)
|
|
|
|
|
|
}
|
|
|
|
|
|
return modifiedData, nil
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessJRZQ8203Request 借贷行为
|
|
|
|
|
|
func (a *ApiRequestService) ProcessJRZQ8203Request(params []byte) ([]byte, error) {
|
|
|
|
|
|
name := gjson.GetBytes(params, "name")
|
|
|
|
|
|
idCard := gjson.GetBytes(params, "id_card")
|
|
|
|
|
|
mobile := gjson.GetBytes(params, "mobile")
|
|
|
|
|
|
if !name.Exists() || !idCard.Exists() || !mobile.Exists() {
|
|
|
|
|
|
return nil, errors.New("api请求, JRZQ8203, 获取相关参数失败")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("JRZQ8203", map[string]interface{}{
|
|
|
|
|
|
"name": name.String(),
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
"mobile_no": mobile.String(),
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
respBytes, err := convertTianyuanResponse(resp)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取 code 字段
|
|
|
|
|
|
codeResult := gjson.GetBytes(respBytes, "code")
|
|
|
|
|
|
if !codeResult.Exists() {
|
|
|
|
|
|
return nil, fmt.Errorf("code 字段不存在")
|
|
|
|
|
|
}
|
|
|
|
|
|
if codeResult.String() != "00" {
|
|
|
|
|
|
return nil, fmt.Errorf("未匹配到相关结果")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取 data 字段
|
|
|
|
|
|
dataResult := gjson.GetBytes(respBytes, "data")
|
|
|
|
|
|
if !dataResult.Exists() {
|
|
|
|
|
|
return nil, fmt.Errorf("data 字段不存在")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 将 data 字段解析为 map
|
|
|
|
|
|
var dataMap map[string]interface{}
|
|
|
|
|
|
if err := json.Unmarshal([]byte(dataResult.Raw), &dataMap); err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("解析 data 字段失败: %v", err)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 删除指定字段
|
|
|
|
|
|
delete(dataMap, "swift_number")
|
|
|
|
|
|
delete(dataMap, "DataStrategy")
|
|
|
|
|
|
|
|
|
|
|
|
// 重新编码为 JSON
|
|
|
|
|
|
modifiedData, err := json.Marshal(dataMap)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("编码修改后的 data 失败: %v", err)
|
|
|
|
|
|
}
|
|
|
|
|
|
return modifiedData, nil
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessJRZQ4AA8Request 还款压力
|
|
|
|
|
|
func (a *ApiRequestService) ProcessJRZQ4AA8Request(params []byte) ([]byte, error) {
|
|
|
|
|
|
idCard := gjson.GetBytes(params, "id_card")
|
|
|
|
|
|
name := gjson.GetBytes(params, "name")
|
|
|
|
|
|
mobile := gjson.GetBytes(params, "mobile")
|
|
|
|
|
|
if !idCard.Exists() || !name.Exists() || !mobile.Exists() {
|
|
|
|
|
|
return nil, errors.New("api请求, JRZQ4AA8, 获取相关参数失败")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("JRZQ4AA8", map[string]interface{}{
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
"name": name.String(),
|
|
|
|
|
|
"mobile_no": mobile.String(),
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
respBytes, err := convertTianyuanResponse(resp)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取响应码和偿贷压力标志
|
|
|
|
|
|
code := gjson.GetBytes(respBytes, "code").String()
|
|
|
|
|
|
flagDebtRepayStress := gjson.GetBytes(respBytes, "flag_debtrepaystress").String()
|
|
|
|
|
|
|
|
|
|
|
|
// 判断是否成功
|
|
|
|
|
|
if code != "00" || flagDebtRepayStress != "1" {
|
|
|
|
|
|
return nil, fmt.Errorf("偿贷压力查询失败: %+v", respBytes)
|
|
|
|
|
|
}
|
|
|
|
|
|
// 获取偿贷压力分数
|
|
|
|
|
|
drsNoDebtScore := gjson.GetBytes(respBytes, "drs_nodebtscore").String()
|
|
|
|
|
|
|
|
|
|
|
|
// 构建结果
|
|
|
|
|
|
result := map[string]interface{}{
|
|
|
|
|
|
"score": drsNoDebtScore,
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 将结果转为JSON
|
|
|
|
|
|
jsonResult, err := json.Marshal(result)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("处理偿贷压力查询结果失败: %v", err)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return jsonResult, nil
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessQYGL8271Request 企业涉诉
|
|
|
|
|
|
func (a *ApiRequestService) ProcessQYGL8271Request(params []byte) ([]byte, error) {
|
|
|
|
|
|
entName := gjson.GetBytes(params, "ent_name")
|
|
|
|
|
|
entCode := gjson.GetBytes(params, "ent_code")
|
|
|
|
|
|
|
|
|
|
|
|
if !entName.Exists() || !entCode.Exists() {
|
|
|
|
|
|
return nil, errors.New("api请求, QYGL8271, 获取相关参数失败")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("QYGL8271", map[string]interface{}{
|
|
|
|
|
|
"ent_name": entName.String(),
|
|
|
|
|
|
"ent_code": entCode.String(),
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
respBytes, err := convertTianyuanResponse(resp)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 第一步:提取外层的 data 字段
|
|
|
|
|
|
dataResult := gjson.GetBytes(respBytes, "data")
|
|
|
|
|
|
if !dataResult.Exists() {
|
|
|
|
|
|
return nil, fmt.Errorf("外层 data 字段不存在")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 第二步:解析外层 data 的 JSON 字符串
|
|
|
|
|
|
var outerDataMap map[string]interface{}
|
|
|
|
|
|
if err := json.Unmarshal([]byte(dataResult.String()), &outerDataMap); err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("解析外层 data 字段失败: %v", err)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 第三步:提取内层的 data 字段
|
|
|
|
|
|
innerData, ok := outerDataMap["data"].(string)
|
|
|
|
|
|
if !ok {
|
|
|
|
|
|
return nil, fmt.Errorf("内层 data 字段不存在或类型错误")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 第四步:解析内层 data 的 JSON 字符串
|
|
|
|
|
|
var finalDataMap map[string]interface{}
|
|
|
|
|
|
if err := json.Unmarshal([]byte(innerData), &finalDataMap); err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("解析内层 data 字段失败: %v", err)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 将最终的 JSON 对象编码为字节数组返回
|
|
|
|
|
|
finalDataBytes, err := json.Marshal(finalDataMap)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("编码最终的 JSON 对象失败: %v", err)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
statusResult := gjson.GetBytes(finalDataBytes, "status.status")
|
|
|
|
|
|
if statusResult.Exists() || statusResult.Int() == -1 {
|
|
|
|
|
|
return nil, fmt.Errorf("企业涉诉为空: %+v", finalDataBytes)
|
|
|
|
|
|
}
|
|
|
|
|
|
return finalDataBytes, nil
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessFLXG0V4BRequest 个人涉诉
|
|
|
|
|
|
func (a *ApiRequestService) ProcessFLXG0V4BRequest(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{}{
|
|
|
|
|
|
"name": name.String(),
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
"auth_date": generateAuthDateRange(),
|
|
|
|
|
|
}, &tianyuanapi.ApiCallOptions{
|
|
|
|
|
|
Json: true,
|
|
|
|
|
|
})
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessQYGL6F2DRequest 人企关联
|
|
|
|
|
|
func (a *ApiRequestService) ProcessQYGL6F2DRequest(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{}{
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
respBytes, err := convertTianyuanResponse(resp)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 处理股东人企关系的响应数据
|
|
|
|
|
|
code := gjson.GetBytes(respBytes, "code")
|
|
|
|
|
|
if !code.Exists() {
|
|
|
|
|
|
return nil, fmt.Errorf("响应中缺少 code 字段")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 判断 code 是否等于 "0000"
|
|
|
|
|
|
if code.String() == "0000" {
|
|
|
|
|
|
// 获取 data 字段的值
|
|
|
|
|
|
data := gjson.GetBytes(respBytes, "data")
|
|
|
|
|
|
if !data.Exists() {
|
|
|
|
|
|
return nil, fmt.Errorf("响应中缺少 data 字段")
|
|
|
|
|
|
}
|
|
|
|
|
|
// 返回 data 字段的内容
|
|
|
|
|
|
return []byte(data.Raw), nil
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// code 不等于 "0000",返回错误
|
|
|
|
|
|
return nil, fmt.Errorf("响应code错误%s", code.String())
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 13:34:49 +08:00
|
|
|
|
// ProcessQCXGGB2QRequest 人车核验简版
|
|
|
|
|
|
func (a *ApiRequestService) ProcessQCXGGB2QRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
plateNo := gjson.GetBytes(params, "plate_no")
|
|
|
|
|
|
carplateType := gjson.GetBytes(params, "carplate_type")
|
|
|
|
|
|
name := gjson.GetBytes(params, "name")
|
|
|
|
|
|
|
|
|
|
|
|
if !plateNo.Exists() || !carplateType.Exists() || !name.Exists() {
|
|
|
|
|
|
return nil, errors.New("api请求, QCXGGB2Q, 获取相关参数失败")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("QCXGGB2Q", map[string]interface{}{
|
|
|
|
|
|
"plate_no": plateNo.String(),
|
|
|
|
|
|
"carplate_type": carplateType.String(),
|
|
|
|
|
|
"name": name.String(),
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessQCXGYTS2Request 人车核验详版
|
|
|
|
|
|
func (a *ApiRequestService) ProcessQCXGYTS2Request(params []byte) ([]byte, error) {
|
|
|
|
|
|
plateNo := gjson.GetBytes(params, "plate_no")
|
|
|
|
|
|
carplateType := gjson.GetBytes(params, "carplate_type")
|
|
|
|
|
|
name := gjson.GetBytes(params, "name")
|
|
|
|
|
|
|
|
|
|
|
|
if !plateNo.Exists() || !carplateType.Exists() || !name.Exists() {
|
|
|
|
|
|
return nil, errors.New("api请求, QCXGYTS2, 获取相关参数失败")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("QCXGYTS2", map[string]interface{}{
|
|
|
|
|
|
"plate_no": plateNo.String(),
|
|
|
|
|
|
"carplate_type": carplateType.String(),
|
|
|
|
|
|
"name": name.String(),
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessQCXG5F3ARequest 名下车辆(车牌)
|
|
|
|
|
|
func (a *ApiRequestService) ProcessQCXG5F3ARequest(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请求, QCXG5F3A, 获取相关参数失败")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("QCXG5F3A", map[string]interface{}{
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
"name": name.String(),
|
|
|
|
|
|
})
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// processVehicleApiPassThrough 车辆类接口通用透传:将缓存 params 原样传给天远(传参后续按接口文档再细化)
|
|
|
|
|
|
func (a *ApiRequestService) processVehicleApiPassThrough(params []byte, apiID string) ([]byte, error) {
|
|
|
|
|
|
var m map[string]interface{}
|
|
|
|
|
|
if err := json.Unmarshal(params, &m); err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("api请求, %s, 解析参数失败: %w", apiID, err)
|
|
|
|
|
|
}
|
2026-02-12 15:42:09 +08:00
|
|
|
|
logx.Infof("vehicle api passthrough, api_id=%s, params_keys=%v", apiID, keysOfMap(m))
|
2026-02-06 13:34:49 +08:00
|
|
|
|
resp, err := a.tianyuanapi.CallInterface(apiID, m)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 车辆 API 按 md 从缓存 params 提取字段并调用天远
|
|
|
|
|
|
|
|
|
|
|
|
func (a *ApiRequestService) ProcessQCXG4D2ERequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
m := map[string]interface{}{}
|
|
|
|
|
|
if err := json.Unmarshal(params, &m); err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("api请求, QCXG4D2E, 解析参数失败: %w", err)
|
|
|
|
|
|
}
|
|
|
|
|
|
body := map[string]interface{}{}
|
|
|
|
|
|
if v, ok := m["user_type"].(string); ok && v != "" {
|
|
|
|
|
|
body["user_type"] = v
|
|
|
|
|
|
} else {
|
|
|
|
|
|
body["user_type"] = "1"
|
|
|
|
|
|
}
|
|
|
|
|
|
if v, ok := m["id_card"].(string); ok {
|
|
|
|
|
|
body["id_card"] = v
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return nil, errors.New("api请求, QCXG4D2E, 缺少 id_card")
|
|
|
|
|
|
}
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("QCXG4D2E", body)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (a *ApiRequestService) ProcessQCXG5U0ZRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
vin := gjson.GetBytes(params, "vin_code")
|
|
|
|
|
|
if !vin.Exists() || vin.String() == "" {
|
|
|
|
|
|
return nil, errors.New("api请求, QCXG5U0Z, 缺少 vin_code")
|
|
|
|
|
|
}
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("QCXG5U0Z", map[string]interface{}{"vin_code": vin.String()})
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (a *ApiRequestService) ProcessQCXG1U4URequest(params []byte) ([]byte, error) {
|
2026-02-12 15:16:54 +08:00
|
|
|
|
body := buildVehicleBody(params, []string{"vin_code", "image_url"}, nil)
|
|
|
|
|
|
orderNo := gjson.GetBytes(params, "order_no").String()
|
|
|
|
|
|
if body["vin_code"] == nil || body["image_url"] == nil || orderNo == "" {
|
|
|
|
|
|
return nil, errors.New("api请求, QCXG1U4U, 缺少必填参数 vin_code/image_url/order_no")
|
2026-02-06 13:34:49 +08:00
|
|
|
|
}
|
2026-02-12 15:42:09 +08:00
|
|
|
|
logx.Infof("vehicle api request QCXG1U4U, order_no=%s, vin_code=%v, image_url=%v", orderNo, body["vin_code"], body["image_url"])
|
2026-02-12 15:16:54 +08:00
|
|
|
|
body["return_url"] = a.buildVehicleCallbackURL(orderNo, "QCXG1U4U")
|
2026-02-06 13:34:49 +08:00
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("QCXG1U4U", body)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (a *ApiRequestService) ProcessQCXGY7F2Request(params []byte) ([]byte, error) {
|
|
|
|
|
|
body := buildVehicleBody(params, []string{"vin_code", "vehicle_location", "first_registrationdate"}, nil)
|
|
|
|
|
|
if body["vin_code"] == nil || body["vehicle_location"] == nil || body["first_registrationdate"] == nil {
|
|
|
|
|
|
return nil, errors.New("api请求, QCXGY7F2, 缺少必填参数 vin_code/vehicle_location/first_registrationdate")
|
|
|
|
|
|
}
|
2026-02-12 15:42:09 +08:00
|
|
|
|
logx.Infof("vehicle api request QCXGY7F2, vin_code=%v, vehicle_location=%v, first_registrationdate=%v", body["vin_code"], body["vehicle_location"], body["first_registrationdate"])
|
2026-02-06 13:34:49 +08:00
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("QCXGY7F2", body)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (a *ApiRequestService) ProcessQCXG1H7YRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
vin := gjson.GetBytes(params, "vin_code")
|
2026-02-12 16:25:01 +08:00
|
|
|
|
plate := gjson.GetBytes(params, "car_license")
|
|
|
|
|
|
if !vin.Exists() || vin.String() == "" || !plate.Exists() || plate.String() == "" {
|
|
|
|
|
|
return nil, errors.New("api请求, QCXG1H7Y, 缺少 vin_code 或 car_license")
|
|
|
|
|
|
}
|
|
|
|
|
|
// 天远侧字段为 vin_code + plate_no,这里将前端 car_license 映射为 plate_no
|
|
|
|
|
|
body := map[string]interface{}{
|
|
|
|
|
|
"vin_code": vin.String(),
|
|
|
|
|
|
"plate_no": plate.String(),
|
2026-02-06 13:34:49 +08:00
|
|
|
|
}
|
2026-02-12 16:25:01 +08:00
|
|
|
|
logx.Infof("vehicle api request QCXG1H7Y, vin_code=%s, plate_no=%s", vin.String(), plate.String())
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("QCXG1H7Y", body)
|
2026-02-06 13:34:49 +08:00
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (a *ApiRequestService) ProcessQCXG4I1ZRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
vin := gjson.GetBytes(params, "vin_code")
|
|
|
|
|
|
if !vin.Exists() || vin.String() == "" {
|
|
|
|
|
|
return nil, errors.New("api请求, QCXG4I1Z, 缺少 vin_code")
|
|
|
|
|
|
}
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("QCXG4I1Z", map[string]interface{}{"vin_code": vin.String()})
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (a *ApiRequestService) ProcessQCXG3Y6BRequest(params []byte) ([]byte, error) {
|
2026-02-12 15:16:54 +08:00
|
|
|
|
body := buildVehicleBody(params, []string{"vin_code"}, nil)
|
|
|
|
|
|
orderNo := gjson.GetBytes(params, "order_no").String()
|
|
|
|
|
|
if body["vin_code"] == nil || orderNo == "" {
|
|
|
|
|
|
return nil, errors.New("api请求, QCXG3Y6B, 缺少必填参数 vin_code/order_no")
|
2026-02-06 13:34:49 +08:00
|
|
|
|
}
|
2026-02-12 15:42:09 +08:00
|
|
|
|
logx.Infof("vehicle api request QCXG3Y6B, order_no=%s, vin_code=%v", orderNo, body["vin_code"])
|
2026-02-12 15:16:54 +08:00
|
|
|
|
body["return_url"] = a.buildVehicleCallbackURL(orderNo, "QCXG3Y6B")
|
2026-02-06 13:34:49 +08:00
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("QCXG3Y6B", body)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (a *ApiRequestService) ProcessQCXG3Z3LRequest(params []byte) ([]byte, error) {
|
2026-02-12 15:16:54 +08:00
|
|
|
|
body := buildVehicleBody(params, []string{"vin_code"}, nil)
|
|
|
|
|
|
orderNo := gjson.GetBytes(params, "order_no").String()
|
|
|
|
|
|
if body["vin_code"] == nil || orderNo == "" {
|
|
|
|
|
|
return nil, errors.New("api请求, QCXG3Z3L, 缺少必填参数 vin_code/order_no")
|
2026-02-06 13:34:49 +08:00
|
|
|
|
}
|
2026-02-12 15:42:09 +08:00
|
|
|
|
logx.Infof("vehicle api request QCXG3Z3L, order_no=%s, vin_code=%v", orderNo, body["vin_code"])
|
2026-02-12 15:16:54 +08:00
|
|
|
|
body["return_url"] = a.buildVehicleCallbackURL(orderNo, "QCXG3Z3L")
|
2026-02-06 13:34:49 +08:00
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("QCXG3Z3L", body)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (a *ApiRequestService) ProcessQCXGP00WRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
vin := gjson.GetBytes(params, "vin_code")
|
2026-02-12 15:16:54 +08:00
|
|
|
|
orderNo := gjson.GetBytes(params, "order_no").String()
|
2026-02-06 13:34:49 +08:00
|
|
|
|
vlphoto := gjson.GetBytes(params, "vlphoto_data")
|
2026-02-12 15:16:54 +08:00
|
|
|
|
if !vin.Exists() || vin.String() == "" || orderNo == "" || !vlphoto.Exists() || vlphoto.String() == "" {
|
|
|
|
|
|
return nil, errors.New("api请求, QCXGP00W, 缺少必填参数 vin_code/order_no/vlphoto_data")
|
2026-02-06 13:34:49 +08:00
|
|
|
|
}
|
2026-02-12 15:42:09 +08:00
|
|
|
|
logx.Infof("vehicle api request QCXGP00W, order_no=%s, vin_code=%s, vlphoto_data_len=%d", orderNo, vin.String(), len(vlphoto.String()))
|
2026-02-06 13:34:49 +08:00
|
|
|
|
key, err := hex.DecodeString(a.config.Encrypt.SecretKey)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("api请求, QCXGP00W, 密钥解析失败: %w", err)
|
|
|
|
|
|
}
|
|
|
|
|
|
encData, err := crypto.AesEncrypt([]byte(vlphoto.String()), key)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("api请求, QCXGP00W, 加密行驶证数据失败: %w", err)
|
|
|
|
|
|
}
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("QCXGP00W", map[string]interface{}{
|
|
|
|
|
|
"vin_code": vin.String(),
|
2026-02-12 15:16:54 +08:00
|
|
|
|
"return_url": a.buildVehicleCallbackURL(orderNo, "QCXGP00W"),
|
2026-02-06 13:34:49 +08:00
|
|
|
|
"data": encData,
|
|
|
|
|
|
})
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (a *ApiRequestService) ProcessQCXG6B4ERequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
vin := gjson.GetBytes(params, "vin_code")
|
2026-02-12 15:16:54 +08:00
|
|
|
|
if !vin.Exists() || vin.String() == "" {
|
|
|
|
|
|
return nil, errors.New("api请求, QCXG6B4E, 缺少 vin_code")
|
|
|
|
|
|
}
|
|
|
|
|
|
auth := gjson.GetBytes(params, "authorized").String()
|
|
|
|
|
|
if auth == "" {
|
|
|
|
|
|
auth = "1"
|
2026-02-06 13:34:49 +08:00
|
|
|
|
}
|
|
|
|
|
|
// 天远文档字段名为 VINCode、Authorized
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("QCXG6B4E", map[string]interface{}{
|
2026-02-12 16:39:53 +08:00
|
|
|
|
"vin_code": vin.String(),
|
|
|
|
|
|
"authorized": auth,
|
2026-02-06 13:34:49 +08:00
|
|
|
|
})
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-12 15:16:54 +08:00
|
|
|
|
// processVerifyPassThrough 核验类接口:缓存 params 已含 mobile_no/id_card/name 等,原样传天远
|
|
|
|
|
|
func (a *ApiRequestService) processVerifyPassThrough(params []byte, apiID string) ([]byte, error) {
|
|
|
|
|
|
var m map[string]interface{}
|
|
|
|
|
|
if err := json.Unmarshal(params, &m); err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("api请求, %s, 解析参数失败: %w", apiID, err)
|
|
|
|
|
|
}
|
2026-02-12 15:42:09 +08:00
|
|
|
|
logx.Infof("verify api passthrough, api_id=%s, params_keys=%v", apiID, keysOfMap(m))
|
2026-02-12 15:16:54 +08:00
|
|
|
|
resp, err := a.tianyuanapi.CallInterface(apiID, m)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func (a *ApiRequestService) ProcessIVYZ9K7FRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
return a.processVerifyPassThrough(params, "IVYZ9K7F")
|
|
|
|
|
|
}
|
|
|
|
|
|
func (a *ApiRequestService) ProcessIVYZA1B3Request(params []byte) ([]byte, error) {
|
|
|
|
|
|
return a.processVerifyPassThrough(params, "IVYZA1B3")
|
|
|
|
|
|
}
|
|
|
|
|
|
func (a *ApiRequestService) ProcessIVYZ6M8PRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
return a.processVerifyPassThrough(params, "IVYZ6M8P")
|
|
|
|
|
|
}
|
|
|
|
|
|
func (a *ApiRequestService) ProcessJRZQ8B3CRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
return a.processVerifyPassThrough(params, "JRZQ8B3C")
|
|
|
|
|
|
}
|
|
|
|
|
|
func (a *ApiRequestService) ProcessYYSY3M8SRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
return a.processVerifyPassThrough(params, "YYSY3M8S")
|
|
|
|
|
|
}
|
|
|
|
|
|
func (a *ApiRequestService) ProcessYYSYK9R4Request(params []byte) ([]byte, error) {
|
|
|
|
|
|
return a.processVerifyPassThrough(params, "YYSYK9R4")
|
|
|
|
|
|
}
|
|
|
|
|
|
func (a *ApiRequestService) ProcessYYSYF2T7Request(params []byte) ([]byte, error) {
|
|
|
|
|
|
return a.processVerifyPassThrough(params, "YYSYF2T7")
|
|
|
|
|
|
}
|
|
|
|
|
|
func (a *ApiRequestService) ProcessYYSYK8R3Request(params []byte) ([]byte, error) {
|
|
|
|
|
|
return a.processVerifyPassThrough(params, "YYSYK8R3")
|
|
|
|
|
|
}
|
|
|
|
|
|
func (a *ApiRequestService) ProcessYYSYS9W1Request(params []byte) ([]byte, error) {
|
|
|
|
|
|
return a.processVerifyPassThrough(params, "YYSYS9W1")
|
|
|
|
|
|
}
|
|
|
|
|
|
func (a *ApiRequestService) ProcessYYSYE7V5Request(params []byte) ([]byte, error) {
|
|
|
|
|
|
return a.processVerifyPassThrough(params, "YYSYE7V5")
|
|
|
|
|
|
}
|
|
|
|
|
|
func (a *ApiRequestService) ProcessYYSYP0T4Request(params []byte) ([]byte, error) {
|
|
|
|
|
|
return a.processVerifyPassThrough(params, "YYSYP0T4")
|
|
|
|
|
|
}
|
|
|
|
|
|
func (a *ApiRequestService) ProcessYYSY6F2BRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
return a.processVerifyPassThrough(params, "YYSY6F2B")
|
|
|
|
|
|
}
|
|
|
|
|
|
func (a *ApiRequestService) ProcessYYSY9E4ARequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
return a.processVerifyPassThrough(params, "YYSY9E4A")
|
|
|
|
|
|
}
|
|
|
|
|
|
func (a *ApiRequestService) ProcessQYGL5F6ARequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
return a.processVerifyPassThrough(params, "QYGL5F6A")
|
|
|
|
|
|
}
|
|
|
|
|
|
func (a *ApiRequestService) ProcessJRZQACABRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
return a.processVerifyPassThrough(params, "JRZQACAB")
|
|
|
|
|
|
}
|
|
|
|
|
|
func (a *ApiRequestService) ProcessJRZQ0B6YRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
return a.processVerifyPassThrough(params, "JRZQ0B6Y")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-12 18:57:13 +08:00
|
|
|
|
// QYGL66SL 企业司法涉诉(简版)
|
|
|
|
|
|
func (a *ApiRequestService) ProcessQYGL66SLRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
return a.processVerifyPassThrough(params, "QYGL66SL")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// FLXG3A9B 限高被执行人
|
|
|
|
|
|
func (a *ApiRequestService) ProcessFLXG3A9BRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
return a.processVerifyPassThrough(params, "FLXG3A9B")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// QYGL2S0W 失信被执行人
|
|
|
|
|
|
func (a *ApiRequestService) ProcessQYGL2S0WRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
return a.processVerifyPassThrough(params, "QYGL2S0W")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-06 13:34:49 +08:00
|
|
|
|
// buildVehicleBody 从 params 中取 required 与 optional 键,仅非空才写入 body
|
|
|
|
|
|
func buildVehicleBody(params []byte, required, optional []string) map[string]interface{} {
|
|
|
|
|
|
body := make(map[string]interface{})
|
|
|
|
|
|
for _, k := range required {
|
|
|
|
|
|
v := gjson.GetBytes(params, k)
|
|
|
|
|
|
if v.Exists() {
|
|
|
|
|
|
body[k] = v.String()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
for _, k := range optional {
|
|
|
|
|
|
v := gjson.GetBytes(params, k)
|
|
|
|
|
|
if v.Exists() && v.String() != "" {
|
|
|
|
|
|
body[k] = v.String()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return body
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-02-12 15:16:54 +08:00
|
|
|
|
// buildVehicleCallbackURL 生成车辆类接口的异步回调地址
|
2026-02-12 17:04:10 +08:00
|
|
|
|
// 使用 PublicBaseURL 作为对外域名配置,路径固定为 /api/v1/tianyuan/vehicle/callback
|
2026-02-12 15:16:54 +08:00
|
|
|
|
// 并通过查询参数携带 order_no 与 api_id 以便后端识别具体查询与模块。
|
|
|
|
|
|
func (a *ApiRequestService) buildVehicleCallbackURL(orderNo, apiID string) string {
|
2026-02-12 17:04:10 +08:00
|
|
|
|
base := strings.TrimRight(a.config.PublicBaseURL, "/")
|
2026-02-12 15:16:54 +08:00
|
|
|
|
if base == "" {
|
|
|
|
|
|
// 兜底:如果未配置 URLDomain,则使用相对路径,交给网关/部署层补全域名
|
|
|
|
|
|
return fmt.Sprintf("/api/v1/tianyuan/vehicle/callback?order_no=%s&api_id=%s", orderNo, apiID)
|
|
|
|
|
|
}
|
|
|
|
|
|
return fmt.Sprintf("%s/api/v1/tianyuan/vehicle/callback?order_no=%s&api_id=%s", base, orderNo, apiID)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-01-22 16:04:12 +08:00
|
|
|
|
// ProcessQCXG7A2BRequest 名下车辆
|
|
|
|
|
|
func (a *ApiRequestService) ProcessQCXG7A2BRequest(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{}{
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessYYSY09CDRequest 三要素
|
|
|
|
|
|
func (a *ApiRequestService) ProcessYYSY09CDRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
name := gjson.GetBytes(params, "name")
|
|
|
|
|
|
idCard := gjson.GetBytes(params, "id_card")
|
|
|
|
|
|
mobile := gjson.GetBytes(params, "mobile")
|
|
|
|
|
|
if !name.Exists() || !idCard.Exists() || !mobile.Exists() {
|
|
|
|
|
|
return nil, errors.New("api请求, YYSY09CD, 获取相关参数失败")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("YYSY09CD", map[string]interface{}{
|
|
|
|
|
|
"name": name.String(),
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
"mobile_no": mobile.String(),
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
respBytes, err := convertTianyuanResponse(resp)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 使用gjson获取resultCode
|
|
|
|
|
|
resultCode := gjson.GetBytes(respBytes, "ctidRequest.ctidAuth.resultCode")
|
|
|
|
|
|
if !resultCode.Exists() {
|
|
|
|
|
|
return nil, errors.New("获取resultCode失败")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取resultCode的第一个字符
|
|
|
|
|
|
resultCodeStr := resultCode.String()
|
|
|
|
|
|
if len(resultCodeStr) == 0 {
|
|
|
|
|
|
return nil, errors.New("resultCode为空")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
firstChar := string(resultCodeStr[0])
|
|
|
|
|
|
if firstChar != "0" && firstChar != "5" {
|
|
|
|
|
|
return nil, errors.New("resultCode的第一个字符既不是0也不是5")
|
|
|
|
|
|
}
|
|
|
|
|
|
return []byte(firstChar), nil
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessBehaviorRiskScanRequest 行为风险扫描
|
|
|
|
|
|
func (a *ApiRequestService) ProcessBehaviorRiskScanRequest(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请求, BehaviorRiskScan, 获取相关参数失败")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var wg sync.WaitGroup
|
|
|
|
|
|
type apiResult struct {
|
|
|
|
|
|
name string
|
|
|
|
|
|
data []byte
|
|
|
|
|
|
err error
|
|
|
|
|
|
}
|
|
|
|
|
|
results := make(chan apiResult, 1) // 4个风险检测项
|
|
|
|
|
|
|
|
|
|
|
|
// 并行调用两个不同的风险检测API
|
|
|
|
|
|
wg.Add(1)
|
|
|
|
|
|
|
|
|
|
|
|
// 反赌反诈
|
|
|
|
|
|
go func() {
|
|
|
|
|
|
defer wg.Done()
|
|
|
|
|
|
respBytes, err := a.ProcessFLXG0687Request(params)
|
|
|
|
|
|
results <- apiResult{name: "anti_fraud_gaming", data: respBytes, err: err}
|
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
|
|
// 关闭结果通道
|
|
|
|
|
|
go func() {
|
|
|
|
|
|
wg.Wait()
|
|
|
|
|
|
close(results)
|
|
|
|
|
|
}()
|
|
|
|
|
|
|
|
|
|
|
|
// 收集所有结果
|
|
|
|
|
|
resultMap := make(map[string]interface{})
|
|
|
|
|
|
var errors []string
|
|
|
|
|
|
|
|
|
|
|
|
for result := range results {
|
|
|
|
|
|
if result.err != nil {
|
|
|
|
|
|
// 记录错误但继续处理其他结果
|
|
|
|
|
|
errors = append(errors, fmt.Sprintf("%s: %v", result.name, result.err))
|
|
|
|
|
|
continue
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 解析JSON结果并添加到结果映射
|
|
|
|
|
|
var parsedData interface{}
|
|
|
|
|
|
if err := json.Unmarshal(result.data, &parsedData); err != nil {
|
|
|
|
|
|
errors = append(errors, fmt.Sprintf("解析%s数据失败: %v", result.name, err))
|
|
|
|
|
|
} else {
|
|
|
|
|
|
resultMap[result.name] = parsedData
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 添加错误信息到结果中(如果存在)
|
|
|
|
|
|
if len(errors) > 0 {
|
|
|
|
|
|
resultMap["errors"] = errors
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 序列化最终结果
|
|
|
|
|
|
finalResult, err := json.Marshal(resultMap)
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, fmt.Errorf("序列化行为风险扫描结果失败: %v", err)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return finalResult, nil
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessDWBG8B4DRequest 谛听多维报告
|
|
|
|
|
|
func (a *ApiRequestService) ProcessDWBG8B4DRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
name := gjson.GetBytes(params, "name")
|
|
|
|
|
|
idCard := gjson.GetBytes(params, "id_card")
|
|
|
|
|
|
mobile := gjson.GetBytes(params, "mobile")
|
|
|
|
|
|
AuthorizationURL := gjson.GetBytes(params, "authorization_url")
|
|
|
|
|
|
if !name.Exists() || !idCard.Exists() || !mobile.Exists() || !AuthorizationURL.Exists() {
|
|
|
|
|
|
return nil, errors.New("api请求, DWBG8B4D, 获取相关参数失败")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("DWBG8B4D", map[string]interface{}{
|
|
|
|
|
|
"name": name.String(),
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
"mobile_no": mobile.String(),
|
|
|
|
|
|
"authorization_url": AuthorizationURL.String(),
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 直接返回解密后的数据,而不是再次进行JSON编码
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessDWBG6A2CRequest 司南报告服务
|
|
|
|
|
|
func (a *ApiRequestService) ProcessDWBG6A2CRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
name := gjson.GetBytes(params, "name")
|
|
|
|
|
|
idCard := gjson.GetBytes(params, "id_card")
|
|
|
|
|
|
mobile := gjson.GetBytes(params, "mobile")
|
|
|
|
|
|
AuthorizationURL := gjson.GetBytes(params, "authorization_url")
|
|
|
|
|
|
if !name.Exists() || !idCard.Exists() || !mobile.Exists() || !AuthorizationURL.Exists() {
|
|
|
|
|
|
return nil, errors.New("api请求, DWBG6A2C, 获取相关参数失败")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("DWBG6A2C", map[string]interface{}{
|
|
|
|
|
|
"name": name.String(),
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
"mobile_no": mobile.String(),
|
|
|
|
|
|
"authorization_url": AuthorizationURL.String(),
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 直接返回解密后的数据,而不是再次进行JSON编码
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessJRZQ4B6CRequest 探针C风险评估
|
|
|
|
|
|
func (a *ApiRequestService) ProcessJRZQ4B6CRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
name := gjson.GetBytes(params, "name")
|
|
|
|
|
|
idCard := gjson.GetBytes(params, "id_card")
|
|
|
|
|
|
mobile := gjson.GetBytes(params, "mobile")
|
|
|
|
|
|
if !name.Exists() || !idCard.Exists() || !mobile.Exists() {
|
|
|
|
|
|
return nil, errors.New("api请求, JRZQ4B6C, 获取相关参数失败")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("JRZQ4B6C", map[string]interface{}{
|
|
|
|
|
|
"name": name.String(),
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
"mobile_no": mobile.String(),
|
|
|
|
|
|
"authorized": "1",
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 直接返回解密后的数据,而不是再次进行JSON编码
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessJRZQ09J8Request 收入评估
|
|
|
|
|
|
func (a *ApiRequestService) ProcessJRZQ09J8Request(params []byte) ([]byte, error) {
|
|
|
|
|
|
name := gjson.GetBytes(params, "name")
|
|
|
|
|
|
idCard := gjson.GetBytes(params, "id_card")
|
|
|
|
|
|
mobile := gjson.GetBytes(params, "mobile")
|
|
|
|
|
|
if !name.Exists() || !idCard.Exists() || !mobile.Exists() {
|
|
|
|
|
|
return nil, errors.New("api请求, JRZQ09J8, 获取相关参数失败")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("JRZQ09J8", map[string]interface{}{
|
|
|
|
|
|
"name": name.String(),
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
"mobile_no": mobile.String(),
|
|
|
|
|
|
"authorized": "1",
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 直接返回解密后的数据,而不是再次进行JSON编码
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessJRZQ5E9FRequest 借选指数
|
|
|
|
|
|
func (a *ApiRequestService) ProcessJRZQ5E9FRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
name := gjson.GetBytes(params, "name")
|
|
|
|
|
|
idCard := gjson.GetBytes(params, "id_card")
|
|
|
|
|
|
mobile := gjson.GetBytes(params, "mobile")
|
|
|
|
|
|
if !name.Exists() || !idCard.Exists() || !mobile.Exists() {
|
|
|
|
|
|
return nil, errors.New("api请求, JRZQ5E9F, 获取相关参数失败")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("JRZQ5E9F", map[string]interface{}{
|
|
|
|
|
|
"name": name.String(),
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
"mobile_no": mobile.String(),
|
|
|
|
|
|
"authorized": "1",
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 直接返回解密后的数据,而不是再次进行JSON编码
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessQYGL3F8ERequest 人企关系加强版2
|
|
|
|
|
|
func (a *ApiRequestService) ProcessQYGL3F8ERequest(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{}{
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 直接返回解密后的数据,而不是再次进行JSON编码
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessIVYZ81NCRequest 婚姻,登记时间版
|
|
|
|
|
|
func (a *ApiRequestService) ProcessIVYZ81NCRequest(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{}{
|
|
|
|
|
|
"name": name.String(),
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 直接返回解密后的数据,而不是再次进行JSON编码
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessIVYZ7F3ARequest 学历查询版B
|
|
|
|
|
|
func (a *ApiRequestService) ProcessIVYZ7F3ARequest(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{}{
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
"name": name.String(),
|
|
|
|
|
|
"authorized": "1",
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 直接返回解密后的数据,而不是再次进行JSON编码
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessIVYZ3P9MRequest 学历实时查询
|
|
|
|
|
|
func (a *ApiRequestService) ProcessIVYZ3P9MRequest(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{}{
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
"name": name.String(),
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// ProcessFLXG7E8FRequest 个人涉诉
|
|
|
|
|
|
func (a *ApiRequestService) ProcessFLXG7E8FRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
idCard := gjson.GetBytes(params, "id_card")
|
|
|
|
|
|
name := gjson.GetBytes(params, "name")
|
|
|
|
|
|
mobile := gjson.GetBytes(params, "mobile")
|
|
|
|
|
|
if !idCard.Exists() || !name.Exists() || !mobile.Exists() {
|
|
|
|
|
|
return nil, errors.New("api请求, FLXG7E8F, 获取相关参数失败")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("FLXG7E8F", map[string]interface{}{
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
"name": name.String(),
|
|
|
|
|
|
"mobile_no": mobile.String(),
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|
2026-01-22 16:32:01 +08:00
|
|
|
|
|
|
|
|
|
|
// ProcessQCXG9P1CFRequest 名下车辆
|
|
|
|
|
|
func (a *ApiRequestService) ProcessQCXG9P1CFRequest(params []byte) ([]byte, error) {
|
|
|
|
|
|
idCard := gjson.GetBytes(params, "id_card")
|
|
|
|
|
|
name := gjson.GetBytes(params, "name")
|
|
|
|
|
|
mobile := gjson.GetBytes(params, "mobile")
|
|
|
|
|
|
if !idCard.Exists() || !name.Exists() || !mobile.Exists() {
|
|
|
|
|
|
return nil, errors.New("api请求, QCXG9P1C, 获取相关参数失败")
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
resp, err := a.tianyuanapi.CallInterface("QCXG9P1C", map[string]interface{}{
|
|
|
|
|
|
"id_card": idCard.String(),
|
|
|
|
|
|
"authorized": "1",
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
return nil, err
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return convertTianyuanResponse(resp)
|
|
|
|
|
|
}
|