Commit 06e7c3d9 authored by Hsinli's avatar Hsinli

addd

parent ba2234a7
Pipeline #13541 passed with stage
in 4 seconds
...@@ -13,19 +13,32 @@ class ApplyService extends Service { ...@@ -13,19 +13,32 @@ class ApplyService extends Service {
*/ */
async getVerificationCode(inputParams) { async getVerificationCode(inputParams) {
const { ctx, app } = this; const { ctx, app } = this;
if (!ctx.userId) {
ctx.failed('登录异常');
}
let ret = {
code: 1,
msg: '短信发送成功',
}
ctx.logger.info(inputParams); ctx.logger.info(inputParams);
//姓名手机号和身份证校验 //姓名手机号和身份证校验
let idVerify = ctx.helper.verify_id_card(inputParams.id_card); let idVerify = ctx.helper.verify_id_card(inputParams.id_card);
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) {
ctx.failed('身份证输入有误,请校验后输入'); ret.code = 0;
ret.msg = '身份证输入有误,请校验后输入';
return ret;
} }
if (!phoneVerify) { if (!phoneVerify) {
ctx.failed('手机号输入有误,请校验后输入'); ret.code = 0;
ret.msg = '手机号输入有误,请校验后输入';
return ret;
} }
if (nameVerify !== 1) { if (nameVerify !== 1) {
ctx.failed('姓名输入有误,请校验后输入'); ret.code = 0;
ret.msg = '姓名输入有误,请校验后输入';
return ret;
} }
//TODO 三要素校验 //TODO 三要素校验
...@@ -44,7 +57,9 @@ class ApplyService extends Service { ...@@ -44,7 +57,9 @@ 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) {
ctx.failed('获取验证码过于频繁,请稍后再试'); ret.code = 0;
ret.msg = '获取验证码过于频繁,请稍后再试';
return ret;
} }
await app.redis.set(lockKey, 'lock', 'EX', 60);//60秒锁 await app.redis.set(lockKey, 'lock', 'EX', 60);//60秒锁
...@@ -56,9 +71,11 @@ class ApplyService extends Service { ...@@ -56,9 +71,11 @@ class ApplyService extends Service {
times = 0; times = 0;
} }
times++; times++;
// if (times >= 6) { if (times >= 6) {
// ctx.failed('今日获取验证码次数过多,请明日再试'); // ret.code = 0;
// } // 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);//今日有效
...@@ -74,10 +91,7 @@ class ApplyService extends Service { ...@@ -74,10 +91,7 @@ class ApplyService extends Service {
let codeKey = 'mine:credit:black:code' + inputParams.phone; let codeKey = 'mine:credit:black:code' + inputParams.phone;
await app.redis.set(codeKey, code, 'EX', 60 * 5);//5分钟有效时间 await app.redis.set(codeKey, code, 'EX', 60 * 5);//5分钟有效时间
let ret = {
code: 1,
msg: '短信发送成功',
}
let smsParams = { let smsParams = {
phone: inputParams.phone, phone: inputParams.phone,
content: '【51公积金】您本次操作的短信验证码为' + code + ',5分钟内有效。谨慎保管,切勿告诉他人。' content: '【51公积金】您本次操作的短信验证码为' + code + ',5分钟内有效。谨慎保管,切勿告诉他人。'
...@@ -104,7 +118,7 @@ class ApplyService extends Service { ...@@ -104,7 +118,7 @@ class ApplyService extends Service {
} }
} }
if (!ctx.userId) { if (!ctx.userId) {
return ret; ctx.failed('登录异常');
} }
let bePayOrder = await ctx.service.credit.order.getBePayOrder(1); let bePayOrder = await ctx.service.credit.order.getBePayOrder(1);
if (bePayOrder.length != 0) { if (bePayOrder.length != 0) {
...@@ -144,6 +158,9 @@ class ApplyService extends Service { ...@@ -144,6 +158,9 @@ class ApplyService extends Service {
*/ */
async applyBlacklist(inputParams) { async applyBlacklist(inputParams) {
const { ctx, app } = this; const { ctx, app } = this;
if (!ctx.userId) {
ctx.failed('登录异常');
}
let ret = { let ret = {
order_id: null, order_id: null,
report_id: null, report_id: null,
......
...@@ -43,6 +43,9 @@ class BlacklistService extends Service { ...@@ -43,6 +43,9 @@ class BlacklistService extends Service {
*/ */
async getReport(id) { async getReport(id) {
const { ctx } = this; const { ctx } = this;
if (!ctx.userId) {
ctx.failed('登录异常');
}
let reportData = await ctx.prometheusModel.CreditBlacklistReport.findOne({ where: { id: id } }); let reportData = await ctx.prometheusModel.CreditBlacklistReport.findOne({ where: { id: id } });
let ret = { let ret = {
basic: { basic: {
......
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