Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
peizhen-java
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
PeiZhen-Java
peizhen-java
Commits
a68531ce
Commit
a68531ce
authored
Sep 28, 2023
by
邹磊浩
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改代码
parent
5a989f61
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
32 deletions
+23
-32
pz-admin/src/main/java/com/pz/web/controller/common/CaptchaController.java
+3
-2
pz-admin/src/main/resources/application-dev.yml
+0
-10
pz-sms/src/main/java/com/pz/sms/config/properties/SmsProperties.java
+20
-20
No files found.
pz-admin/src/main/java/com/pz/web/controller/common/CaptchaController.java
View file @
a68531ce
...
...
@@ -58,15 +58,16 @@ public class CaptchaController {
* @param phonenumber 用户手机号
*/
@GetMapping
(
"/captchaSms"
)
@SaIgnore
public
R
<
Void
>
smsCaptcha
(
@NotBlank
(
message
=
"{user.phonenumber.not.blank}"
)
String
phonenumber
)
{
String
key
=
CacheConstants
.
CAPTCHA_CODE_KEY
+
phonenumber
;
String
code
=
RandomUtil
.
randomNumbers
(
4
);
RedisUtils
.
setCacheObject
(
key
,
code
,
Duration
.
ofMinutes
(
Constants
.
CAPTCHA_EXPIRATION
));
// 验证码模板id 自行处理 (查数据库或写死均可)
String
templateId
=
""
;
String
templateId
=
"
1942221
"
;
LinkedHashMap
<
String
,
String
>
map
=
new
LinkedHashMap
<>(
1
);
map
.
put
(
"code"
,
code
);
SmsBlend
smsBlend
=
SmsFactory
.
createSmsBlend
(
SupplierType
.
ALIBABA
);
SmsBlend
smsBlend
=
SmsFactory
.
createSmsBlend
(
SupplierType
.
TENCENT
);
SmsResponse
smsResponse
=
smsBlend
.
sendMessage
(
phonenumber
,
templateId
,
map
);
if
(!
"OK"
.
equals
(
smsResponse
.
getCode
()))
{
log
.
error
(
"验证码短信发送异常 => {}"
,
smsResponse
);
...
...
pz-admin/src/main/resources/application-dev.yml
View file @
a68531ce
...
...
@@ -161,16 +161,6 @@ mail:
---
# sms 短信 支持 阿里云 腾讯云 云片 等等各式各样的短信服务商
# https://wind.kim/doc/start 文档地址 各个厂商可同时使用
sms
:
# 阿里云 dysmsapi.aliyuncs.com
alibaba
:
#请求地址 默认为 dysmsapi.aliyuncs.com 如无特殊改变可以不用设置
requestUrl
:
dysmsapi.aliyuncs.com
#阿里云的accessKey
accessKeyId
:
xxxxxxx
#阿里云的accessKeySecret
accessKeySecret
:
xxxxxxx
#短信签名
signature
:
测试
tencent
:
#请求地址默认为 sms.tencentcloudapi.com 如无特殊改变可不用设置
requestUrl
:
sms.tencentcloudapi.com
...
...
pz-sms/src/main/java/com/pz/sms/config/properties/SmsProperties.java
View file @
a68531ce
//
package com.pz.sms.config.properties;
//
//
import lombok.Data;
//
import org.springframework.boot.context.properties.ConfigurationProperties;
//
import org.springframework.stereotype.Component;
//
/
//
**
//
* SMS短信 配置属性
//
*
//
* @author Lion Li
//
* @version 4.2.0
//
*/
//
@Data
//
@Component
//
@ConfigurationProperties(prefix = "sms")
//
public class SmsProperties {
//
//
private Boolean enabled;
//
//
}
package
com
.
pz
.
sms
.
config
.
properties
;
import
lombok.Data
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.stereotype.Component
;
/**
* SMS短信 配置属性
*
* @author Lion Li
* @version 4.2.0
*/
@Data
@Component
@ConfigurationProperties
(
prefix
=
"sms"
)
public
class
SmsProperties
{
private
Boolean
enabled
;
}
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