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
c4125e0e
Commit
c4125e0e
authored
Aug 14, 2020
by
v_vjyjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
bc8e3354
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
16 deletions
+16
-16
center-manage/app/base/db/cache/vcodeCache.js
+1
-1
center-manage/app/base/utils/smsClient.js
+15
-15
No files found.
center-manage/app/base/db/cache/vcodeCache.js
View file @
c4125e0e
...
@@ -23,7 +23,7 @@ class VCodeCache extends CacheBase {
...
@@ -23,7 +23,7 @@ class VCodeCache extends CacheBase {
var
signName
=
items
?
items
[
0
]
:
""
;
var
signName
=
items
?
items
[
0
]
:
""
;
var
vcode
=
await
this
.
smsUtil
.
getUidStr
(
6
,
10
);
var
vcode
=
await
this
.
smsUtil
.
getUidStr
(
6
,
10
);
if
(
!
tmplCode
&&
!
signName
)
{
if
(
!
tmplCode
&&
!
signName
)
{
console
.
log
(
"====================================="
)
console
.
log
(
"====================================="
,
mobile
,
vcode
)
this
.
smsUtil
.
sendMsg
(
mobile
,
vcode
);
this
.
smsUtil
.
sendMsg
(
mobile
,
vcode
);
}
//tmplCode为发送短信编码,需在阿里开通,signName为短信头描述信息,二者没有传递则用默认的发送验证码
}
//tmplCode为发送短信编码,需在阿里开通,signName为短信头描述信息,二者没有传递则用默认的发送验证码
else
{
else
{
...
...
center-manage/app/base/utils/smsClient.js
View file @
c4125e0e
const
system
=
require
(
"../system"
);
const
system
=
require
(
"../system"
);
const
Core
=
require
(
'@alicloud/pop-core'
);
const
Core
=
require
(
'@alicloud/pop-core'
);
class
SmsClient
{
class
SmsClient
{
constructor
()
{
constructor
()
{
this
.
smsTeml
=
"http://123.57.156.109:4103/api/Send"
;
this
.
smsTeml
=
"http://123.57.156.109:4103/api/Send"
;
this
.
restClient
=
system
.
getObject
(
"util.restClient"
);
this
.
restClient
=
system
.
getObject
(
"util.restClient"
);
this
.
aliclient
=
new
Core
({
this
.
aliclient
=
new
Core
({
accessKeyId
:
'LTAI4FtNp3wcqFzaADvo1WtZ'
,
accessKeyId
:
'LTAI4FtNp3wcqFzaADvo1WtZ'
,
accessKeySecret
:
'VBKn1Anx4UmMF0LKNz7PVaCFG1phcg'
,
accessKeySecret
:
'VBKn1Anx4UmMF0LKNz7PVaCFG1phcg'
,
endpoint
:
'https://dysmsapi.aliyuncs.com'
,
endpoint
:
'https://dysmsapi.aliyuncs.com'
,
...
@@ -13,7 +13,7 @@ class SmsClient{
...
@@ -13,7 +13,7 @@ class SmsClient{
}
}
async
aliSendMsg
(
to
,
tmplcode
,
signName
,
jsonContent
)
{
async
aliSendMsg
(
to
,
tmplcode
,
signName
,
jsonContent
)
{
var
params
=
{
var
params
=
{
"RegionId"
:
"default"
,
"RegionId"
:
"default"
,
"PhoneNumbers"
:
to
,
"PhoneNumbers"
:
to
,
...
@@ -31,15 +31,15 @@ class SmsClient{
...
@@ -31,15 +31,15 @@ class SmsClient{
})
})
}
}
async
sendMsg
(
to
,
content
)
{
async
sendMsg
(
to
,
content
)
{
var
txtObj
=
{
var
txtObj
=
{
"appId"
:
8
,
"appId"
:
8
,
"mobilePhone"
:
to
,
"mobilePhone"
:
to
,
"content"
:
content
"content"
:
content
}
}
return
this
.
restClient
.
execPost
(
txtObj
,
this
.
smsTeml
);
return
this
.
restClient
.
execPost
(
txtObj
,
this
.
smsTeml
);
}
}
async
getUidStr
(
len
,
radix
)
{
async
getUidStr
(
len
,
radix
)
{
var
chars
=
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
.
split
(
''
);
var
chars
=
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
.
split
(
''
);
var
uuid
=
[],
i
;
var
uuid
=
[],
i
;
radix
=
radix
||
chars
.
length
;
radix
=
radix
||
chars
.
length
;
...
@@ -60,7 +60,7 @@ class SmsClient{
...
@@ -60,7 +60,7 @@ class SmsClient{
}
}
}
}
module
.
exports
=
SmsClient
;
module
.
exports
=
SmsClient
;
// var sms=new SmsClient();
// var sms=new SmsClient();
// sms.aliSendMsg("13381139519","SMS_173946419","iboss",JSON.stringify({code:"hello"}));
// sms.aliSendMsg("13381139519","SMS_173946419","iboss",JSON.stringify({code:"hello"}));
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