Commit d7e0e065 authored by Hsinli's avatar Hsinli

addd

parent 370215cb
Pipeline #13544 passed with stage
in 25 seconds
......@@ -26,19 +26,13 @@ class ApplyService extends Service {
let phoneVerify = ctx.helper.isPhoneNumber(inputParams.phone);
let nameVerify = ctx.helper.verify_real_name(inputParams.name);
if (!idVerify) {
ret.code = 0;
ret.msg = '身份证输入有误,请校验后输入';
return ret;
ctx.failed('身份证输入有误,请校验后输入');
}
if (!phoneVerify) {
ret.code = 0;
ret.msg = '手机号输入有误,请校验后输入';
return ret;
ctx.failed('手机号输入有误,请校验后输入');
}
if (nameVerify !== 1) {
ret.code = 0;
ret.msg = '姓名输入有误,请校验后输入';
return ret;
ctx.failed('姓名输入有误,请校验后输入');
}
//TODO 三要素校验
......@@ -57,9 +51,7 @@ class ApplyService extends Service {
let lock = await app.redis.get(lockKey);
ctx.logger.info(lock);
if (lock && lock !== null) {
ret.code = 0;
ret.msg = '获取验证码过于频繁,请稍后再试';
return ret;
ctx.failed('获取验证码过于频繁,请稍后再试');
}
await app.redis.set(lockKey, 'lock', 'EX', 60);//60秒锁
......@@ -72,9 +64,7 @@ class ApplyService extends Service {
}
times++;
if (times >= 6) {
// ret.code = 0;
// ret.msg = '今日获取验证码次数过多,请明日再试';
// return ret;
// ctx.failed('今日获取验证码次数过多,请明日再试');
}
let pexpire = new Date(moment().add(1, 'days').format('YYYY-MM-DD')).getTime();
await app.redis.set(timesKey, times, 'PX', pexpire);//今日有效
......
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