1 Star 0 Fork 25

maolala / of-weixin-api

forked from 欧福 / of-weixin-api 
Create your Gitee Account
Explore and code with more than 12 million developers,Free private repositories !:)
Sign up
Clone or Download
contribute
Sync branch
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README
MIT

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

项目介绍

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

安装教程

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.

About

of-weixin-api 是一个微信开发接口、快速接入 几行代码实现微信接入,为微信开发者提供快速接入方案、未依赖任何第三方mvc框架,支持所用java web 框架接入。 expand collapse
Java
MIT
Cancel

Releases

No release

Contributors

All

Activities

Load More
can not load any more
Java
1
https://gitee.com/maolala/of-weixin-api.git
git@gitee.com:maolala/of-weixin-api.git
maolala
of-weixin-api
of-weixin-api
master

Search