风控SDK
npm install zw-ctu-client-sdk --save
const ClientSDK = require('zw-ctu-client-sdk')
const sdk = new ClientSDK('服务url', '您的appId', '您的appSecret')
sdk.checkRisk({
"data": {
"phone_number": "17800000000",
"user_id": "12345326232",
"ip": "125.121.232.219",
"const_id": "N4RG6TtsY6ILK5ePY6HVtjj12pu5Yi5wnjnbaUI41"
},
"eventCode": "test_event_1",
"flag": "test1"
}).then((resp) => {
const level = resp.result.riskLevel
if (level === 'ACCEPT') {
// 业务代码,当前请求没有风险
} else if (level === 'REVIEW') {
// 业务代码,当前请求有一定风险,建议复审
} else if (level === 'REJECT') {
// 业务代码,当前请求有风险,建议拒绝
}
})
checkRisk第二个参数为超时时间,默认为2000(2秒)