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