lrf 2 年之前
父节点
当前提交
61aeab0589
共有 1 个文件被更改,包括 2 次插入3 次删除
  1. 2 3
      app/service/user/user.js

+ 2 - 3
app/service/user/user.js

@@ -88,9 +88,7 @@ class UserService extends CrudService {
     // 发邮件
     const data = { template: 'bindEmail', receiver: email, params: { code } };
     const url = `${this.emailServiceUrl}/sendEmail`;
-    const res = await this.httpUtil.cpost(url, data);
-    console.log(res);
-    return res;
+    await this.httpUtil.cpost(url, data);
   }
   async checkBindEmail({ code, id, email }) {
     const redisData = await this.redis.get(`${this.emailKey}${id}`);
@@ -101,6 +99,7 @@ class UserService extends CrudService {
     if (code !== rCode) throw new BusinessError(ErrorCode.DATA_INVALID, '验证码错误');
     if (email !== rEmail) throw new BusinessError(ErrorCode.DATA_INVALID, '要绑定的邮箱与接收验证码的邮箱不是同一个邮箱');
     await this.model.updateOne({ _id: id }, { email });
+    await this.redis.del(`${this.emailKey}${id}`);
   }
 }