Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
beyond-clouds
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
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
段启岩
beyond-clouds
Commits
04624d3d
Commit
04624d3d
authored
Jan 18, 2020
by
段启岩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
短信发送代码更新
parent
5a20fa1b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
src/main/java/cn/meteor/beyondclouds/common/helper/impl/OssHelperImpl.java
+3
-3
src/main/java/cn/meteor/beyondclouds/common/helper/impl/SmsHelperImpl.java
+5
-1
No files found.
src/main/java/cn/meteor/beyondclouds/common/helper/impl/OssHelperImpl.java
View file @
04624d3d
...
@@ -29,13 +29,13 @@ public class OssHelperImpl implements IOssHelper {
...
@@ -29,13 +29,13 @@ public class OssHelperImpl implements IOssHelper {
}
}
@Override
@Override
public
String
upload
(
InputStream
ins
,
String
path
)
throws
OssException
{
public
String
upload
(
InputStream
ins
,
String
uploadTo
)
throws
OssException
{
try
{
try
{
PutObjectRequest
putObjectRequest
=
new
PutObjectRequest
(
aliyunProperties
.
getOss
().
getBucket
(),
path
,
ins
);
PutObjectRequest
putObjectRequest
=
new
PutObjectRequest
(
aliyunProperties
.
getOss
().
getBucket
(),
uploadTo
,
ins
);
PutObjectResult
result
=
ossClient
.
putObject
(
putObjectRequest
);
PutObjectResult
result
=
ossClient
.
putObject
(
putObjectRequest
);
String
baseUrl
=
aliyunProperties
.
getOss
().
getBaseUrl
();
String
baseUrl
=
aliyunProperties
.
getOss
().
getBaseUrl
();
String
downloadUrl
=
baseUrl
.
endsWith
(
"/"
)
?
baseUrl
+
path
:
baseUrl
+
"/"
+
path
;
String
downloadUrl
=
baseUrl
.
endsWith
(
"/"
)
?
baseUrl
+
uploadTo
:
baseUrl
+
"/"
+
uploadTo
;
return
downloadUrl
;
return
downloadUrl
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
OssException
(
"文件上传失败"
,
e
);
throw
new
OssException
(
"文件上传失败"
,
e
);
...
...
src/main/java/cn/meteor/beyondclouds/common/helper/impl/SmsHelperImpl.java
View file @
04624d3d
...
@@ -44,7 +44,7 @@ public class SmsHelperImpl implements ISmsHelper {
...
@@ -44,7 +44,7 @@ public class SmsHelperImpl implements ISmsHelper {
@Override
@Override
public
void
sendSms
(
String
templateCode
,
Map
<
String
,
String
>
templateParam
,
String
...
mobiles
)
throws
SmsException
{
public
void
sendSms
(
String
templateCode
,
Map
<
String
,
String
>
templateParam
,
String
...
mobiles
)
throws
SmsException
{
Assert
.
notEmpty
(
mobiles
,
"请至少传入一个手机号!"
);
// 将数组形式的手机号列表转换为用逗号分割的手机号字符串
// 将数组形式的手机号列表转换为用逗号分割的手机号字符串
String
mobilesStr
=
Arrays
.
stream
(
mobiles
).
map
(
mobile
->
mobile
+
","
).
collect
(
Collectors
.
joining
());
String
mobilesStr
=
Arrays
.
stream
(
mobiles
).
map
(
mobile
->
mobile
+
","
).
collect
(
Collectors
.
joining
());
mobilesStr
=
mobilesStr
.
substring
(
0
,
mobilesStr
.
length
()
-
1
);
mobilesStr
=
mobilesStr
.
substring
(
0
,
mobilesStr
.
length
()
-
1
);
...
@@ -74,6 +74,10 @@ public class SmsHelperImpl implements ISmsHelper {
...
@@ -74,6 +74,10 @@ public class SmsHelperImpl implements ISmsHelper {
}
}
}
}
public
static
void
main
(
String
[]
args
)
throws
SmsException
{
new
SmsHelperImpl
().
sendSms
(
""
,
Map
.
of
());
}
@Override
@Override
public
Map
<
String
,
String
>
getTemplateCodeMap
()
{
public
Map
<
String
,
String
>
getTemplateCodeMap
()
{
return
aliyunProperties
.
getSms
().
getTemplateCodeMap
();
return
aliyunProperties
.
getSms
().
getTemplateCodeMap
();
...
...
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