f
This commit is contained in:
@@ -1,13 +1,13 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"bdqr-server/app/main/api/internal/config"
|
||||
tianyuanapi "bdqr-server/app/main/api/internal/service/tianyuanapi_sdk"
|
||||
"bdqr-server/app/main/model"
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"bdqr-server/app/main/api/internal/config"
|
||||
tianyuanapi "bdqr-server/app/main/api/internal/service/tianyuanapi_sdk"
|
||||
"bdqr-server/app/main/model"
|
||||
"sort"
|
||||
"strings"
|
||||
"sync"
|
||||
@@ -61,23 +61,23 @@ type APIResponseData struct {
|
||||
func (a *ApiRequestService) ProcessRequests(params []byte, productID string) ([]byte, error) {
|
||||
var ctx, cancel = context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
build := a.productFeatureModel.SelectBuilder().Where(squirrel.Eq{
|
||||
"product_id": productID,
|
||||
})
|
||||
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 []string
|
||||
isImportantMap := make(map[string]int64, len(productFeatureList))
|
||||
var featureIDs []string
|
||||
isImportantMap := make(map[string]int64, len(productFeatureList))
|
||||
for _, pf := range productFeatureList {
|
||||
featureIDs = append(featureIDs, pf.FeatureId)
|
||||
isImportantMap[pf.FeatureId] = pf.IsImportant
|
||||
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})
|
||||
builder := a.featureModel.SelectBuilder().Where(squirrel.Eq{"id": featureIDs})
|
||||
featureList, findFeatureErr := a.featureModel.FindAll(ctx, builder, "")
|
||||
if findFeatureErr != nil {
|
||||
return nil, findFeatureErr
|
||||
@@ -114,7 +114,7 @@ func (a *ApiRequestService) ProcessRequests(params []byte, productID string) ([]
|
||||
preprocessErr error
|
||||
)
|
||||
// 若 isImportantMap[feature.ID] == 1,则表示需要在出错时重试
|
||||
isImportant := isImportantMap[feature.Id] == 1
|
||||
isImportant := isImportantMap[feature.Id] == 1
|
||||
tryCount := 0
|
||||
for {
|
||||
tryCount++
|
||||
@@ -1577,3 +1577,25 @@ func (a *ApiRequestService) ProcessIVYZ3P9MRequest(params []byte) ([]byte, error
|
||||
|
||||
return convertTianyuanResponse(resp)
|
||||
}
|
||||
|
||||
// ProcessJRZQ6F2ARequest 借贷申请
|
||||
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")
|
||||
if !name.Exists() || !idCard.Exists() || !mobile.Exists() {
|
||||
return nil, errors.New("api请求, JRZQ6F2A, 获取相关参数失败")
|
||||
}
|
||||
|
||||
resp, err := a.tianyuanapi.CallInterface("JRZQ6F2A", map[string]interface{}{
|
||||
"name": name.String(),
|
||||
"id_card": idCard.String(),
|
||||
"mobile_no": mobile.String(),
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return convertTianyuanResponse(resp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user