Commit 52cd25be authored by 李尚科's avatar 李尚科

fix

parent 57f911e6
Pipeline #13430 passed with stage
in 4 seconds
......@@ -19,7 +19,25 @@ class CallriskController extends Controller {
async queryCallRisk() {
const { ctx } = this;
const input_params = ctx.request.body;
const { real_name, id_card, phone, password } = input_params;
if (ctx.helper.verify_real_name(real_name) !== 1) {
ctx.failed('姓名输入有误,请校验后输入');
}
if (!ctx.helper.verify_id_card(id_card)) {
ctx.failed('身份证输入有误,请校验后输入');
}
if (!ctx.helper.isPhoneNumber(phone)) {
ctx.failed('手机号输入有误,请校验后输入');
}
//TODO 三要素校验 调用数据服务接口
}
......
......@@ -128,7 +128,7 @@ module.exports = {
//longitude 经线 latitude 纬度 纬度从南到北,范围为-90 - 90
//示例:北纬N29°57′28.20″ 东经E119°42′32.30″ gps:29.9578340000,119.7089730000
checkGps(gps) {
if (!gps || gps.indexOf(',') === -1) {
return '';
}
......@@ -278,4 +278,24 @@ module.exports = {
}
},
/**判断是否是手机号**/
isPhoneNumber(tel) {
var reg = /^0?1[3|4|5|6|7|8|9][0-9]\d{8}$/;
return reg.test(tel);
},
// 0姓名格式不正确;-1至少输入2个汉字 1成功
verify_real_name(real_name) {
const real_name_reg = /^[\u4E00-\u9FA5]{1,10}$/;
if (!real_name_reg.test(real_name)) {//姓名校验
return 0;
}
if (real_name.length < 2) {
return -1;
}
return 1;
},
};
......@@ -6,7 +6,16 @@ const moment = require('moment');
class CallriskService extends Service {
async checkThreeElements() {
}
async getCallriskDetailData(input) {
const { real_name, id_card, phone, password } = input;
//TODO 调用运营商数据接口
return {};
}
/**
* 获取个人通话检测报告
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment