Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
mica
mica-weixin
提交
75fa6d8b
M
mica-weixin
项目概览
mica
/
mica-weixin
通知
8
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mica-weixin
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
75fa6d8b
编写于
4月 20, 2018
作者:
如梦技术
🐛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: v1.2.0 消息控制器默认为多例,因为 jfinal-weixin 控制器上 inMsg 作为了全局变量。
上级
ebe4da27
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
65 addition
and
12 deletion
+65
-12
README.md
README.md
+24
-4
spring-boot-starter-weixin/gradle.properties
spring-boot-starter-weixin/gradle.properties
+1
-1
spring-boot-starter-weixin/src/main/java/net/dreamlu/weixin/annotation/WxMsgController.java
...n/java/net/dreamlu/weixin/annotation/WxMsgController.java
+3
-0
spring-boot-starter-weixin/src/main/java/net/dreamlu/weixin/config/WeixinAppConfig.java
.../main/java/net/dreamlu/weixin/config/WeixinAppConfig.java
+3
-0
spring-boot-starter-weixin/src/main/java/net/dreamlu/weixin/config/WxaMsgParser.java
...src/main/java/net/dreamlu/weixin/config/WxaMsgParser.java
+10
-0
spring-boot-starter-weixin/src/main/java/net/dreamlu/weixin/properties/DreamWeixinProperties.java
.../net/dreamlu/weixin/properties/DreamWeixinProperties.java
+21
-4
spring-boot-weixin-demo/pom.xml
spring-boot-weixin-demo/pom.xml
+2
-2
spring-boot-weixin-demo/src/main/java/com/example/demo/WeixinController.java
...demo/src/main/java/com/example/demo/WeixinController.java
+1
-1
未找到文件。
README.md
浏览文件 @
75fa6d8b
...
...
@@ -8,7 +8,7 @@ jfinal weixin 的 spring boot starter,这个starter是为了方便boot用户
<dependency>
<groupId>
net.dreamlu
</groupId>
<artifactId>
spring-boot-starter-weixin
</artifactId>
<version>
1.
1
.0
</version>
<version>
1.
2
.0
</version>
</dependency>
```
...
...
@@ -47,7 +47,22 @@ jfinal weixin 的 spring boot starter,这个starter是为了方便boot用户
| dream.weixin.wxa-config | 小程序配置 | 小程序配置 |
`注意`
:
-
可参考demo中的
[
application.yml
](
spring-boot-weixin-demo/src/main/resources/application.yml
)
-
demo中的
`application.yml`
```
yml
dream
:
weixin
:
dev-mode
:
true
wx-configs
:
-
appId
:
wx9803d1188fa5fbda
appSecret
:
db859c968763c582794e7c3d003c3d87
-
appId
:
wxc03edcd008ad1e70
appSecret
:
11ed9e2b8e3e3c131e7be320a42b2b5a
token
:
123456
wxa-config
:
appid
:
wx4f53594f9a6b3dcb
appSecret
:
eec6482ba3804df05bd10895bace0579
```
-
cache使用spring的cache,需要
`@EnableCaching`
开启。
-
`access-token-cache`
建议配置有效时间7100秒。
...
...
@@ -56,13 +71,18 @@ jfinal weixin 的 spring boot starter,这个starter是为了方便boot用户
<img
src=
"https://gitee.com/uploads/images/2018/0311/153556_679db579_372.jpeg"
width=
"250px"
/>
## VIP群
捐助
¥199
即可加入如梦技术VIP,捐助后联系QQ: 596392912
捐助
~~¥199~~限时¥99,
即可加入如梦技术VIP,捐助后联系QQ: 596392912
#### VIP权益
1.
spring boot版安全框架(maven + spring boot + spring security + thymeleaf)
2.
技术资料共享
2.
技术资料共享
,技术指导和技术路线规划。
3.
spring cloud脚手架(改造中)
4.
更多私有Git资源,
### spring boot版安全框架 Demo
地址:http://demo.dreamlu.net
账号vs密码:test、test
spring-boot-starter-weixin/gradle.properties
浏览文件 @
75fa6d8b
VERSION
=
1.
1
.0
VERSION
=
1.
2
.0
GROUPID
=
net.dreamlu
userName
=
chunmeng
...
...
spring-boot-starter-weixin/src/main/java/net/dreamlu/weixin/annotation/WxMsgController.java
浏览文件 @
75fa6d8b
package
net.dreamlu.weixin.annotation
;
import
org.springframework.beans.factory.config.ConfigurableBeanFactory
;
import
org.springframework.context.annotation.Scope
;
import
org.springframework.stereotype.Component
;
import
java.lang.annotation.*
;
...
...
@@ -13,6 +15,7 @@ import java.lang.annotation.*;
@Retention
(
RetentionPolicy
.
RUNTIME
)
@Documented
@Component
@Scope
(
ConfigurableBeanFactory
.
SCOPE_PROTOTYPE
)
public
@interface
WxMsgController
{
String
value
()
default
"/"
;
...
...
spring-boot-starter-weixin/src/main/java/net/dreamlu/weixin/config/WeixinAppConfig.java
浏览文件 @
75fa6d8b
...
...
@@ -27,5 +27,8 @@ public class WeixinAppConfig implements InitializingBean {
WxaConfig
wxaConfig
=
weixinProperties
.
getWxaConfig
();
WxaConfigKit
.
setDevMode
(
isdev
);
WxaConfigKit
.
setWxaConfig
(
wxaConfig
);
if
(
WxaMsgParser
.
JSON
==
weixinProperties
.
getWxaMsgParser
())
{
WxaConfigKit
.
useJsonMsgParser
();
}
}
}
spring-boot-starter-weixin/src/main/java/net/dreamlu/weixin/config/WxaMsgParser.java
0 → 100644
浏览文件 @
75fa6d8b
package
net.dreamlu.weixin.config
;
/**
* 小程序消息解析
*
* @author L.cm
*/
public
enum
WxaMsgParser
{
JSON
,
XML
}
spring-boot-starter-weixin/src/main/java/net/dreamlu/weixin/properties/DreamWeixinProperties.java
浏览文件 @
75fa6d8b
...
...
@@ -4,6 +4,7 @@ import com.jfinal.weixin.sdk.api.ApiConfig;
import
com.jfinal.wxaapp.WxaConfig
;
import
lombok.Getter
;
import
lombok.Setter
;
import
net.dreamlu.weixin.config.WxaMsgParser
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
java.util.ArrayList
;
...
...
@@ -13,35 +14,51 @@ import java.util.List;
public
class
DreamWeixinProperties
{
/**
* JFinal filter拦截的路由
* JFinal filter拦截的路由
,默认:/weixin/*
*/
@Getter
@Setter
private
String
urlPatterns
=
"/weixin/*"
;
/**
* 是否开发模式
* 是否开发模式
,默认:false
*/
@Getter
@Setter
private
boolean
devMode
=
false
;
/**
* accessTokenCache
* Spring cache name
* Spring cache name,需要开启spring cache,默认:dreamWeixinCache
*/
@Getter
@Setter
private
String
accessTokenCache
=
"dreamWeixinCache"
;
/**
* 多公众号url挂参,默认:appId
*/
@Getter
@Setter
private
String
appIdKey
=
"appId"
;
/**
* 多公众号配置
*/
@Getter
private
List
<
ApiConfig
>
wxConfigs
=
new
ArrayList
<
ApiConfig
>();
/**
* 小程序配置
*/
@Getter
@Setter
private
WxaConfig
wxaConfig
=
new
WxaConfig
();
/**
* 小程序消息解析,默认xml,支持json和xml
*/
@Getter
@Setter
private
WxaMsgParser
wxaMsgParser
=
WxaMsgParser
.
XML
;
}
spring-boot-weixin-demo/pom.xml
浏览文件 @
75fa6d8b
...
...
@@ -14,7 +14,7 @@
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
1.5.1
0
.RELEASE
</version>
<version>
1.5.1
2
.RELEASE
</version>
<relativePath/>
<!-- lookup parent from repository -->
</parent>
...
...
@@ -36,7 +36,7 @@
<dependency>
<groupId>
net.dreamlu
</groupId>
<artifactId>
spring-boot-starter-weixin
</artifactId>
<version>
1.
1
.0
</version>
<version>
1.
2
.0
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
...
...
spring-boot-weixin-demo/src/main/java/com/example/demo/WeixinController.java
浏览文件 @
75fa6d8b
...
...
@@ -26,7 +26,7 @@ public class WeixinController extends MsgControllerAdapter {
protected
void
processInTextMsg
(
InTextMsg
inTextMsg
)
{
System
.
out
.
println
(
weixinProperties
.
getWxaConfig
().
getAppId
());
OutTextMsg
outMsg
=
new
OutTextMsg
(
inTextMsg
);
outMsg
.
setContent
(
"文本消息~"
);
outMsg
.
setContent
(
inTextMsg
.
getContent
()
);
render
(
outMsg
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录