Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
zcq
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
svn
zcq
Commits
6a65e6a9
提交
6a65e6a9
authored
4月 14, 2020
作者:
xinjunguo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
上级
85e4f488
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
32 行增加
和
4 行删除
+32
-4
SmsController.java
...third/src/main/java/com/zrqx/third/sms/SmsController.java
+1
-1
SmsConfig.java
...rd/src/main/java/com/zrqx/third/sms/config/SmsConfig.java
+3
-3
WeChatLoginXcxController.java
.../com/zrqx/third/wechatlogin/WeChatLoginXcxController.java
+23
-0
WeChatLoginXcxConfig.java
...m/zrqx/third/wechatlogin/config/WeChatLoginXcxConfig.java
+5
-0
没有找到文件。
com.zrqx.third/src/main/java/com/zrqx/third/sms/SmsController.java
浏览文件 @
6a65e6a9
...
...
@@ -53,7 +53,7 @@ public class SmsController {
//必填:短信签名-可在短信控制台中找到
request
.
setSignName
(
SmsConfig
.
signName
);
//必填:短信模板-可在短信控制台中找到
request
.
setTemplateCode
(
SmsEnum
.
getName
(
smsForm
.
getType
())
);
request
.
setTemplateCode
(
"SMS_187742235"
);
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
request
.
setTemplateParam
(
"{'name':'"
+
smsForm
.
getName
()+
"', 'code':'"
+
smsForm
.
getCode
()+
"'}"
);
...
...
com.zrqx.third/src/main/java/com/zrqx/third/sms/config/SmsConfig.java
浏览文件 @
6a65e6a9
...
...
@@ -8,9 +8,9 @@ public class SmsConfig {
public
static
String
domain
=
"dysmsapi.aliyuncs.com"
;
// TODO 此处需要替换成开发者自己的AK(在阿里云访问控制台寻找)
public
static
String
accessKeyId
=
"LTAI
EvKzhAFYvN8T
"
;
public
static
String
accessKeySecret
=
"
lE7dkXvPEBDMyoar2uX2zrzOD6QUuR
"
;
public
static
String
accessKeyId
=
"LTAI
4Fbem4wa7sFHxk1m2vy2
"
;
public
static
String
accessKeySecret
=
"
1KcvFFHnv2bnWpLSMe41EwZ9PSAFwo
"
;
//必填:短信签名-可在短信控制台中找到
public
static
String
signName
=
"
北京中软启信技术有限公司
"
;
public
static
String
signName
=
"
中国市场出版社
"
;
}
com.zrqx.third/src/main/java/com/zrqx/third/wechatlogin/WeChatLoginXcxController.java
浏览文件 @
6a65e6a9
...
...
@@ -96,5 +96,28 @@ public class WeChatLoginXcxController {
}
return
CallBack
.
success
(
unionId
);
}
@ApiOperation
(
value
=
"获取分享二维码"
,
notes
=
"获取分享二维码"
)
@GetMapping
(
RequestPath
.
QR
)
public
CallBack
<
String
>
getQr
(
HttpServletRequest
request
)
throws
Exception
{
String
appid
=
"appid="
+
WeChatLoginXcxConfig
.
APPID
;
String
secret
=
"&secret="
+
WeChatLoginXcxConfig
.
SECRET
;
String
param
=
appid
+
secret
;
String
result
=
HttpsUtils
.
sendGet
(
WeChatLoginXcxConfig
.
ACCESSTOKEN
,
param
);
JSONObject
object
=
(
JSONObject
)
JSON
.
parse
(
result
);
//判断接口是否调用成功
if
(
object
.
containsKey
(
"errcode"
)){
throw
new
BaseException
(
ResponseCodeEnum
.
EXCEPTION
.
getCode
(),
object
.
get
(
"errcode"
).
toString
());
}
String
access_token
=
object
.
get
(
"access_token"
).
toString
();
String
res
=
HttpsUtils
.
sendGet
(
WeChatLoginXcxConfig
.
QR
,
"access_token="
+
access_token
);
JSONObject
ob
=
(
JSONObject
)
JSON
.
parse
(
res
);
//判断接口是否调用成功
if
(
object
.
containsKey
(
"errcode"
)){
throw
new
BaseException
(
ResponseCodeEnum
.
EXCEPTION
.
getCode
(),
object
.
get
(
"errcode"
).
toString
());
}
String
path
=
object
.
get
(
"path"
).
toString
();
return
CallBack
.
success
(
path
);
}
}
com.zrqx.third/src/main/java/com/zrqx/third/wechatlogin/config/WeChatLoginXcxConfig.java
浏览文件 @
6a65e6a9
...
...
@@ -16,6 +16,11 @@ public class WeChatLoginXcxConfig {
public
final
static
String
CODE2SESSION
=
"https://api.weixin.qq.com/sns/jscode2session"
;
//回调域
public
final
static
String
REDIRECTURI
=
"zgsccbs.com"
;
// 微信小程序获取ACCESSTOKEN
public
final
static
String
ACCESSTOKEN
=
"https://api.weixin.qq.com/cgi-bin/token"
;
public
final
static
String
QR
=
"https://api.weixin.qq.com/wxa/getwxacode"
;
public
static
String
getParam
(
String
code
)
{
String
appid
=
"appid="
+
WeChatLoginXcxConfig
.
APPID
;
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论