27 Star 91 Fork 25

欧福 / of-weixin-api

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

of-weixin-api 快速接入 几行代码实现微信接入

项目介绍

为微信开发者提供快速接入方案、未依赖任何第三方mvc框架,支持所用java web 框架接入。QQ 群: ①185948055

安装教程

Maven引用

	<dependency>
		<groupId>com.ofsoft</groupId>
		<artifactId>of-weixin-api</artifactId>
		<version>0.0.1-RELEASES</version>
	</dependency>	

文档地址

文档地址: https://gitee.com/oufu/of-weixin-api/wikis

使用说明

  1. Spring mvc
@Controller  
public class WeiXinAction extends MessageController {
         //入口
	@RequestMapping(value = "/wx/index")
	public void index(HttpServletRequest request, HttpServletResponse response) {
		Dispatcher.doDispatch(request, response, this);
	}

	@Override
	public MessageResponse textTypeMsg(MessageRequest params) {
		TextMessage msg = new TextMessage();
		msg.setContent(params.getParam("Content"));
		return msg;
	}

}
  1. Jfinal
@Action(path = "/wx")
public class WeixinController extends BaseController {
        //入口
	public void index() {
		Dispatcher.doDispatch(getRequest(), getResponse(),new DefaultController());
		renderNull();
	}

}
  1. Servlet 配置
@WebServlet(name = "coreInit", loadOnStartup = 1, urlPatterns = { "/wx/sing.html" })
public class Init extends HttpServlet {
	private static final long serialVersionUID = 1L;
            
	@Override
	public void init(ServletConfig config) throws ServletException {
		// 设置配置信息
		// AppConfig.setConfig(appid, appSecret, token);
		AppConfig.getInstance().init(new DefaultController());
	}
        //入口
	@Override
	protected void service(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		Dispatcher.doDispatch(request, response);
	}

} 4.自定义类继承MessageController 实现自己需求的方法

public class DefaultController extends MessageController {

@Override
public MessageResponse textTypeMsg(MessageRequest params) {
	TextMessage msg = new TextMessage();
	msg.setContent("测试");
	return msg;
}

}

技术文档

作者博客 http://blog.csdn.net/oufua 欢迎大家完善!

The MIT License (MIT) Copyright (c) 2018 OF Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

of-weixin-api 是一个微信开发接口、快速接入 几行代码实现微信接入,为微信开发者提供快速接入方案、未依赖任何第三方mvc框架,支持所用java web 框架接入。QQ 群: ①185948055 展开 收起
Java
MIT
取消

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/oufu/of-weixin-api.git
git@gitee.com:oufu/of-weixin-api.git
oufu
of-weixin-api
of-weixin-api
master

搜索帮助

14c37bed 8189591 565d56ea 8189591