Commit d854753d by 宋毅

tj

parent 35878bad
......@@ -25,10 +25,7 @@ class AccessAuthAPI extends APIBase {
var itemResult = await this.appmobilemsgSve.getItemByUappId(pobj);
var result = system.getResult(null, "get msg error");
if (itemResult.status != 0) {
result = await this.opPlatformUtils.fetchDefaultVCode(pobj.actionBody.mobile, pobj.appInfo.uapp_key, pobj.appInfo.uapp_secret);
console.log("--------------fetchDefaultVCode result start")
console.log(result);
console.log("--------------fetchDefaultVCode result end")
result = await this.opPlatformUtils.fetchDefaultVCode(pobj.actionBody.mobile, pobj.appInfo.uapp_key);
return result;
}
var param = {
......@@ -38,7 +35,7 @@ class AccessAuthAPI extends APIBase {
accessKeyId: itemResult.data.access_key_id,
accessKeySecret: itemResult.data.access_key_secret
}
result = await this.opPlatformUtils.fetchOtherVCode(param, pobj.appInfo.uapp_key, pobj.appInfo.uapp_secret);
result = await this.opPlatformUtils.fetchOtherVCode(param, pobj.appInfo.uapp_key);
return result;
}
......
......@@ -7,6 +7,14 @@ class CacheBase {
this.prefix = this.prefix();
this.cacheCacheKeyPrefix = "s_sadd_appkeys:" + settings.appKey + "_cachekey";
this.isdebug = this.isdebug();
this.md5 = require("MD5");
}
async getEncryptStr(str) {
if (!str) {
throw new Error("字符串不能为空");
}
var md5 = this.md5(str + "_" + settings.salt);
return md5.toString().toLowerCase();
}
isdebug() {
return false;
......
......@@ -14,6 +14,7 @@ class AppTokenByHostsCache extends CacheBase {
prefix() {
return settings.cacheprefix + "_accesskey:";
}
//优化掉从平台中获取应用信息--sy-2020-10-21
async buildCacheVal(cachekey, inputkey, val, ex, ...items) {
var actionBody = val;
if (!actionBody) {
......@@ -29,20 +30,20 @@ class AppTokenByHostsCache extends CacheBase {
if (!item) {
return system.getResult(null, "app_hosts to data is empty !");
}
if (!item.uapp_key || !item.uapp_secret) {
return system.getResult(null, "uapp_key or uapp_secret can not be empty !");
}
if (item.is_enabled != 1) {
return system.getResult(null, "app_hosts to item is Disable !");
}
var result = await this.opPlatformUtils.getReqApiAccessKey(item.uapp_key, item.uapp_secret);
if (!result) {
return system.getResult(null, "platform to data is empty !");
}
if (result.status != 0) {
return result;
}
item.token = result.data.accessKey;
// if (!item.uapp_key || !item.uapp_secret) {
// return system.getResult(null, "uapp_key or uapp_secret can not be empty !");
// }
// var result = await this.opPlatformUtils.getReqApiAccessKey(item.uapp_key, item.uapp_secret);
// if (!result) {
// return system.getResult(null, "platform to data is empty !");
// }
// if (result.status != 0) {
// return result;
// }
// item.token = result.data.accessKey;
return system.getResultSuccess(item);
}
}
......
......@@ -13,24 +13,24 @@ class AppUserPinByLoginPwdCache extends CacheBase {
prefix() {
return settings.cacheprefix + "_userPin:";
}
//优化掉从平台中获取应用信息--sy-2020-10-21
async buildCacheVal(cachekey, inputkey, val, ex, ...items) {
var actionBody = val.actionBody;
var appInfo = val.appInfo;
var uUserName = actionBody.userName;//uUserName
var uPassword = actionBody.password;//uPassword
var uUserInfo = await this.opPlatformUtils.login(uUserName, uPassword,
appInfo.uapp_key, appInfo.uapp_secret);
if (uUserInfo.status != 0) {
return uUserInfo;
}//值为2010为用户名或密码错误
var userInfo = await this.appuserDao.getItemByChannelUserId(actionBody.userName, appInfo.uapp_id);
const actionBody = val.actionBody;
const appInfo = val.appInfo;
const uUserName = actionBody.userName;//uUserName
const password = await this.getEncryptStr(actionBody.password);//uPassword
// var uUserInfo = await this.opPlatformUtils.login(uUserName, uPassword,
// appInfo.uapp_key, appInfo.uapp_secret);
// if (uUserInfo.status != 0) {
// return uUserInfo;
// }//值为2010为用户名或密码错误
var userInfo = await this.appuserDao.getItemByPwd(uUserName, password, appInfo.uapp_id);
if (!userInfo) {
return system.getResult(null, "user to item is empty !");
}
if (userInfo.is_enabled != 1) {
return system.getResult(null, "user to item is Disable !");
}
userInfo.userpin = actionBody.userpin;
return system.getResultSuccess(userInfo);
}
}
......
......@@ -14,31 +14,27 @@ class AppUserPinByLoginVcodeCache extends CacheBase {
return settings.cacheprefix + "_userPin:";
}
async buildCacheVal(cachekey, inputkey, val, ex, ...items) {
var actionBody = val.actionBody;
var appInfo = val.appInfo;
var uUserInfo = await this.opPlatformUtils.loginByVCode(actionBody.mobile, actionBody.vcode, actionBody.password,
appInfo.uapp_key, appInfo.uapp_secret);
if (uUserInfo.status != 0) {
return uUserInfo;
}//2030验证码校验不成功 或 注册失败
var userInfo = await this.appuserDao.getItemByChannelUserId(actionBody.mobile, appInfo.uapp_id);
let actionBody = val.actionBody;
let appInfo = val.appInfo;
let userInfo = await this.appuserDao.getItemByChannelUserId(actionBody.mobile, appInfo.uapp_id);
if (userInfo) {
if (userInfo.is_enabled != 1) {
return system.getResult(null, "user to item is Disable !");
return system.getResult(null, "用户未启用");
}
if (actionBody.reqType == "reg") {
return system.getResultFail(system.existUserRegFail, "已经存在此用户,注册失败");
if (actionBody.reqType === "reg") {
return system.getResult(null, "已经存在此用户,注册失败");
}
userInfo.userpin = actionBody.userpin;
return system.getResultSuccess(userInfo);
}
var params = {
const uPassword = await this.getEncryptStr((actionBody.password || actionBody.mobile));//uPassword
let params = {
uapp_id: appInfo.uapp_id,
channel_userid: actionBody.mobile || "",
channel_username: actionBody.mobile || "",
channel_nickname: actionBody.nickName || "",
mobile: actionBody.mobile || "",
password: uPassword,
org_name: actionBody.orgName || "",
org_path: actionBody.orgPath || "",
is_enabled: 1,
......@@ -46,8 +42,8 @@ class AppUserPinByLoginVcodeCache extends CacheBase {
last_login_time: new Date()
};
userInfo = await this.appuserDao.create(params);
userInfo.userpin = actionBody.userpin;
return system.getResultSuccess(userInfo);
params.password = "";
return system.getResultSuccess(params);
}
}
module.exports = AppUserPinByLoginVcodeCache;
const CacheBase = require("../cache.base");
const system = require("../../system");
const settings = require("../../../config/settings");
//缓存首次登录的赠送的宝币数量
class VCodeCache extends CacheBase {
constructor() {
super();
this.smsUtil = system.getObject("util.smsClient");
}
// isdebug() {
// return settings.env == "dev";
// }
desc() {
return "缓存给手机发送的验证码60妙";
}
prefix() {
return settings.cacheprefix + "g_vcode:appkey_";
}
async buildCacheVal(cachekey, inputkey, val, ex, ...items) {
//【XXX】您的验证码是:602639(5分钟内有效),工作人员不会索取,请勿泄露。-------描述在模板中配置
var params = val;
var vcode = await this.smsUtil.getUidStr(6, 10);
if (params && params.reqType) {
switch (params.reqType) {
case "defaultVcode":
const msg = "您的验证码:" + vcode + ",请在60秒输入完成验证,若非本人操作,请勿泄露"
this.smsUtil.sendDefaultVcodeMsg(params.mobile, msg);
break;
case "defaultOtherVcode"://暂时没有用到
this.smsUtil.aliSendMsg(params.mobile, params.tmplCode, params.signName, JSON.stringify({ code: vcode }));
break;
case "otherVcode":
this.smsUtil.aliOtherSendMsg(params.mobile, params.accessKeyId, params.accessKeySecret, params.tmplCode,
params.signName, JSON.stringify({ code: vcode }));
break;
default:
break;
}
}
return system.getResultSuccess({ vcode: vcode });
}
}
module.exports = VCodeCache;
......@@ -27,5 +27,35 @@ class AppuserDao extends Dao {
raw: true
});
}
/**
* 通过密码进行登录
* @param {*} channel_userid
* @param {*} password
* @param {*} uapp_id
*/
async getItemByPwd(channel_userid, password, uapp_id) {
return this.model.findOne({
where: {
channel_userid: channel_userid,
password: password,
uapp_id: uapp_id
},
attributes: ["id",
"uapp_id",
"channel_userid",
"channel_username",
"channel_nickname",
"open_id",
"head_url",
"mobile",
"org_name",
"org_path",
"email",
"is_admin",
"is_super",
"is_enabled"],
raw: true
});
}
}
module.exports = AppuserDao;
......@@ -13,6 +13,7 @@ module.exports = (db, DataTypes) => {
org_name: DataTypes.STRING(255),
org_path: DataTypes.STRING(255),
email: DataTypes.STRING(50),
password: DataTypes.STRING(255),
is_admin: {
type: DataTypes.BOOLEAN,
defaultValue: false,
......
......@@ -294,7 +294,7 @@ Date.prototype.Format = function (fmt) { //author: meizz
System.exTime = 4 * 3600;//缓存过期时间,4小时
System.shortExTime = 300;//300
System.shortExTime = 300;//缓存过期时间,5分钟
//缓存失效
System.cacheInvalidation = -88;
......
......@@ -14,6 +14,8 @@ class OpPlatformUtils {
this.registerUrl = settings.paasUrl() + "api/auth/accessAuth/register";
this.loginByVCodeUrl = settings.paasUrl() + "api/auth/accessAuth/loginByVCode";
this.modiPasswordByMobileUrl = settings.paasUrl() + "api/auth/accessAuth/modiPasswordByMobile";
this.vCodeExTime = 120;//验证码缓存秒数
this.appuserDao = system.getObject("db.dbapp.appuserDao");
}
getUserPinKey(userpin) {
return settings.cacheprefix + "_userPin:" + userpin;
......@@ -79,7 +81,7 @@ class OpPlatformUtils {
return system.getResultSuccess(restResult.data);
}
/**
* 通过自定义模板获取手机模板短信
* 合作方通过自定义模板获取手机模板短信
* @param {*} param {
mobile: actionBody.mobile,
tmplCode: "SMS_151685065",
......@@ -88,45 +90,55 @@ class OpPlatformUtils {
accessKeySecret: "Z3wUHmZ0hnQst6uaTY3GzOYVoWwxb9"
}
* @param {*} appKey
* @param {*} secret
*/
async fetchOtherVCode(param, appKey, secret) {
var reqApiAccessKey = await this.getReqApiAccessKey(appKey, secret);
if (reqApiAccessKey.status != 0) {
return reqApiAccessKey;
async fetchOtherVCode(param, appKey) {
if (!param.mobile) {
return system.getResult(null, "电话号码不能为空.");
}
//按照访问token
var restResult = await this.restClient.execPostWithAK(
param,
this.fetchOtherVCodeUrl, reqApiAccessKey.data.accessKey);
if (restResult.status != 0 || !restResult.data) {
return system.getResult(null, restResult.msg);
if (!param.tmplCode) {
return system.getResult(null, "模版编码不能为空.");
}
return system.getResultSuccess();
if (!param.signName) {
return system.getResult(null, "短信签名不能为空.");
}
if (param.tmplCode && param.tmplCode.indexOf("SMS_") < 0) {
return system.getResult(null, "模版编码有误");
}
if (!param.accessKeyId) {
return system.getResult(null, "模版accessKeyId不能为空.");
}
if (!param.accessKeySecret) {
return system.getResult(null, "模版accessKeySecret不能为空.");
}
var cacheManager = system.getObject("db.common.cacheManager");
const cacheKeyStr = appKey + "_" + param.mobile;
const tmpReslut = await cacheManager["VCodeCache"].getCache(cacheKeyStr);
if (tmpReslut.status != -88) {
return system.getResult(null, "操作过于频繁,请勿重复获取");
}
param.reqType = "otherVcode";
const vcodeResult = await cacheManager["VCodeCache"].cache(cacheKeyStr, param, this.vCodeExTime, null);
return system.getResult(vcodeResult);
}
/**
* 获取默认的手机模板短信
* @param {*} mobile
* @param {*} appKey
* @param {*} secret
*/
async fetchDefaultVCode(mobile, appKey, secret) {
var reqApiAccessKey = await this.getReqApiAccessKey(appKey, secret);
if (reqApiAccessKey.status != 0) {
return reqApiAccessKey;
async fetchDefaultVCode(mobile, appkey) {
if (!mobile) {
return system.getResult(null, "电话号码不能为空.");
}
var param = { mobile: mobile }
//按照访问token
var restResult = await this.restClient.execPostWithAK(
param,
this.fetchDefaultVCodeUrl, reqApiAccessKey.data.accessKey);
if (restResult.status != 0 || !restResult.data) {
return system.getResult(null, restResult.msg);
var cacheManager = system.getObject("db.common.cacheManager");
const cacheKeyStr = appkey + "_" + mobile;
const tmpReslut = await cacheManager["VCodeCache"].getCache(cacheKeyStr);
if (tmpReslut.status != -88) {
return system.getResult(null, "操作过于频繁,请勿重复获取");
}
return system.getResultSuccess(restResult);
const param = { mobile: mobile, reqType: "defaultVcode" }
const vcodeResult = await cacheManager["VCodeCache"].cache(cacheKeyStr, param, this.vCodeExTime, null);
return system.getResult(vcodeResult);
}
/**
* 创建用户信息
......@@ -270,7 +282,7 @@ class OpPlatformUtils {
return system.getResultSuccess(restResult.data);
}
async modiPasswordByMobile(mobile, vcode, newPwd, appKey, secret) {
async modiPasswordByMobile(mobile, vcode, newPwd, appKey, secret) {//----暂时不用
var reqApiAccessKey = await this.getReqApiAccessKey(appKey, secret);
if (reqApiAccessKey.status != 0) {
return reqApiAccessKey;
......@@ -291,7 +303,7 @@ class OpPlatformUtils {
async getReqTokenByHosts(actionBody) {
var cacheManager = system.getObject("db.common.cacheManager");
var inputkey = actionBody.reqType == "hosts" ? actionBody.appHosts : actionBody.appkey;
var result = await cacheManager["AppTokenByHostsCache"].cache(inputkey, actionBody, system.exTime);
var result = await cacheManager["AppTokenByHostsCache"].cache(inputkey, actionBody, system.shortExTime);
return result;
}
......@@ -303,23 +315,23 @@ class OpPlatformUtils {
var inputkey = pobj.appInfo.uapp_key + "_" + pobj.actionBody.channelUserId;
var cacheManager = system.getObject("db.common.cacheManager");
var result = await cacheManager["AppUserPinByUserNameCache"].getCache(inputkey);
if (result && result.status == 0) {
if (result.data.userpin) {
// 2020 0723 lin修改 登录并重新设置过期时间
var inputkey = this.getUserPinKey(inputkey);
var userpinKey = this.getUserPinKey(result.data.userpin);
await this.redisClient.setExpire(inputkey, system.exTime);
await this.redisClient.setExpire(userpinKey, system.exTime);
return system.getResultFail(system.reDoLoginFail, "请勿重复处理", { userpin: result.data.userpin || "" });
} else {
await this.clearLoginCache(inputkey);
}
}
var result = await cacheManager["AppUserPinByUserNameCache"].cache(inputkey, pobj, system.exTime);
if (result && result.status == 0) {
var userpinKey = this.getUserPinKey(pobj.actionBody.userpin);
this.redisClient.setWithEx(userpinKey, JSON.stringify(result), system.exTime);
}
// if (result && result.status == 0) {
// if (result.data.userpin) {
// // 2020 0723 lin修改 登录并重新设置过期时间
// var inputkey = this.getUserPinKey(inputkey);
// var userpinKey = this.getUserPinKey(result.data.userpin);
// await this.redisClient.setExpire(inputkey, system.exTime);
// await this.redisClient.setExpire(userpinKey, system.exTime);
// return system.getResultFail(system.reDoLoginFail, "请勿重复处理", { userpin: result.data.userpin || "" });
// } else {
// await this.clearLoginCache(inputkey);
// }
// }
var result = await cacheManager["AppUserPinByUserNameCache"].cache(inputkey, pobj, system.shortExTime);
// if (result && result.status == 0) {
// var userpinKey = this.getUserPinKey(pobj.actionBody.userpin);
// this.redisClient.setWithEx(userpinKey, JSON.stringify(result), system.exTime);
// }
return result;
}
......@@ -334,10 +346,9 @@ class OpPlatformUtils {
// if (result && result.status == 0) {
// return system.getResultFail(system.reDoLoginFail, "请勿重复登录", { userpin: result.data.userpin || "" });
// }
var result = await cacheManager["AppUserPinByLoginPwdCache"].cache(inputkey, pobj, system.exTime);
if (result && result.status == 0) {
var userpinKey = this.getUserPinKey(pobj.actionBody.userpin);
this.redisClient.setWithEx(userpinKey, JSON.stringify(result), system.exTime);
var result = await cacheManager["AppUserPinByLoginPwdCache"].cache(inputkey, pobj, system.shortExTime);
if (!result || result.status != 0) {
return system.getResult(null, "用户名或密码错误");
}
return result;
}
......@@ -346,8 +357,12 @@ class OpPlatformUtils {
* @param {*} pobj pobj.actionBody:{mobile:XXX,vcode:XXX,reqType:"reg",password:XXX-reqType为reg时有此值}
*/
async getReqUserPinByLgoinVcode(pobj) {
var inputkey = pobj.appInfo.uapp_key + "_" + pobj.actionBody.mobile;
var cacheManager = system.getObject("db.common.cacheManager");
var inputkey = pobj.appInfo.uapp_key + "_" + pobj.actionBody.mobile;
var cacheCode = await this.cacheManager["VCodeCache"].getCache(inputkey);
if (!cacheCode || pobj.vcode != cacheCode.vcode) {
return system.getResultFail(system.verifyVCodeFail, "验证码校验不成功,请重新获取验证码验证.", system.verifyVCodeFail);
}
// if (pobj.actionBody.reqType != "reg") {
// var result = await cacheManager["AppUserPinByLoginVcodeCache"].getCache(inputkey);
// if (result && result.status == 0) {
......@@ -364,8 +379,15 @@ class OpPlatformUtils {
}
return result;
}
async getEncryptStr(str) {
if (!str) {
throw new Error("字符串不能为空");
}
var md5 = this.md5(str + "_" + settings.salt);
return md5.toString().toLowerCase();
}
/**
* 通过手机验证码修改用户密码
* 通过手机验证码修改用户密码,前端修改后要移除掉userpin让用户进行重新登录
* @param {*} pobj
* @param {*} actionBody {mobile:XX,vcode:XXX,newPwd:XXX,userpin:XXXXX}
*/
......@@ -382,11 +404,17 @@ class OpPlatformUtils {
if (!pobj.appInfo) {
return system.getResult(null, "pobj.appInfo can not be empty !");
}
var acckapp = await this.modiPasswordByMobile(actionBody.mobile, actionBody.vcode, actionBody.newPwd, pobj.appInfo.uapp_key, pobj.appInfo.uapp_secret);
return acckapp;
var inputkey = pobj.appInfo.uapp_key + "_" + pobj.actionBody.mobile;
var cacheCode = await this.cacheManager["VCodeCache"].getCache(inputkey);
if (!cacheCode || pobj.vcode != cacheCode.vcode) {
return system.getResultFail(system.verifyVCodeFail, "验证码校验不成功,请重新获取验证码验证.", system.verifyVCodeFail);
}
const uPassword = await this.getEncryptStr(actionBody.newPwd);//uPassword
await this.appuserDao.updateByWhere({ password: uPassword }, { where: { channel_userid: mobile, uapp_id: pobj.appInfo.uapp_id } })
return system.getResultSuccess();
}
/**
* 获取账户信息
* 获取账户信息---改版后废弃--20201026-sy
* @param {*} pobj pobj.actionBody:{userpin:XXX}
*/
async getUserLoginInfo(pobj) {
......
const system=require("../system");
class SmsClient{
constructor(){
this.smsTeml="http://123.57.156.109:4103/api/Send";
this.restClient=system.getObject("util.restClient");
const system = require("../system");
const Core = require('@alicloud/pop-core');
class SmsClient {
constructor() {
this.smsTeml = "http://123.57.156.109:4103/api/Send";
this.restClient = system.getObject("util.restClient");
this.aliclient = new Core({
accessKeyId: 'LTAI4FtNp3wcqFzaADvo1WtZ',
accessKeySecret: 'VBKn1Anx4UmMF0LKNz7PVaCFG1phcg',
endpoint: 'https://dysmsapi.aliyuncs.com',
apiVersion: '2017-05-25'
});
}
async sendMsg(to,content){
var txtObj ={
"appId":8,
"mobilePhone":to,
"content":content
/**
* 公司宝阿里云发送
* @param {*} mobile 手机号
* @param {*} tmplcode 模板编码
* @param {*} signName 短信头签名
* @param {*} jsonContent 内容
*/
async aliSendMsg(mobile, tmplcode, signName, jsonContent) {
var params = {
"RegionId": "default",
"PhoneNumbers": mobile,
"SignName": signName,
"TemplateCode": tmplcode,
"TemplateParam": jsonContent
}
return this.restClient.execPost(txtObj,this.smsTeml);
var requestOption = {
method: 'POST'
};
this.aliclient.request('SendSms', params, requestOption).then((result) => {
console.log(JSON.stringify(result));
}, (ex) => {
console.log(ex);
})
}
/**
* 合作方阿里云发送
* @param {*} mobile 手机号
* @param {*} accessKeyId 阿里云key
* @param {*} accessKeySecret 阿里云密钥
* @param {*} tmplcode 模板编码
* @param {*} signName 短信头签名
* @param {*} jsonContent 内容
*/
async aliOtherSendMsg(mobile, accessKeyId, accessKeySecret, tmplcode, signName, jsonContent) {
var params = {
"RegionId": "default",
"PhoneNumbers": mobile,
"SignName": signName,
"TemplateCode": tmplcode,
"TemplateParam": jsonContent
};
var requestOption = {
method: 'POST'
};
var otherAliclient = new Core({
accessKeyId: accessKeyId,
accessKeySecret: accessKeySecret,
endpoint: 'https://dysmsapi.aliyuncs.com',
apiVersion: '2017-05-25'
});
otherAliclient.request('SendSms', params, requestOption).then((result) => {
console.log(JSON.stringify(result));
}, (ex) => {
console.log(ex);
});
}
/**
* 公司宝默认的短信发送
* @param {*} mobile 手机号
* @param {*} content 内容
*/
async sendDefaultVcodeMsg(mobile, content) {
var txtObj = {
"appId": 8,
"mobilePhone": mobile,
"content": content
}
return this.restClient.execPost(txtObj, this.smsTeml);
}
async getUidStr(len, radix) {
var chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'.split('');
var uuid = [], i;
radix = radix || chars.length;
if (len) {
for (i = 0; i < len; i++) uuid[i] = chars[0 | Math.random() * radix];
} else {
var r;
uuid[8] = uuid[13] = uuid[18] = uuid[23] = '-';
uuid[14] = '4';
for (i = 0; i < 36; i++) {
if (!uuid[i]) {
r = 0 | Math.random() * 16;
uuid[i] = chars[(i == 19) ? (r & 0x3) | 0x8 : r];
}
}
}
return uuid.join('');
}
}
module.exports=SmsClient;
module.exports = SmsClient;
// var sms=new SmsClient();
// sms.aliSendMsg("13381139519","SMS_173946419","iboss",JSON.stringify({code:"hello"}));
var path = require('path');
var ENVINPUT={
DB_HOST:process.env.DB_HOST,
DB_PORT:process.env.DB_PORT,
DB_USER:process.env.DB_USER,
DB_PWD:process.env.DB_PWD,
DB_NAME:process.env.CENTER_APP_DB_NAME,
REDIS_HOST:process.env.REDIS_HOST,
REDIS_PORT:process.env.REDIS_PORT,
REDIS_PWD:process.env.REDIS_PWD,
REDIS_DB:process.env.CENTER_APP_REDIS_DB,
APP_ENV:process.env.APP_ENV?process.env.APP_ENV:"dev"
var ENVINPUT = {
DB_HOST: process.env.DB_HOST,
DB_PORT: process.env.DB_PORT,
DB_USER: process.env.DB_USER,
DB_PWD: process.env.DB_PWD,
DB_NAME: process.env.CENTER_APP_DB_NAME,
REDIS_HOST: process.env.REDIS_HOST,
REDIS_PORT: process.env.REDIS_PORT,
REDIS_PWD: process.env.REDIS_PWD,
REDIS_DB: process.env.CENTER_APP_REDIS_DB,
APP_ENV: process.env.APP_ENV ? process.env.APP_ENV : "dev"
};
var settings = {
env:ENVINPUT.APP_ENV,
env: ENVINPUT.APP_ENV,
appKey: "201911061250",
secret: "f99d413b767f09b5dff0b3610366cc46",
salt: "%iatpD1gcxz7iF#B",
......@@ -79,10 +79,10 @@ var settings = {
return localsettings.redis;
} else {
return {
host:ENVINPUT.REDIS_HOST,
port:ENVINPUT.REDIS_PORT,
password:ENVINPUT.REDIS_PWD,
db:ENVINPUT.REDIS_DB,
host: ENVINPUT.REDIS_HOST,
port: ENVINPUT.REDIS_PORT,
password: ENVINPUT.REDIS_PWD,
db: ENVINPUT.REDIS_DB,
};
}
},
......@@ -92,10 +92,10 @@ var settings = {
return localsettings.database;
} else {
return {
dbname : ENVINPUT.DB_NAME,
user : ENVINPUT.DB_USER,
password : ENVINPUT.DB_PWD,
config : {
dbname: ENVINPUT.DB_NAME,
user: ENVINPUT.DB_USER,
password: ENVINPUT.DB_PWD,
config: {
host: ENVINPUT.DB_HOST,
dialect: 'mysql',
operatorsAliases: false,
......@@ -105,8 +105,8 @@ var settings = {
acquire: 90000000,
idle: 1000000
},
debug:false,
dialectOptions:{
debug: false,
dialectOptions: {
requestTimeout: 999999,
// instanceName:'DEV'
} //设置MSSQL超时时间
......
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