lrf vor 2 Jahren
Ursprung
Commit
bab8211802
3 geänderte Dateien mit 9 neuen und 2 gelöschten Zeilen
  1. 2 1
      app/service/user/user.js
  2. 4 1
      config/config.default.js
  3. 3 0
      config/config.prod.js

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

@@ -13,6 +13,7 @@ class UserService extends CrudService {
     this.emailKey = 'bindEmail:';
     this.httpUtil = this.ctx.service.util.httpUtil;
     this.emailServiceUrl = _.get(this.app, 'config.httpPrefix.email');
+    this.emailServiceConfig = _.get(this.app, 'config.emailConfig.config');
     this.conenctCode = '&&';
   }
   async beforeCreate(data) {
@@ -86,7 +87,7 @@ class UserService extends CrudService {
     const value = `${email}${this.conenctCode}${code}`;
     await this.redis.set(`${this.emailKey}${id}`, value, 'EX', 300);
     // 发邮件
-    const data = { template: 'bindEmail', receiver: email, params: { code } };
+    const data = { config: this.emailServiceConfig, template: 'bindEmail', receiver: email, params: { code } };
     const url = `${this.emailServiceUrl}/sendEmail`;
     await this.httpUtil.cpost(url, data);
   }

+ 4 - 1
config/config.default.js

@@ -35,7 +35,7 @@ module.exports = appInfo => {
   // 数据库设置
   config.dbName = 'point_shopping';
   config.mongoose = {
-    url: `mongodb://127.0.0.1:27017/${config.dbName}`, // 120.48.146.1 127.0.0.1
+    url: `mongodb://120.48.146.1:27017/${config.dbName}`, // 120.48.146.1 127.0.0.1
     options: {
       user: 'admin',
       pass: 'admin',
@@ -75,6 +75,9 @@ module.exports = appInfo => {
     // email: 'http://broadcast.waityou24.cn/semail/api',
     email: 'http://127.0.0.1:14002/semail/api',
   };
+  config.emailConfig = {
+    config: 'free',
+  };
   // 中间件
   config.requestLog = {
     toMongoDB: true,

+ 3 - 0
config/config.prod.js

@@ -14,6 +14,9 @@ module.exports = appInfo => {
       useFindAndModify: true,
     },
   };
+  config.emailConfig = {
+    config: 'tehq',
+  };
   return {
     ...config,
   };