This commit is contained in:
2026-04-27 18:14:07 +08:00
parent fcbd534b57
commit 20b63bde0c

View File

@@ -23,29 +23,18 @@ func ProcessJRZQ0L85Request(ctx context.Context, params []byte, deps *processors
return nil, errors.Join(processors.ErrInvalidParam, err) return nil, errors.Join(processors.ErrInvalidParam, err)
} }
encryptedName, err := deps.ZhichaService.Encrypt(paramsDto.Name) md5Name := deps.ZhichaService.MD5(paramsDto.Name)
if err != nil { md5IDCard := deps.ZhichaService.MD5(paramsDto.IDCard)
return nil, errors.Join(processors.ErrSystem, err) md5MobileNo := deps.ZhichaService.MD5(paramsDto.MobileNo)
}
encryptedIDCard, err := deps.ZhichaService.Encrypt(paramsDto.IDCard)
if err != nil {
return nil, errors.Join(processors.ErrSystem, err)
}
encryptedMobileNo, err := deps.ZhichaService.Encrypt(paramsDto.MobileNo)
if err != nil {
return nil, errors.Join(processors.ErrSystem, err)
}
reqData := map[string]interface{}{ reqData := map[string]interface{}{
"name": encryptedName, "name": md5Name,
"idCard": encryptedIDCard, "idCard": md5IDCard,
"phone": encryptedMobileNo, "phone": md5MobileNo,
"authorized": "1", "authorized": "1",
} }
respData, err := deps.ZhichaService.CallAPI(ctx, "ZCI021", reqData) respData, err := deps.ZhichaService.CallAPI(ctx, "ZCI084", reqData)
if err != nil { if err != nil {
if errors.Is(err, zhicha.ErrDatasource) { if errors.Is(err, zhicha.ErrDatasource) {
return nil, errors.Join(processors.ErrDatasource, err) return nil, errors.Join(processors.ErrDatasource, err)
@@ -56,9 +45,9 @@ func ProcessJRZQ0L85Request(ctx context.Context, params []byte, deps *processors
score := "-1" score := "-1"
if m, ok := respData.(map[string]interface{}); ok { if m, ok := respData.(map[string]interface{}); ok {
if raw, exists := m["xyp_cpl0081"]; exists { if raw, exists := m["scoreafywbase"]; exists {
if v, ok := parseToFloat64(raw); ok { if v, ok := parseToFloat64(raw); ok {
score = mapXypToGeneralScore(v) score = mapScoreAfywBaseToGeneralScore(v)
} }
} }
} }
@@ -99,17 +88,18 @@ func parseToFloat64(v interface{}) (float64, bool) {
} }
} }
func mapXypToGeneralScore(xyp float64) string { func mapScoreAfywBaseToGeneralScore(scoreAfywBase float64) string {
// xyp_cpl0081: 0~1值越大风险越高 // scoreafywbase: 300~1000分值越高违约概率越低。
// score_120_General: 300~900值越信用越好。 // score_120_General: 300~900值越信用越好。
if xyp < 0 { if scoreAfywBase < 300 {
xyp = 0 scoreAfywBase = 300
} }
if xyp > 1 { if scoreAfywBase > 1000 {
xyp = 1 scoreAfywBase = 1000
} }
score := 900 - xyp*600 // 线性映射300->300, 1000->900
score := 300 + (scoreAfywBase-300)*600/700
scoreInt := int(math.Round(score)) scoreInt := int(math.Round(score))
if scoreInt < 300 { if scoreInt < 300 {
scoreInt = 300 scoreInt = 300