f
This commit is contained in:
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
"tyapi-server/internal/domains/api/dto"
|
||||
"tyapi-server/internal/domains/api/services/processors"
|
||||
"tyapi-server/internal/infrastructure/external/zhicha"
|
||||
"tyapi-server/internal/infrastructure/external/nuoer"
|
||||
)
|
||||
|
||||
// ProcessIVYZRAX2Request IVYZRAX2 API处理方法 - 融御反欺诈分
|
||||
@@ -21,45 +21,34 @@ func ProcessIVYZRAX2Request(ctx context.Context, params []byte, deps *processors
|
||||
return nil, errors.Join(processors.ErrInvalidParam, err)
|
||||
}
|
||||
|
||||
// encryptedName, err := deps.ZhichaService.Encrypt(paramsDto.Name)
|
||||
// if err != nil {
|
||||
// return nil, errors.Join(processors.ErrSystem, err)
|
||||
// }
|
||||
|
||||
// encryptedIDCard, err := deps.ZhichaService.Encrypt(paramsDto.IDCard)
|
||||
// if err != nil {
|
||||
// return nil, errors.Join(processors.ErrSystem, err)
|
||||
// }
|
||||
// encryptedMoblie, err := deps.ZhichaService.Encrypt(paramsDto.MobileNo)
|
||||
// if err != nil {
|
||||
// return nil, errors.Join(processors.ErrSystem, err)
|
||||
// }
|
||||
|
||||
md5Name := deps.ZhichaService.MD5(paramsDto.Name)
|
||||
md5IDCard := deps.ZhichaService.MD5(paramsDto.IDCard)
|
||||
md5Mobile := deps.ZhichaService.MD5(paramsDto.MobileNo)
|
||||
|
||||
reqData := map[string]interface{}{
|
||||
// "name": encryptedName,
|
||||
// "idCard": encryptedIDCard,
|
||||
// "phone": encryptedMoblie,
|
||||
"authorized": paramsDto.Authorized,
|
||||
"name": md5Name,
|
||||
"idCard": md5IDCard,
|
||||
"phone": md5Mobile,
|
||||
body := map[string]string{
|
||||
"name": paramsDto.Name,
|
||||
"idCard": paramsDto.IDCard,
|
||||
"mobile": paramsDto.MobileNo,
|
||||
}
|
||||
|
||||
respData, err := deps.ZhichaService.CallAPI(ctx, "ZCI083", reqData)
|
||||
nuoerDoCheckAPIKey := "kunyu_fix_v3_tg_model"
|
||||
ApiPath := "/v1/doCheck"
|
||||
|
||||
resp, err := deps.NuoerService.CallAPI(ctx, nuoerDoCheckAPIKey, ApiPath, body)
|
||||
if err != nil {
|
||||
if errors.Is(err, zhicha.ErrDatasource) {
|
||||
if errors.Is(err, nuoer.ErrDatasource) {
|
||||
return nil, errors.Join(processors.ErrDatasource, err)
|
||||
} else {
|
||||
}
|
||||
if errors.Is(err, nuoer.ErrNotFound) {
|
||||
return nil, errors.Join(processors.ErrNotFound, err)
|
||||
}
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
rawData, ok := resp.Data.(map[string]interface{})
|
||||
if !ok {
|
||||
return nil, errors.Join(processors.ErrSystem, errors.New("响应格式错误"))
|
||||
}
|
||||
|
||||
// 将响应数据转换为JSON字节
|
||||
respBytes, err := json.Marshal(respData)
|
||||
result := mapNuoerKunyuFixToResponse(rawData)
|
||||
|
||||
respBytes, err := json.Marshal(result)
|
||||
if err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
package ivyz
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// mapNuoerKunyuFixToResponse 将 nuoer 响应(2json.md)转为对外结构(1json.md):
|
||||
// 解包 result,将 score 映射为 scoreafywbase。
|
||||
func mapNuoerKunyuFixToResponse(data map[string]interface{}) map[string]interface{} {
|
||||
score := ""
|
||||
if data != nil {
|
||||
payload := data
|
||||
if result, ok := data["result"].(map[string]interface{}); ok {
|
||||
payload = result
|
||||
}
|
||||
if raw, ok := payload["score"]; ok && raw != nil {
|
||||
score = stringifyKunyuFixScore(raw)
|
||||
}
|
||||
}
|
||||
return map[string]interface{}{
|
||||
"scoreafywbase": score,
|
||||
}
|
||||
}
|
||||
|
||||
func stringifyKunyuFixScore(v interface{}) string {
|
||||
if v == nil {
|
||||
return ""
|
||||
}
|
||||
switch val := v.(type) {
|
||||
case string:
|
||||
return val
|
||||
case float64:
|
||||
if val == float64(int64(val)) {
|
||||
return strconv.FormatInt(int64(val), 10)
|
||||
}
|
||||
return strconv.FormatFloat(val, 'f', -1, 64)
|
||||
case int:
|
||||
return strconv.Itoa(val)
|
||||
case int64:
|
||||
return strconv.FormatInt(val, 10)
|
||||
default:
|
||||
return fmt.Sprint(val)
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,120 +1,17 @@
|
||||
```
|
||||
## 响应示例
|
||||
|
||||
### 成功响应
|
||||
|
||||
```json
|
||||
{
|
||||
"datalist": [
|
||||
{
|
||||
"orgName": "南阳市宛城区张明健康服务中心",
|
||||
"pName": "张明",
|
||||
"relationship": [
|
||||
"lp"
|
||||
],
|
||||
"basicInfo": {
|
||||
"regStatus": "在营(开业)企业",
|
||||
"regCapital": "10.0万元人民币",
|
||||
"reccap": 0,
|
||||
"city": "南阳市",
|
||||
"industry_code": "O",
|
||||
"industry": "居民服务业",
|
||||
"type": "1",
|
||||
"nic_code": "O805",
|
||||
"legalPersonName": "张明",
|
||||
"regNumber": "411302601209908",
|
||||
"creditCode": "92411302MA3P3WW37Y",
|
||||
"province": "河南省",
|
||||
"regorg": "南阳市宛城区市场监督管理局",
|
||||
"companyOrgType": "个体",
|
||||
"tel": "",
|
||||
"revdate": "",
|
||||
"estiblishTime": "2019-01-28",
|
||||
"opscope": "",
|
||||
"reccapcur": "人民币",
|
||||
"regCapitalCurrency": "人民币",
|
||||
"nic_name": "居民服务、修理和其他服务业-居民服务业-洗浴和保健养生服务",
|
||||
"candate": "",
|
||||
"district": "宛城区",
|
||||
"name": "南阳市宛城区张明健康服务中心",
|
||||
"base": "hn",
|
||||
"apprdate": "2019-01-28"
|
||||
}
|
||||
},
|
||||
{
|
||||
"orgName": "南阳市宛城区宇旺日用品厂",
|
||||
"pName": "张明",
|
||||
"relationship": [
|
||||
"lp"
|
||||
],
|
||||
"basicInfo": {
|
||||
"regStatus": "已吊销",
|
||||
"regCapital": "8.0万元人民币",
|
||||
"reccap": 0,
|
||||
"city": "南阳市",
|
||||
"industry_code": "C",
|
||||
"industry": "化学原料和化学制品制造业",
|
||||
"type": "1",
|
||||
"nic_code": "C2681",
|
||||
"legalPersonName": "张明",
|
||||
"regNumber": "411302600394898",
|
||||
"creditCode": "",
|
||||
"province": "河南省",
|
||||
"regorg": "南阳市宛城区市场监督管理局",
|
||||
"companyOrgType": "个体",
|
||||
"tel": "",
|
||||
"revdate": "2011-01-14",
|
||||
"estiblishTime": "2008-05-27",
|
||||
"opscope": "",
|
||||
"reccapcur": "人民币",
|
||||
"regCapitalCurrency": "人民币",
|
||||
"nic_name": "制造业-化学原料和化学制品制造业-日用化学产品制造-肥皂及洗涤剂制造",
|
||||
"candate": "",
|
||||
"district": "宛城区",
|
||||
"name": "南阳市宛城区宇旺日用品厂",
|
||||
"base": "hn",
|
||||
"apprdate": "2008-05-27"
|
||||
}
|
||||
},
|
||||
{
|
||||
"orgName": "南阳市信和工程有限公司",
|
||||
"pName": "张明",
|
||||
"stockHolderItem": {
|
||||
"orgHolderType": "自然人",
|
||||
"investDate": "2011-12-19",
|
||||
"investRate": "10.0%",
|
||||
"subscriptAmt": 10,
|
||||
"orgHolderName": "张明"
|
||||
},
|
||||
"relationship": [
|
||||
"sh",
|
||||
"lp",
|
||||
"tm"
|
||||
],
|
||||
"basicInfo": {
|
||||
"regStatus": "注销企业",
|
||||
"regCapital": "100.000000万人民币",
|
||||
"reccap": 0,
|
||||
"city": "南阳市",
|
||||
"industry_code": "E",
|
||||
"industry": "建筑安装业",
|
||||
"type": "1",
|
||||
"nic_code": "E499",
|
||||
"legalPersonName": "张明",
|
||||
"regNumber": "411327200008561",
|
||||
"creditCode": "91411300MA9312Y112",
|
||||
"province": "河南省",
|
||||
"regorg": "南阳市高新技术开发区市场监督管理局",
|
||||
"companyOrgType": "有限责任公司(自然人投资或控股)",
|
||||
"tel": "",
|
||||
"revdate": "",
|
||||
"estiblishTime": "2012-01-04",
|
||||
"opscope": "通讯设备安装维护;电气设备安装维护;通信及电气工程施工。(不含无线电发射及卫星接收设备。需许可经营的,须凭许可证经营)(依法须经批准的项目,经相关部门批准后方可开展经营活动)。",
|
||||
"reccapcur": "人民币",
|
||||
"regCapitalCurrency": "人民币",
|
||||
"nic_name": "建筑业-建筑安装业-其他建筑安装业",
|
||||
"candate": "2015-08-31",
|
||||
"district": "宛城区",
|
||||
"name": "南阳市信和工程有限公司",
|
||||
"base": "hn",
|
||||
"apprdate": "2015-08-31"
|
||||
}
|
||||
}
|
||||
]
|
||||
"currently_overdue": "2",
|
||||
"max_overdue_amt": "1-1000",
|
||||
"acc_sleep": "14",
|
||||
"currently_performance": "12",
|
||||
"result_code": "1",
|
||||
"max_overdue_days": "16-30",
|
||||
"latest_overdue_time": "2023-05",
|
||||
"acc_exc": "0"
|
||||
|
||||
}
|
||||
```
|
||||
@@ -1,97 +1,19 @@
|
||||
# 5. 返回参数说明
|
||||
## result.items 整体结构(数组)
|
||||
| 参数名 | 类型 | 说明 |
|
||||
| ---- | ---- | ---- |
|
||||
| total | number | 条数 |
|
||||
| datalist | array | 结果列表 |
|
||||
|
||||
### datalist 子参数
|
||||
# result 参数说明
|
||||
| 参数名 | 类型 | 说明 |
|
||||
| ---- | ---- | ---- |
|
||||
| orgName | string | 查询人对应的企业名 |
|
||||
| pName | string | 查询人名称 |
|
||||
| relationship | array | 查询人与这家企业的关联:sh:股东;lp:法人;tm:高管 |
|
||||
| basicInfo | object | 查询人作为股东所在公司的基本信息 |
|
||||
| stockholder | object | 查询人持股信息 |
|
||||
| adminPenalty | array | 行政处罚 |
|
||||
| executedPerson | array | 被执行人(人员) |
|
||||
| dishonestExecutedPerson | array | 失信被执行人(人员) |
|
||||
| score | Number | 分数区间 0-100,分数越高表明风险越大 |
|
||||
| riskCode | String | 风险码,可选值:21001、21002、11001、11002、11003、11004、11005、12001、12002<br>风险等级:1 低风险、2 中风险、3 高风险 |
|
||||
|
||||
#### basicInfo 企业基本信息(object)
|
||||
| 参数名 | 类型 | 说明 |
|
||||
# riskCode风险标签编码说明
|
||||
| 编码 | 标签名称 | 描述说明 |
|
||||
| ---- | ---- | ---- |
|
||||
| regStatus | string | 企业状态 |
|
||||
| estiblishTime | string | 成立日期(注册日期) |
|
||||
| regCapital | string | 注册资本 |
|
||||
| industry | string | 行业 |
|
||||
| staffList | object | 主要人员 |
|
||||
| regCapitalCurrency | string | 注册资本币种:人民币、美元、欧元等 |
|
||||
| legalPersonName | string | 法人姓名 |
|
||||
| regNumber | string | 注册号 |
|
||||
| creditCode | string | 统一社会信用代码 |
|
||||
| name | string | 企业名 |
|
||||
| companyOrgType | string | 企业类型 |
|
||||
| base | string | 省份简称 |
|
||||
|
||||
##### staffList 主要人员(object)
|
||||
| 参数名 | 类型 | 说明 |
|
||||
| ---- | ---- | ---- |
|
||||
| result | array | 人员列表 |
|
||||
|
||||
###### staffList.result 人员列表(array)
|
||||
| 参数名 | 类型 | 说明 |
|
||||
| ---- | ---- | ---- |
|
||||
| name | string | 名称 |
|
||||
| type | string | 1-公司 2-人 |
|
||||
| typeJoin | array | 职位 |
|
||||
| type | string | 法人类型,1 人 2 公司 |
|
||||
|
||||
#### stockholder 持股信息(object)
|
||||
| 参数名 | 类型 | 说明 |
|
||||
| ---- | ---- | ---- |
|
||||
| orgHolderType | string | 股东类型 |
|
||||
| investDate | string | 出资时间 |
|
||||
| investRate | string | 占比 |
|
||||
| subscriptAmt | string | 出资金额(万元) |
|
||||
| orgHolderName | string | 股东名 |
|
||||
|
||||
#### adminPenalty 行政处罚(array)
|
||||
| 参数名 | 类型 | 说明 |
|
||||
| ---- | ---- | ---- |
|
||||
| departmentName | string | 处罚单位 |
|
||||
| reason | string | 处罚事由/违法行为类型 |
|
||||
| punishNumber | string | 决定文书号 |
|
||||
| type | string | 处罚类别 |
|
||||
| content | string | 处罚结果/内容 |
|
||||
| decisionDate | string | 处罚日期 |
|
||||
| legalPersonName | string | 法定代表人 |
|
||||
|
||||
#### executedPerson 被执行人(人员)(array)
|
||||
| 参数名 | 类型 | 说明 |
|
||||
| ---- | ---- | ---- |
|
||||
| caseCode | string | 案号 |
|
||||
| partyCardNum | string | 身份证号/组织机构代码 |
|
||||
| pname | string | 被执行人名称 |
|
||||
| caseCreateTime | string | 立案日期 |
|
||||
| execCourtName | string | 执行法院 |
|
||||
| execMoney | string | 执行标的(元) |
|
||||
|
||||
#### dishonestExecutedPerson 失信被执行人(人员)(array)
|
||||
| 参数名 | 类型 | 说明 |
|
||||
| ---- | ---- | ---- |
|
||||
| businessentity | string | 法人、负责人姓名 |
|
||||
| areaname | string | 省份地区 |
|
||||
| courtname | string | 法院 |
|
||||
| unperformPart | string | 未履行部分 |
|
||||
| type | string | 失信人类型,0代表人,1代表公司 |
|
||||
| performedPart | string | 已履行部分 |
|
||||
| iname | string | 失信人名称 |
|
||||
| disrupttypename | string | 失信被执行人行为具体情形 |
|
||||
| casecode | string | 案号 |
|
||||
| cardnum | string | 身份证号码/组织机构代码 |
|
||||
| performance | string | 履行情况 |
|
||||
| regdate | string | 立案时间 |
|
||||
| duty | string | 生效法律文书确定的义务 |
|
||||
| gistunit | string | 做出执行的依据单位 |
|
||||
| publishdate | string | 发布时间 |
|
||||
| gistid | string | 执行依据文号 |
|
||||
| 21001 | 疑似恶意借贷 | 恶意多方借贷、以贷养贷、蓄意制造借贷纠纷等违规行为 |
|
||||
| 21002 | 疑似职业撸口子 | 职业从事网络贷款撸口子,无还款意愿的恶意行为 |
|
||||
| 11001 | 疑似涉黑涉赌 | 涉嫌参与传销、在线赌博等违法行为 |
|
||||
| 11002 | 疑似网络投机 | 参与在线外汇、虚拟币、石油贵金属等风险投机行为 |
|
||||
| 11003 | 疑似营销欺诈 | 在网络平台运营活动中,组团薅羊毛、套利等违规行为 |
|
||||
| 11004 | 疑似黑中介包装 | 中介包装伪造冒用资料、黑产中介圈团成员、老赖反催收等 |
|
||||
| 11005 | 疑似恶意套现 | 信用卡恶意套现、第三方平台消费分期套现等违规行为 |
|
||||
| 12001 | 疑似黑产设备 | 存在模拟器、多开、群控、代理等作弊行为的黑产设备 |
|
||||
| 12002 | 疑似黑产账号 | 疑似黑产组织非法包装的手机号、身份证、支付等账号 |
|
||||
@@ -1,81 +1,14 @@
|
||||
{
|
||||
"result": {
|
||||
"total": 2,
|
||||
"datalist": [
|
||||
{
|
||||
"pName": "张三",
|
||||
"fsource": "1",
|
||||
"orgName": "****科技(杭州)有限公司",
|
||||
"basicInfo": {
|
||||
"dom": "浙江省杭州市余杭区************室",
|
||||
"tel": "",
|
||||
"base": "zj",
|
||||
"city": "杭州市",
|
||||
"name": "****科技(杭州)有限公司",
|
||||
"opto": "9999-09-09",
|
||||
"type": "1",
|
||||
"email": "",
|
||||
"taxid": "913**********EU3M",
|
||||
"empnum": 6,
|
||||
"opfrom": "2021-09-23",
|
||||
"reccap": 9.8376,
|
||||
"regcap": 500,
|
||||
"regorg": "杭州市余杭区市场监督管理局",
|
||||
"candate": "",
|
||||
"opscope": "一般项目:技术服务、技术开发、技术咨询、技术交流、技术转让、技术推广;信息系统集成服务;计算机系统服务;信息咨询服务(不含许可类信息咨询服务);专业设计服务;社会经济咨询服务;信息技术咨询服务;企业管理咨询;数据处理和存储支持服务;数字内容制作服务(不含出版发行);互联网销售(除销售需要许可的商品);计算机软硬件及辅助设备批发;计算机软硬件及辅助设备零售;国内贸易代理;电子产品销售;通讯设备销售;广告发布;广告设计、代理;广告制作;工程和技术研究和试验发展;市场调查(不含涉外调查);劳务服务(不含劳务派遣);信息系统运行维护服务;大数据服务(除依法须经批准的项目外,凭营业执照依法自主开展经营活动)。",
|
||||
"revdate": "",
|
||||
"apprdate": "2023-07-25",
|
||||
"district": "余杭区",
|
||||
"industry": "软件和信息技术服务业",
|
||||
"isListed": "0",
|
||||
"nic_code": "I6511",
|
||||
"nic_name": "信息传输、软件和信息技术服务业-软件和信息技术服务业-软件开发-应用软件开发",
|
||||
"province": "浙江省",
|
||||
"reccapcur": "人民币",
|
||||
"regNumber": "330106*******258",
|
||||
"regStatus": "存续",
|
||||
"staffList": {},
|
||||
"tax_level": "",
|
||||
"creditCode": "913**********EU3M",
|
||||
"regCapital": "500.000000万人民币",
|
||||
"estiblishTime": "2021-09-23",
|
||||
"his_staffList": {
|
||||
"result": [
|
||||
{
|
||||
"name": "张三",
|
||||
"type": "2",
|
||||
"typeJoin": [
|
||||
"监事"
|
||||
],
|
||||
"isLerepsign": 0
|
||||
}
|
||||
]
|
||||
"acc_exc": "0",
|
||||
"acc_sleep": "14",
|
||||
"result_code": "1",
|
||||
"max_overdue_amt": "1-1000",
|
||||
"max_overdue_days": "16-30",
|
||||
"currently_overdue": "2",
|
||||
"latest_overdue_time": "2023-05",
|
||||
"currently_performance": "12"
|
||||
},
|
||||
"industry_code": "I",
|
||||
"companyOrgType": "有限责任公司(自然人独资)",
|
||||
"legalPersonName": "李四",
|
||||
"companyOrgTypeCode": "1151",
|
||||
"regCapitalCurrency": "人民币"
|
||||
},
|
||||
"adminPenalty": [],
|
||||
"relationship": [
|
||||
"his_sh",
|
||||
"his_tm"
|
||||
],
|
||||
"executedPerson": [],
|
||||
"stockHolderItem": {},
|
||||
"his_stockHolderItem": {
|
||||
"acconam": "",
|
||||
"confrom": "",
|
||||
"currency": "人民币",
|
||||
"investDate": "2023-05-15",
|
||||
"investRate": "",
|
||||
"subscriptAmt": "",
|
||||
"orgHolderName": "张三",
|
||||
"orgHolderType": "自然人"
|
||||
},
|
||||
"dishonestExecutedPerson": []
|
||||
}
|
||||
]
|
||||
}
|
||||
"busiMsg": "success",
|
||||
"busiCode": 10
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
"tyapi-server/internal/domains/api/dto"
|
||||
"tyapi-server/internal/domains/api/services/processors"
|
||||
"tyapi-server/internal/infrastructure/external/zhicha"
|
||||
"tyapi-server/internal/infrastructure/external/nuoer"
|
||||
)
|
||||
|
||||
// ProcessJRZQ1D09Request JRZQ1D09 API处理方法
|
||||
@@ -21,39 +21,34 @@ func ProcessJRZQ1D09Request(ctx context.Context, params []byte, deps *processors
|
||||
return nil, errors.Join(processors.ErrInvalidParam, err)
|
||||
}
|
||||
|
||||
encryptedName, err := deps.ZhichaService.Encrypt(paramsDto.Name)
|
||||
if err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
body := map[string]string{
|
||||
"name": paramsDto.Name,
|
||||
"idCard": paramsDto.IDCard,
|
||||
"mobile": paramsDto.MobileNo,
|
||||
}
|
||||
|
||||
encryptedIDCard, err := deps.ZhichaService.Encrypt(paramsDto.IDCard)
|
||||
if err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
nuoerDoCheckAPIKey := "loanRiskTagV18"
|
||||
ApiPath := "/v1/doCheck"
|
||||
|
||||
encryptedMobileNo, err := deps.ZhichaService.Encrypt(paramsDto.MobileNo)
|
||||
resp, err := deps.NuoerService.CallAPI(ctx, nuoerDoCheckAPIKey, ApiPath, body)
|
||||
if err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
reqData := map[string]interface{}{
|
||||
"name": encryptedName,
|
||||
"idCard": encryptedIDCard,
|
||||
"phone": encryptedMobileNo,
|
||||
"authorized": paramsDto.Authorized,
|
||||
}
|
||||
|
||||
respData, err := deps.ZhichaService.CallAPI(ctx, "ZCI020", reqData)
|
||||
if err != nil {
|
||||
if errors.Is(err, zhicha.ErrDatasource) {
|
||||
if errors.Is(err, nuoer.ErrDatasource) {
|
||||
return nil, errors.Join(processors.ErrDatasource, err)
|
||||
} else {
|
||||
}
|
||||
if errors.Is(err, nuoer.ErrNotFound) {
|
||||
return nil, errors.Join(processors.ErrNotFound, err)
|
||||
}
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
rawData, ok := resp.Data.(map[string]interface{})
|
||||
if !ok {
|
||||
return nil, errors.Join(processors.ErrSystem, errors.New("响应格式错误"))
|
||||
}
|
||||
|
||||
// 将响应数据转换为JSON字节
|
||||
respBytes, err := json.Marshal(respData)
|
||||
result := mapNuoerLoanRiskTagV18ToResponse(rawData)
|
||||
|
||||
respBytes, err := json.Marshal(result)
|
||||
if err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package jrzq
|
||||
|
||||
// mapNuoerLoanRiskTagV18ToResponse 将 nuoer data 转为 JRZQ1D09 对外结构:
|
||||
// 解包 result,score/reason/contents 原样透传。
|
||||
func mapNuoerLoanRiskTagV18ToResponse(data map[string]interface{}) map[string]interface{} {
|
||||
if data == nil {
|
||||
return map[string]interface{}{}
|
||||
}
|
||||
if result, ok := data["result"].(map[string]interface{}); ok {
|
||||
return result
|
||||
}
|
||||
return data
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
"tyapi-server/internal/domains/api/dto"
|
||||
"tyapi-server/internal/domains/api/services/processors"
|
||||
"tyapi-server/internal/infrastructure/external/zhicha"
|
||||
"tyapi-server/internal/infrastructure/external/nuoer"
|
||||
)
|
||||
|
||||
// ProcessJRZQ2F8ARequest JRZQ2F8A API处理方法 - 探针A
|
||||
@@ -21,39 +21,34 @@ func ProcessJRZQ2F8ARequest(ctx context.Context, params []byte, deps *processors
|
||||
return nil, errors.Join(processors.ErrInvalidParam, err)
|
||||
}
|
||||
|
||||
encryptedName, err := deps.ZhichaService.Encrypt(paramsDto.Name)
|
||||
if err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
body := map[string]string{
|
||||
"name": paramsDto.Name,
|
||||
"idCard": paramsDto.IDCard,
|
||||
"mobile": paramsDto.MobileNo,
|
||||
}
|
||||
|
||||
encryptedIDCard, err := deps.ZhichaService.Encrypt(paramsDto.IDCard)
|
||||
if err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
nuoerDoCheckAPIKey := "loanRiskTagV9"
|
||||
ApiPath := "/v1/doCheck"
|
||||
|
||||
encryptedMobileNo, err := deps.ZhichaService.Encrypt(paramsDto.MobileNo)
|
||||
resp, err := deps.NuoerService.CallAPI(ctx, nuoerDoCheckAPIKey, ApiPath, body)
|
||||
if err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
reqData := map[string]interface{}{
|
||||
"name": encryptedName,
|
||||
"idCard": encryptedIDCard,
|
||||
"phone": encryptedMobileNo,
|
||||
"authorized": paramsDto.Authorized,
|
||||
}
|
||||
|
||||
respData, err := deps.ZhichaService.CallAPI(ctx, "ZCI009", reqData)
|
||||
if err != nil {
|
||||
if errors.Is(err, zhicha.ErrDatasource) {
|
||||
if errors.Is(err, nuoer.ErrDatasource) {
|
||||
return nil, errors.Join(processors.ErrDatasource, err)
|
||||
} else {
|
||||
}
|
||||
if errors.Is(err, nuoer.ErrNotFound) {
|
||||
return nil, errors.Join(processors.ErrNotFound, err)
|
||||
}
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
rawData, ok := resp.Data.(map[string]interface{})
|
||||
if !ok {
|
||||
return nil, errors.Join(processors.ErrSystem, errors.New("响应格式错误"))
|
||||
}
|
||||
|
||||
// 将响应数据转换为 JSON 字节
|
||||
respBytes, err := json.Marshal(respData)
|
||||
result := mapNuoerLoanRiskTagV9ToResponse(rawData)
|
||||
|
||||
respBytes, err := json.Marshal(result)
|
||||
if err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package jrzq
|
||||
|
||||
// mapNuoerLoanRiskTagV9ToResponse 将 nuoer data 转为 JRZQ2F8A 对外结构:
|
||||
// 解包 result,探针字段原样透传。
|
||||
func mapNuoerLoanRiskTagV9ToResponse(data map[string]interface{}) map[string]interface{} {
|
||||
if data == nil {
|
||||
return map[string]interface{}{}
|
||||
}
|
||||
if result, ok := data["result"].(map[string]interface{}); ok {
|
||||
return result
|
||||
}
|
||||
return data
|
||||
}
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
"errors"
|
||||
"tyapi-server/internal/domains/api/dto"
|
||||
"tyapi-server/internal/domains/api/services/processors"
|
||||
"tyapi-server/internal/infrastructure/external/zhicha"
|
||||
"tyapi-server/internal/infrastructure/external/nuoer"
|
||||
)
|
||||
|
||||
// ProcessJRZQ4B6CRequest JRZQ4B6C API处理方法 - 探针C
|
||||
@@ -20,39 +20,34 @@ func ProcessJRZQ4B6CRequest(ctx context.Context, params []byte, deps *processors
|
||||
return nil, errors.Join(processors.ErrInvalidParam, err)
|
||||
}
|
||||
|
||||
encryptedName, err := deps.ZhichaService.Encrypt(paramsDto.Name)
|
||||
if err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
body := map[string]string{
|
||||
"name": paramsDto.Name,
|
||||
"idCard": paramsDto.IDCard,
|
||||
"mobile": paramsDto.MobileNo,
|
||||
}
|
||||
|
||||
encryptedIDCard, err := deps.ZhichaService.Encrypt(paramsDto.IDCard)
|
||||
if err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
nuoerDoCheckAPIKey := "loanRiskTagV10"
|
||||
ApiPath := "/v1/doCheck"
|
||||
|
||||
encryptedMobileNo, err := deps.ZhichaService.Encrypt(paramsDto.MobileNo)
|
||||
resp, err := deps.NuoerService.CallAPI(ctx, nuoerDoCheckAPIKey, ApiPath, body)
|
||||
if err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
reqData := map[string]interface{}{
|
||||
"name": encryptedName,
|
||||
"idCard": encryptedIDCard,
|
||||
"phone": encryptedMobileNo,
|
||||
"authorized": paramsDto.Authorized,
|
||||
}
|
||||
|
||||
respData, err := deps.ZhichaService.CallAPI(ctx, "ZCI023", reqData)
|
||||
if err != nil {
|
||||
if errors.Is(err, zhicha.ErrDatasource) {
|
||||
if errors.Is(err, nuoer.ErrDatasource) {
|
||||
return nil, errors.Join(processors.ErrDatasource, err)
|
||||
} else {
|
||||
}
|
||||
if errors.Is(err, nuoer.ErrNotFound) {
|
||||
return nil, errors.Join(processors.ErrNotFound, err)
|
||||
}
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
rawData, ok := resp.Data.(map[string]interface{})
|
||||
if !ok {
|
||||
return nil, errors.Join(processors.ErrSystem, errors.New("响应格式错误"))
|
||||
}
|
||||
|
||||
// 将响应数据转换为JSON字节
|
||||
respBytes, err := json.Marshal(respData)
|
||||
result := mapNuoerLoanRiskTagV10ToResponse(rawData)
|
||||
|
||||
respBytes, err := json.Marshal(result)
|
||||
if err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package jrzq
|
||||
|
||||
// mapNuoerLoanRiskTagV10ToResponse 将 nuoer data 转为 JRZQ4B6C 对外结构:
|
||||
// 解包 result,内部字段原样透传。
|
||||
func mapNuoerLoanRiskTagV10ToResponse(data map[string]interface{}) map[string]interface{} {
|
||||
if data == nil {
|
||||
return map[string]interface{}{}
|
||||
}
|
||||
if result, ok := data["result"].(map[string]interface{}); ok {
|
||||
return result
|
||||
}
|
||||
return data
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
"tyapi-server/internal/domains/api/dto"
|
||||
"tyapi-server/internal/domains/api/services/processors"
|
||||
"tyapi-server/internal/infrastructure/external/zhicha"
|
||||
"tyapi-server/internal/infrastructure/external/nuoer"
|
||||
)
|
||||
|
||||
// ProcessJRZQ7F1ARequest JRZQ7F1A API处理方法 - 全景雷达V4
|
||||
@@ -21,39 +21,34 @@ func ProcessJRZQ7F1ARequest(ctx context.Context, params []byte, deps *processors
|
||||
return nil, errors.Join(processors.ErrInvalidParam, err)
|
||||
}
|
||||
|
||||
encryptedName, err := deps.ZhichaService.Encrypt(paramsDto.Name)
|
||||
if err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
body := map[string]string{
|
||||
"name": paramsDto.Name,
|
||||
"idCard": paramsDto.IDCard,
|
||||
"mobile": paramsDto.MobileNo,
|
||||
}
|
||||
|
||||
encryptedIDCard, err := deps.ZhichaService.Encrypt(paramsDto.IDCard)
|
||||
if err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
nuoerDoCheckAPIKey := "loanRiskTagV8"
|
||||
ApiPath := "/v1/doCheck"
|
||||
|
||||
encryptedMobileNo, err := deps.ZhichaService.Encrypt(paramsDto.MobileNo)
|
||||
resp, err := deps.NuoerService.CallAPI(ctx, nuoerDoCheckAPIKey, ApiPath, body)
|
||||
if err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
reqData := map[string]interface{}{
|
||||
"name": encryptedName,
|
||||
"idCard": encryptedIDCard,
|
||||
"phone": encryptedMobileNo,
|
||||
"authorized": paramsDto.Authorized,
|
||||
}
|
||||
|
||||
respData, err := deps.ZhichaService.CallAPI(ctx, "ZCI008", reqData)
|
||||
if err != nil {
|
||||
if errors.Is(err, zhicha.ErrDatasource) {
|
||||
if errors.Is(err, nuoer.ErrDatasource) {
|
||||
return nil, errors.Join(processors.ErrDatasource, err)
|
||||
} else {
|
||||
}
|
||||
if errors.Is(err, nuoer.ErrNotFound) {
|
||||
return nil, errors.Join(processors.ErrNotFound, err)
|
||||
}
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
rawData, ok := resp.Data.(map[string]interface{})
|
||||
if !ok {
|
||||
return nil, errors.Join(processors.ErrSystem, errors.New("响应格式错误"))
|
||||
}
|
||||
|
||||
// 将响应数据转换为JSON字节
|
||||
respBytes, err := json.Marshal(respData)
|
||||
result := mapNuoerLoanRiskTagV8ToResponse(rawData)
|
||||
|
||||
respBytes, err := json.Marshal(result)
|
||||
if err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package jrzq
|
||||
|
||||
// mapNuoerLoanRiskTagV8ToResponse 将 nuoer data 转为 JRZQ7F1A 对外结构:
|
||||
// 解包 result,内部字段原样透传。
|
||||
func mapNuoerLoanRiskTagV8ToResponse(data map[string]interface{}) map[string]interface{} {
|
||||
if data == nil {
|
||||
return map[string]interface{}{}
|
||||
}
|
||||
if result, ok := data["result"].(map[string]interface{}); ok {
|
||||
return result
|
||||
}
|
||||
return data
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import (
|
||||
|
||||
"tyapi-server/internal/domains/api/dto"
|
||||
"tyapi-server/internal/domains/api/services/processors"
|
||||
"tyapi-server/internal/infrastructure/external/xingwei"
|
||||
"tyapi-server/internal/infrastructure/external/nuoer"
|
||||
)
|
||||
|
||||
// ProcessJRZQ9D4ERequest JRZQ9D4E API处理方法 - 多头借贷小时级
|
||||
@@ -21,26 +21,36 @@ func ProcessJRZQ9D4ERequest(ctx context.Context, params []byte, deps *processors
|
||||
return nil, errors.Join(processors.ErrInvalidParam, err)
|
||||
}
|
||||
|
||||
// 构建请求数据,将项目规范的字段名转换为 XingweiService 需要的字段名
|
||||
reqData := map[string]interface{}{
|
||||
body := map[string]string{
|
||||
"name": paramsDto.Name,
|
||||
"idCardNum": paramsDto.IDCard,
|
||||
"phoneNumber": paramsDto.MobileNo,
|
||||
"idCard": paramsDto.IDCard,
|
||||
"mobile": paramsDto.MobileNo,
|
||||
}
|
||||
|
||||
// 调用行为数据API,使用指定的project_id
|
||||
projectID := "CDJ-1118085532960616448"
|
||||
respBytes, err := deps.XingweiService.CallAPI(ctx, projectID, reqData)
|
||||
nuoerDoCheckAPIKey := "loanRiskTagV23"
|
||||
ApiPath := "/v1/doCheck"
|
||||
|
||||
resp, err := deps.NuoerService.CallAPI(ctx, nuoerDoCheckAPIKey, ApiPath, body)
|
||||
if err != nil {
|
||||
if errors.Is(err, xingwei.ErrNotFound) {
|
||||
return nil, errors.Join(processors.ErrNotFound, err)
|
||||
} else if errors.Is(err, xingwei.ErrDatasource) {
|
||||
if errors.Is(err, nuoer.ErrDatasource) {
|
||||
return nil, errors.Join(processors.ErrDatasource, err)
|
||||
} else if errors.Is(err, xingwei.ErrSystem) {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
} else {
|
||||
}
|
||||
if errors.Is(err, nuoer.ErrNotFound) {
|
||||
return nil, errors.Join(processors.ErrNotFound, err)
|
||||
}
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
rawData, ok := resp.Data.(map[string]interface{})
|
||||
if !ok {
|
||||
return nil, errors.Join(processors.ErrSystem, errors.New("响应格式错误"))
|
||||
}
|
||||
|
||||
result := mapNuoerLoanRiskTagV23ToResponse(rawData)
|
||||
|
||||
respBytes, err := json.Marshal(result)
|
||||
if err != nil {
|
||||
return nil, errors.Join(processors.ErrSystem, err)
|
||||
}
|
||||
|
||||
return respBytes, nil
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package jrzq
|
||||
|
||||
// mapNuoerLoanRiskTagV23ToResponse 将 nuoer data 转为 JRZQ9D4E 对外结构:
|
||||
// 解包 result,score/reason/contents 原样透传。
|
||||
func mapNuoerLoanRiskTagV23ToResponse(data map[string]interface{}) map[string]interface{} {
|
||||
if data == nil {
|
||||
return map[string]interface{}{}
|
||||
}
|
||||
if result, ok := data["result"].(map[string]interface{}); ok {
|
||||
return result
|
||||
}
|
||||
return data
|
||||
}
|
||||
@@ -18,17 +18,19 @@ 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": {}, // 智享分
|
||||
"idRiskTagV106": {}, // 身份风险V106 idRiskTagV106
|
||||
"personalLawsuit_cv2": {}, // 企业诉讼定制版 personallawsuit cv2
|
||||
"personalLawsuit_cv1": {}, // 个人诉讼定制版personalLawsuit_cv1
|
||||
"loanRiskTagV11": {}, // 借贷意向查询loanRiskTagV11
|
||||
"loanRiskTagV5": {}, // 风险变量V5loanRiskTagV5
|
||||
"loanRiskTagV12": {}, // 特殊名单 loanRiskTagV12
|
||||
"blackListV121_3_1": {}, // 债务逾期黑名单V3_1 blackListV121 3 1
|
||||
"blackListV110": {}, // 特殊名单V110 blackListV110
|
||||
"zhitong_ultra_v4_score": {}, // 智瞳分尊享版 zhitong ultra v4 score
|
||||
"zhixiangScore": {}, // 智享分 zhixiangScore
|
||||
"loanRiskTagV8": {}, // 风险变量V8 loanRiskTagV8
|
||||
"loanRiskTagV9": {}, // 风险变量V9 loanRiskTagV9
|
||||
"loanRiskTagV10": {}, // 风险变量V10 loanRiskTagV10
|
||||
}
|
||||
|
||||
func isQueryBillingAPIKey(apiKey string) bool {
|
||||
|
||||
Reference in New Issue
Block a user