Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
platform
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王琮
platform
Commits
cd39595d
Commit
cd39595d
authored
Nov 16, 2023
by
刘鑫鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改发送短信接口
parent
84287542
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
10 deletions
+78
-10
SpaceMessageCtrl.java
src/main/java/com/tiptimes/ctrl/SpaceMessageCtrl.java
+4
-10
SendMessageUtil.java
src/main/java/com/tiptimes/util/SendMessageUtil.java
+74
-0
No files found.
src/main/java/com/tiptimes/ctrl/SpaceMessageCtrl.java
View file @
cd39595d
...
@@ -27,15 +27,8 @@ import com.tiptimes.service.SpaceFundService;
...
@@ -27,15 +27,8 @@ import com.tiptimes.service.SpaceFundService;
import
com.tiptimes.service.SpaceMessageService
;
import
com.tiptimes.service.SpaceMessageService
;
import
com.tiptimes.service.TeamMessageService
;
import
com.tiptimes.service.TeamMessageService
;
import
com.tiptimes.service.UserService
;
import
com.tiptimes.service.UserService
;
import
com.tiptimes.util.BASE64Util
;
import
com.tiptimes.util.*
;
import
com.tiptimes.util.DATEUtil
;
import
com.tiptimes.util.ExcelUtil
;
import
com.tiptimes.util.MD5Util
;
import
com.tiptimes.util.NumberUtil
;
import
com.tiptimes.util.RandomNumUtil
;
import
com.tiptimes.util.RegexValidateUtil
;
import
com.tiptimes.util.UUIDUtils
;
import
com.tiptimes.util.yuntongxunSMSUtil
;
import
java.io.OutputStream
;
import
java.io.OutputStream
;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLDecoder
;
import
java.net.URLDecoder
;
...
@@ -324,7 +317,8 @@ public class SpaceMessageCtrl {
...
@@ -324,7 +317,8 @@ public class SpaceMessageCtrl {
SpaceMessage
spaceMessage
=
this
.
spaceMessageService
.
getSpaceMessageBySpaceMessageID
(
spaceMessageID
);
SpaceMessage
spaceMessage
=
this
.
spaceMessageService
.
getSpaceMessageBySpaceMessageID
(
spaceMessageID
);
if
(
spaceMessage
!=
null
)
{
if
(
spaceMessage
!=
null
)
{
if
(!
""
.
equals
(
spaceMessage
.
getPrincipalTell
()))
{
if
(!
""
.
equals
(
spaceMessage
.
getPrincipalTell
()))
{
boolean
a
=
yuntongxunSMSUtil
.
sandSMSPassword
(
spaceMessage
.
getPrincipalTell
(),
password_str
);
Boolean
a
=
SendMessageUtil
.
sendMessage
(
spaceMessage
.
getPrincipalTell
(),
password_str
);
// boolean a = yuntongxunSMSUtil.sandSMSPassword(spaceMessage.getPrincipalTell(), password_str);
System
.
err
.
println
(
password_str
);
System
.
err
.
println
(
password_str
);
if
(
a
)
{
if
(
a
)
{
userLogin
.
setUserPassword
(
MD5Util
.
encryptByMD5
(
password_str
));
userLogin
.
setUserPassword
(
MD5Util
.
encryptByMD5
(
password_str
));
...
...
src/main/java/com/tiptimes/util/SendMessageUtil.java
0 → 100644
View file @
cd39595d
package
com
.
tiptimes
.
util
;
import
java.io.BufferedReader
;
import
java.io.InputStreamReader
;
import
java.net.HttpURLConnection
;
import
java.net.URL
;
import
java.net.URLEncoder
;
import
java.time.Duration
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
public
class
SendMessageUtil
{
public
static
Boolean
sendMessage
(
String
tell
,
String
code
)
{
try
{
// 设置请求的 URL
String
urlString
=
"http://124.251.7.232:9100/QxtSms/QxtFirewall"
;
String
name
=
"tjsrj"
;
String
pass
=
"T6jes@832#TJ"
;
// 获取当前时间
LocalDateTime
now
=
LocalDateTime
.
now
();
// 定义时间增量为5秒
Duration
duration
=
Duration
.
ofSeconds
(
5
);
// 增加时间增量
LocalDateTime
later
=
now
.
plus
(
duration
);
// 定义日期时间格式
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyyMMddHHmmss"
);
// 格式化当前时间
String
sendtime
=
later
.
format
(
formatter
);
String
content
=
"【天津高校众创空间运营管理信息平台】您重置后的密码是:"
+
code
;
StringBuilder
queryParams
=
new
StringBuilder
();
queryParams
.
append
(
"name="
).
append
(
URLEncoder
.
encode
(
name
,
"UTF-8"
));
queryParams
.
append
(
"&pass="
).
append
(
URLEncoder
.
encode
(
pass
,
"UTF-8"
));
queryParams
.
append
(
"&mobiles="
).
append
(
URLEncoder
.
encode
(
tell
,
"UTF-8"
));
queryParams
.
append
(
"&content="
).
append
(
URLEncoder
.
encode
(
content
,
"UTF-8"
));
queryParams
.
append
(
"&sendtime="
).
append
(
URLEncoder
.
encode
(
sendtime
,
"UTF-8"
));
String
requestUrl
=
urlString
+
"?"
+
queryParams
.
toString
();
URL
url
=
new
URL
(
requestUrl
);
// 创建连接对象
HttpURLConnection
connection
=
(
HttpURLConnection
)
url
.
openConnection
();
// 设置请求方法为 GET
connection
.
setRequestMethod
(
"GET"
);
// 发送请求并获取响应
int
responseCode
=
connection
.
getResponseCode
();
BufferedReader
reader
=
new
BufferedReader
(
new
InputStreamReader
(
connection
.
getInputStream
()));
String
line
;
StringBuilder
response
=
new
StringBuilder
();
while
((
line
=
reader
.
readLine
())
!=
null
)
{
response
.
append
(
line
);
}
reader
.
close
();
// 获取响应字符串
String
responseBody
=
response
.
toString
();
// 判断响应结果并返回布尔值
if
(
responseBody
.
endsWith
(
",00"
))
{
return
true
;
}
else
{
return
false
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
false
;
}
}
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