This commit is contained in:
Mrx
2026-05-29 12:48:14 +08:00
parent a1601b34a1
commit 49e17e4ab1
3 changed files with 30 additions and 4 deletions

View File

@@ -17,6 +17,26 @@ import (
const defaultRequestTimeout = 4 * time.Second
// queryBillingAPIKeys 查询计费接口:数据未查得(busiCode=1000)仍按成功计费,返回空数据
var queryBillingAPIKeys = map[string]struct{}{
"idRiskTagV106": {}, // 身份风险V106
"personalLawsuit_cv2": {}, // 企业诉讼定制版
"personalLawsuit_cv1": {}, // 个人诉讼定制版
"loanRiskTagV11": {}, // 借贷意向查询
"loanRiskTagV5": {}, // 风险变量V5
"loanRiskTagV12": {}, // 特殊名单
"blackListV121_3_1": {}, // 债务逾期黑名单V3_1
"blackListV110": {}, // 特殊名单V110
"zhiTongModelG": {}, // 智瞳-通用版
"zhitong_ultra_v4_score": {}, // 智瞳分尊享版
"zhixiangScore": {}, // 智享分
}
func isQueryBillingAPIKey(apiKey string) bool {
_, ok := queryBillingAPIKeys[apiKey]
return ok
}
// nuoerResponse 诺尔智汇通用响应
type nuoerResponse struct {
Code int `json:"code"`
@@ -153,6 +173,10 @@ func (s *NuoerService) CallAPI(ctx context.Context, apiKey, apiPath string, body
}
if nuoerResp.Code != CodeSuccess {
if nuoerResp.Code == BusiCodeNotFound && isQueryBillingAPIKey(apiKey) {
nuoerResp.Data = map[string]interface{}{}
return &nuoerResp, nil
}
nuoerErr := NewNuoerError(nuoerResp.Code, nuoerResp.Msg)
err = errors.Join(GetErrByPlatformCode(nuoerResp.Code), nuoerErr)
if s.logger != nil {
@@ -179,6 +203,10 @@ func (s *NuoerService) CallAPI(ctx context.Context, apiKey, apiPath string, body
}
if busiCode != BusiCodeSuccess {
if busiCode == BusiCodeNotFound && isQueryBillingAPIKey(apiKey) {
nuoerResp.Data = map[string]interface{}{}
return &nuoerResp, nil
}
busiErr := NewNuoerBusiError(busiCode, busiMsg)
err = errors.Join(GetErrByBusiCode(busiCode), busiErr)
if s.logger != nil {