lrf 2 년 전
부모
커밋
697393d1a5
2개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 1
      app/service/user/user.js
  2. 1 1
      config/config.default.js

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

@@ -115,7 +115,7 @@ class UserService extends CrudService {
   async toBindPhone({ id, phone }) {
     const code = _.random(100000, 999999);
     const value = `${phone}${this.conenctCode}${code}`;
-    await this.redis.set(`${this.bindPhoneKey}${id}`, value, 'EX', 300);
+    await this.redis.set(`${this.bindPhoneKey}${id}`, value); // , 'EX', 300
     // 发短信
     const data = { config: this.smsServiceConfig, template: 'bind', phone, params: { code } };
     const url = `${this.smsServiceUrl}/sendMessage`;
@@ -128,6 +128,8 @@ class UserService extends CrudService {
     const arr = redisData.split(this.conenctCode);
     const rphone = _.head(arr);
     const rCode = _.last(arr);
+    console.log(rphone, phone);
+    console.log(rCode, code);
     if (code !== rCode) throw new BusinessError(ErrorCode.DATA_INVALID, '验证码错误');
     if (phone !== rphone) throw new BusinessError(ErrorCode.DATA_INVALID, '要绑定的邮箱与接收验证码的邮箱不是同一个邮箱');
     await this.model.updateOne({ _id: id }, { phone });

+ 1 - 1
config/config.default.js

@@ -35,7 +35,7 @@ module.exports = appInfo => {
   // 数据库设置
   config.dbName = 'point_shopping';
   config.mongoose = {
-    url: `mongodb://120.48.146.1:27017/${config.dbName}`, // 120.48.146.1 127.0.0.1
+    url: `mongodb://127.0.0.1:27017/${config.dbName}`, // 120.48.146.1 127.0.0.1
     options: {
       user: 'admin',
       pass: 'admin',