Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
d854753d
Commit
d854753d
authored
Oct 27, 2020
by
宋毅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tj
parent
35878bad
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
283 additions
and
113 deletions
+283
-113
center-app/app/base/api/impl/action/opLog.js
+10
-9
center-app/app/base/api/impl/auth/accessAuth.js
+2
-5
center-app/app/base/db/cache.base.js
+8
-0
center-app/app/base/db/cache/appTokenByHostsCache.js
+12
-11
center-app/app/base/db/cache/appUserPinByLoginPwdCache.js
+11
-11
center-app/app/base/db/cache/appUserPinByLoginVcodeCache.js
+12
-16
center-app/app/base/db/cache/vcodeCache.js
+43
-0
center-app/app/base/db/impl/dbapp/appuserDao.js
+30
-0
center-app/app/base/db/models/dbapp/appuser.js
+15
-14
center-app/app/base/system.js
+1
-1
center-app/app/base/utils/businessManager/opPlatformUtils.js
+0
-0
center-app/app/base/utils/smsClient.js
+105
-12
center-app/app/config/settings.js
+34
-34
No files found.
center-app/app/base/api/impl/action/opLog.js
View file @
d854753d
...
@@ -3,14 +3,14 @@ var system = require("../../../system");
...
@@ -3,14 +3,14 @@ var system = require("../../../system");
const
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
const
logCtl
=
system
.
getObject
(
"service.common.oplogSve"
);
class
opLog
extends
APIBase
{
class
opLog
extends
APIBase
{
constructor
()
{
constructor
()
{
super
();
super
();
}
}
async
info
(
pobj
,
qobj
,
req
)
{
async
info
(
pobj
,
qobj
,
req
)
{
this
.
logCtl
.
info
(
pobj
);
this
.
logCtl
.
info
(
pobj
);
}
}
async
error
(
pobj
,
qobj
,
req
)
{
async
error
(
pobj
,
qobj
,
req
)
{
this
.
logCtl
.
error
(
pobj
);
this
.
logCtl
.
error
(
pobj
);
}
}
}
}
module
.
exports
=
opLog
;
module
.
exports
=
opLog
;
\ No newline at end of file
center-app/app/base/api/impl/auth/accessAuth.js
View file @
d854753d
...
@@ -25,10 +25,7 @@ class AccessAuthAPI extends APIBase {
...
@@ -25,10 +25,7 @@ class AccessAuthAPI extends APIBase {
var
itemResult
=
await
this
.
appmobilemsgSve
.
getItemByUappId
(
pobj
);
var
itemResult
=
await
this
.
appmobilemsgSve
.
getItemByUappId
(
pobj
);
var
result
=
system
.
getResult
(
null
,
"get msg error"
);
var
result
=
system
.
getResult
(
null
,
"get msg error"
);
if
(
itemResult
.
status
!=
0
)
{
if
(
itemResult
.
status
!=
0
)
{
result
=
await
this
.
opPlatformUtils
.
fetchDefaultVCode
(
pobj
.
actionBody
.
mobile
,
pobj
.
appInfo
.
uapp_key
,
pobj
.
appInfo
.
uapp_secret
);
result
=
await
this
.
opPlatformUtils
.
fetchDefaultVCode
(
pobj
.
actionBody
.
mobile
,
pobj
.
appInfo
.
uapp_key
);
console
.
log
(
"--------------fetchDefaultVCode result start"
)
console
.
log
(
result
);
console
.
log
(
"--------------fetchDefaultVCode result end"
)
return
result
;
return
result
;
}
}
var
param
=
{
var
param
=
{
...
@@ -38,7 +35,7 @@ class AccessAuthAPI extends APIBase {
...
@@ -38,7 +35,7 @@ class AccessAuthAPI extends APIBase {
accessKeyId
:
itemResult
.
data
.
access_key_id
,
accessKeyId
:
itemResult
.
data
.
access_key_id
,
accessKeySecret
:
itemResult
.
data
.
access_key_secret
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
;
return
result
;
}
}
...
...
center-app/app/base/db/cache.base.js
View file @
d854753d
...
@@ -7,6 +7,14 @@ class CacheBase {
...
@@ -7,6 +7,14 @@ class CacheBase {
this
.
prefix
=
this
.
prefix
();
this
.
prefix
=
this
.
prefix
();
this
.
cacheCacheKeyPrefix
=
"s_sadd_appkeys:"
+
settings
.
appKey
+
"_cachekey"
;
this
.
cacheCacheKeyPrefix
=
"s_sadd_appkeys:"
+
settings
.
appKey
+
"_cachekey"
;
this
.
isdebug
=
this
.
isdebug
();
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
()
{
isdebug
()
{
return
false
;
return
false
;
...
...
center-app/app/base/db/cache/appTokenByHostsCache.js
View file @
d854753d
...
@@ -14,6 +14,7 @@ class AppTokenByHostsCache extends CacheBase {
...
@@ -14,6 +14,7 @@ class AppTokenByHostsCache extends CacheBase {
prefix
()
{
prefix
()
{
return
settings
.
cacheprefix
+
"_accesskey:"
;
return
settings
.
cacheprefix
+
"_accesskey:"
;
}
}
//优化掉从平台中获取应用信息--sy-2020-10-21
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
var
actionBody
=
val
;
var
actionBody
=
val
;
if
(
!
actionBody
)
{
if
(
!
actionBody
)
{
...
@@ -29,20 +30,20 @@ class AppTokenByHostsCache extends CacheBase {
...
@@ -29,20 +30,20 @@ class AppTokenByHostsCache extends CacheBase {
if
(
!
item
)
{
if
(
!
item
)
{
return
system
.
getResult
(
null
,
"app_hosts to data is empty !"
);
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
)
{
if
(
item
.
is_enabled
!=
1
)
{
return
system
.
getResult
(
null
,
"app_hosts to item is Disable !"
);
return
system
.
getResult
(
null
,
"app_hosts to item is Disable !"
);
}
}
var
result
=
await
this
.
opPlatformUtils
.
getReqApiAccessKey
(
item
.
uapp_key
,
item
.
uapp_secret
);
// if (!item.uapp_key || !item.uapp_secret) {
if
(
!
result
)
{
// return system.getResult(null, "uapp_key or uapp_secret can not be empty !");
return
system
.
getResult
(
null
,
"platform to data is empty !"
);
// }
}
// var result = await this.opPlatformUtils.getReqApiAccessKey(item.uapp_key, item.uapp_secret);
if
(
result
.
status
!=
0
)
{
// if (!result) {
return
result
;
// return system.getResult(null, "platform to data is empty !");
}
// }
item
.
token
=
result
.
data
.
accessKey
;
// if (result.status != 0) {
// return result;
// }
// item.token = result.data.accessKey;
return
system
.
getResultSuccess
(
item
);
return
system
.
getResultSuccess
(
item
);
}
}
}
}
...
...
center-app/app/base/db/cache/appUserPinByLoginPwdCache.js
View file @
d854753d
...
@@ -13,24 +13,24 @@ class AppUserPinByLoginPwdCache extends CacheBase {
...
@@ -13,24 +13,24 @@ class AppUserPinByLoginPwdCache extends CacheBase {
prefix
()
{
prefix
()
{
return
settings
.
cacheprefix
+
"_userPin:"
;
return
settings
.
cacheprefix
+
"_userPin:"
;
}
}
//优化掉从平台中获取应用信息--sy-2020-10-21
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
var
actionBody
=
val
.
actionBody
;
const
actionBody
=
val
.
actionBody
;
var
appInfo
=
val
.
appInfo
;
const
appInfo
=
val
.
appInfo
;
var
uUserName
=
actionBody
.
userName
;
//uUserName
const
uUserName
=
actionBody
.
userName
;
//uUserName
var
uPassword
=
actionBody
.
password
;
//uPassword
const
password
=
await
this
.
getEncryptStr
(
actionBody
.
password
)
;
//uPassword
var
uUserInfo
=
await
this
.
opPlatformUtils
.
login
(
uUserName
,
uPassword
,
//
var uUserInfo = await this.opPlatformUtils.login(uUserName, uPassword,
appInfo
.
uapp_key
,
appInfo
.
uapp_secret
);
//
appInfo.uapp_key, appInfo.uapp_secret);
if
(
uUserInfo
.
status
!=
0
)
{
//
if (uUserInfo.status != 0) {
return
uUserInfo
;
//
return uUserInfo;
}
//值为2010为用户名或密码错误
//
}//值为2010为用户名或密码错误
var
userInfo
=
await
this
.
appuserDao
.
getItemBy
ChannelUserId
(
actionBody
.
userName
,
appInfo
.
uapp_id
);
var
userInfo
=
await
this
.
appuserDao
.
getItemBy
Pwd
(
uUserName
,
password
,
appInfo
.
uapp_id
);
if
(
!
userInfo
)
{
if
(
!
userInfo
)
{
return
system
.
getResult
(
null
,
"user to item is empty !"
);
return
system
.
getResult
(
null
,
"user to item is empty !"
);
}
}
if
(
userInfo
.
is_enabled
!=
1
)
{
if
(
userInfo
.
is_enabled
!=
1
)
{
return
system
.
getResult
(
null
,
"user to item is Disable !"
);
return
system
.
getResult
(
null
,
"user to item is Disable !"
);
}
}
userInfo
.
userpin
=
actionBody
.
userpin
;
return
system
.
getResultSuccess
(
userInfo
);
return
system
.
getResultSuccess
(
userInfo
);
}
}
}
}
...
...
center-app/app/base/db/cache/appUserPinByLoginVcodeCache.js
View file @
d854753d
...
@@ -14,31 +14,27 @@ class AppUserPinByLoginVcodeCache extends CacheBase {
...
@@ -14,31 +14,27 @@ class AppUserPinByLoginVcodeCache extends CacheBase {
return
settings
.
cacheprefix
+
"_userPin:"
;
return
settings
.
cacheprefix
+
"_userPin:"
;
}
}
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
async
buildCacheVal
(
cachekey
,
inputkey
,
val
,
ex
,
...
items
)
{
var
actionBody
=
val
.
actionBody
;
let
actionBody
=
val
.
actionBody
;
var
appInfo
=
val
.
appInfo
;
let
appInfo
=
val
.
appInfo
;
var
uUserInfo
=
await
this
.
opPlatformUtils
.
loginByVCode
(
actionBody
.
mobile
,
actionBody
.
vcode
,
actionBody
.
password
,
let
userInfo
=
await
this
.
appuserDao
.
getItemByChannelUserId
(
actionBody
.
mobile
,
appInfo
.
uapp_id
);
appInfo
.
uapp_key
,
appInfo
.
uapp_secret
);
if
(
uUserInfo
.
status
!=
0
)
{
return
uUserInfo
;
}
//2030验证码校验不成功 或 注册失败
var
userInfo
=
await
this
.
appuserDao
.
getItemByChannelUserId
(
actionBody
.
mobile
,
appInfo
.
uapp_id
);
if
(
userInfo
)
{
if
(
userInfo
)
{
if
(
userInfo
.
is_enabled
!=
1
)
{
if
(
userInfo
.
is_enabled
!=
1
)
{
return
system
.
getResult
(
null
,
"
user to item is Disable !
"
);
return
system
.
getResult
(
null
,
"
用户未启用
"
);
}
}
if
(
actionBody
.
reqType
==
"reg"
)
{
if
(
actionBody
.
reqType
==
=
"reg"
)
{
return
system
.
getResult
Fail
(
system
.
existUserRegFai
l
,
"已经存在此用户,注册失败"
);
return
system
.
getResult
(
nul
l
,
"已经存在此用户,注册失败"
);
}
}
userInfo
.
userpin
=
actionBody
.
userpin
;
return
system
.
getResultSuccess
(
userInfo
);
return
system
.
getResultSuccess
(
userInfo
);
}
}
var
params
=
{
const
uPassword
=
await
this
.
getEncryptStr
((
actionBody
.
password
||
actionBody
.
mobile
));
//uPassword
let
params
=
{
uapp_id
:
appInfo
.
uapp_id
,
uapp_id
:
appInfo
.
uapp_id
,
channel_userid
:
actionBody
.
mobile
||
""
,
channel_userid
:
actionBody
.
mobile
||
""
,
channel_username
:
actionBody
.
mobile
||
""
,
channel_username
:
actionBody
.
mobile
||
""
,
channel_nickname
:
actionBody
.
nickName
||
""
,
channel_nickname
:
actionBody
.
nickName
||
""
,
mobile
:
actionBody
.
mobile
||
""
,
mobile
:
actionBody
.
mobile
||
""
,
password
:
uPassword
,
org_name
:
actionBody
.
orgName
||
""
,
org_name
:
actionBody
.
orgName
||
""
,
org_path
:
actionBody
.
orgPath
||
""
,
org_path
:
actionBody
.
orgPath
||
""
,
is_enabled
:
1
,
is_enabled
:
1
,
...
@@ -46,8 +42,8 @@ class AppUserPinByLoginVcodeCache extends CacheBase {
...
@@ -46,8 +42,8 @@ class AppUserPinByLoginVcodeCache extends CacheBase {
last_login_time
:
new
Date
()
last_login_time
:
new
Date
()
};
};
userInfo
=
await
this
.
appuserDao
.
create
(
params
);
userInfo
=
await
this
.
appuserDao
.
create
(
params
);
userInfo
.
userpin
=
actionBody
.
userpin
;
params
.
password
=
""
;
return
system
.
getResultSuccess
(
userInfo
);
return
system
.
getResultSuccess
(
params
);
}
}
}
}
module
.
exports
=
AppUserPinByLoginVcodeCache
;
module
.
exports
=
AppUserPinByLoginVcodeCache
;
center-app/app/base/db/cache/vcodeCache.js
0 → 100644
View file @
d854753d
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
;
center-app/app/base/db/impl/dbapp/appuserDao.js
View file @
d854753d
...
@@ -27,5 +27,35 @@ class AppuserDao extends Dao {
...
@@ -27,5 +27,35 @@ class AppuserDao extends Dao {
raw
:
true
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
;
module
.
exports
=
AppuserDao
;
center-app/app/base/db/models/dbapp/appuser.js
View file @
d854753d
...
@@ -13,6 +13,7 @@ module.exports = (db, DataTypes) => {
...
@@ -13,6 +13,7 @@ module.exports = (db, DataTypes) => {
org_name
:
DataTypes
.
STRING
(
255
),
org_name
:
DataTypes
.
STRING
(
255
),
org_path
:
DataTypes
.
STRING
(
255
),
org_path
:
DataTypes
.
STRING
(
255
),
email
:
DataTypes
.
STRING
(
50
),
email
:
DataTypes
.
STRING
(
50
),
password
:
DataTypes
.
STRING
(
255
),
is_admin
:
{
is_admin
:
{
type
:
DataTypes
.
BOOLEAN
,
type
:
DataTypes
.
BOOLEAN
,
defaultValue
:
false
,
defaultValue
:
false
,
...
@@ -27,19 +28,19 @@ module.exports = (db, DataTypes) => {
...
@@ -27,19 +28,19 @@ module.exports = (db, DataTypes) => {
},
},
last_login_time
:
DataTypes
.
DATE
,
last_login_time
:
DataTypes
.
DATE
,
},
{
},
{
paranoid
:
false
,
//假的删除
paranoid
:
false
,
//假的删除
underscored
:
true
,
underscored
:
true
,
version
:
true
,
version
:
true
,
freezeTableName
:
true
,
freezeTableName
:
true
,
timestamps
:
true
,
timestamps
:
true
,
updatedAt
:
false
,
updatedAt
:
false
,
//freezeTableName: true,
//freezeTableName: true,
// define the table's name
// define the table's name
tableName
:
'p_app_user'
,
tableName
:
'p_app_user'
,
validate
:
{
validate
:
{
},
},
indexes
:
[
indexes
:
[
]
]
});
});
}
}
center-app/app/base/system.js
View file @
d854753d
...
@@ -294,7 +294,7 @@ Date.prototype.Format = function (fmt) { //author: meizz
...
@@ -294,7 +294,7 @@ Date.prototype.Format = function (fmt) { //author: meizz
System
.
exTime
=
4
*
3600
;
//缓存过期时间,4小时
System
.
exTime
=
4
*
3600
;
//缓存过期时间,4小时
System
.
shortExTime
=
300
;
//
300
System
.
shortExTime
=
300
;
//
缓存过期时间,5分钟
//缓存失效
//缓存失效
System
.
cacheInvalidation
=
-
88
;
System
.
cacheInvalidation
=
-
88
;
...
...
center-app/app/base/utils/businessManager/opPlatformUtils.js
View file @
d854753d
This diff is collapsed.
Click to expand it.
center-app/app/base/utils/smsClient.js
View file @
d854753d
const
system
=
require
(
"../system"
);
const
system
=
require
(
"../system"
);
class
SmsClient
{
const
Core
=
require
(
'@alicloud/pop-core'
);
constructor
(){
class
SmsClient
{
this
.
smsTeml
=
"http://123.57.156.109:4103/api/Send"
;
constructor
()
{
this
.
restClient
=
system
.
getObject
(
"util.restClient"
);
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'
});
}
/**
* 公司宝阿里云发送
* @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
}
}
async
sendMsg
(
to
,
content
){
var
requestOption
=
{
var
txtObj
=
{
method
:
'POST'
"appId"
:
8
,
};
"mobilePhone"
:
to
,
this
.
aliclient
.
request
(
'SendSms'
,
params
,
requestOption
).
then
((
result
)
=>
{
"content"
:
content
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
this
.
restClient
.
execPost
(
txtObj
,
this
.
smsTeml
);
}
}
return
uuid
.
join
(
''
);
}
}
}
module
.
exports
=
SmsClient
;
module
.
exports
=
SmsClient
;
// var sms=new SmsClient();
// sms.aliSendMsg("13381139519","SMS_173946419","iboss",JSON.stringify({code:"hello"}));
center-app/app/config/settings.js
View file @
d854753d
var
path
=
require
(
'path'
);
var
path
=
require
(
'path'
);
var
ENVINPUT
=
{
var
ENVINPUT
=
{
DB_HOST
:
process
.
env
.
DB_HOST
,
DB_HOST
:
process
.
env
.
DB_HOST
,
DB_PORT
:
process
.
env
.
DB_PORT
,
DB_PORT
:
process
.
env
.
DB_PORT
,
DB_USER
:
process
.
env
.
DB_USER
,
DB_USER
:
process
.
env
.
DB_USER
,
DB_PWD
:
process
.
env
.
DB_PWD
,
DB_PWD
:
process
.
env
.
DB_PWD
,
DB_NAME
:
process
.
env
.
CENTER_APP_DB_NAME
,
DB_NAME
:
process
.
env
.
CENTER_APP_DB_NAME
,
REDIS_HOST
:
process
.
env
.
REDIS_HOST
,
REDIS_HOST
:
process
.
env
.
REDIS_HOST
,
REDIS_PORT
:
process
.
env
.
REDIS_PORT
,
REDIS_PORT
:
process
.
env
.
REDIS_PORT
,
REDIS_PWD
:
process
.
env
.
REDIS_PWD
,
REDIS_PWD
:
process
.
env
.
REDIS_PWD
,
REDIS_DB
:
process
.
env
.
CENTER_APP_REDIS_DB
,
REDIS_DB
:
process
.
env
.
CENTER_APP_REDIS_DB
,
APP_ENV
:
process
.
env
.
APP_ENV
?
process
.
env
.
APP_ENV
:
"dev"
APP_ENV
:
process
.
env
.
APP_ENV
?
process
.
env
.
APP_ENV
:
"dev"
};
};
var
settings
=
{
var
settings
=
{
env
:
ENVINPUT
.
APP_ENV
,
env
:
ENVINPUT
.
APP_ENV
,
appKey
:
"201911061250"
,
appKey
:
"201911061250"
,
secret
:
"f99d413b767f09b5dff0b3610366cc46"
,
secret
:
"f99d413b767f09b5dff0b3610366cc46"
,
salt
:
"%iatpD1gcxz7iF#B"
,
salt
:
"%iatpD1gcxz7iF#B"
,
...
@@ -79,10 +79,10 @@ var settings = {
...
@@ -79,10 +79,10 @@ var settings = {
return
localsettings
.
redis
;
return
localsettings
.
redis
;
}
else
{
}
else
{
return
{
return
{
host
:
ENVINPUT
.
REDIS_HOST
,
host
:
ENVINPUT
.
REDIS_HOST
,
port
:
ENVINPUT
.
REDIS_PORT
,
port
:
ENVINPUT
.
REDIS_PORT
,
password
:
ENVINPUT
.
REDIS_PWD
,
password
:
ENVINPUT
.
REDIS_PWD
,
db
:
ENVINPUT
.
REDIS_DB
,
db
:
ENVINPUT
.
REDIS_DB
,
};
};
}
}
},
},
...
@@ -92,24 +92,24 @@ var settings = {
...
@@ -92,24 +92,24 @@ var settings = {
return
localsettings
.
database
;
return
localsettings
.
database
;
}
else
{
}
else
{
return
{
return
{
dbname
:
ENVINPUT
.
DB_NAME
,
dbname
:
ENVINPUT
.
DB_NAME
,
user
:
ENVINPUT
.
DB_USER
,
user
:
ENVINPUT
.
DB_USER
,
password
:
ENVINPUT
.
DB_PWD
,
password
:
ENVINPUT
.
DB_PWD
,
config
:
{
config
:
{
host
:
ENVINPUT
.
DB_HOST
,
host
:
ENVINPUT
.
DB_HOST
,
dialect
:
'mysql'
,
dialect
:
'mysql'
,
operatorsAliases
:
false
,
operatorsAliases
:
false
,
pool
:
{
pool
:
{
max
:
5
,
max
:
5
,
min
:
0
,
min
:
0
,
acquire
:
90000000
,
acquire
:
90000000
,
idle
:
1000000
idle
:
1000000
},
},
debug
:
false
,
debug
:
false
,
dialectOptions
:
{
dialectOptions
:
{
requestTimeout
:
999999
,
requestTimeout
:
999999
,
// instanceName:'DEV'
// instanceName:'DEV'
}
//设置MSSQL超时时间
}
//设置MSSQL超时时间
},
},
};
};
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment