- 授权协议: GPL
- 开发语言: C#
- 操作系统: Windows
- 软件首页: http://git.oschina.net/HaiMou1990/DKT.WeiXinAPI
软件介绍
快速实现简单的微信消息,事件响应功能
使用示例:
1. 继承
DKT.WeiXinAPI.Message.* 或者 DKT.WeiXinAPI.Event.*
中需要的事件或者消息类型,override Reply()方法,返回消息进行逻辑实现。
下面是一个订阅事件的逻辑片段
namespace DKT.WeiXin.Service
{
public class Welcome : DKT.WeiXinAPI.Event.Subscribe
{
public override MessageBody Reply()
{
//这里用户在触发订阅事件后,返回一个 Text类型的消息
//您也可以选择 WeiXinAPI.Message.News.Response 等消息类型
//具体在WeiXinAPI.Message命名空间查看
var m = new WeiXinAPI.Message.Text.Response() {
ToUserName = Context.FromUserName,
FromUserName = Context.ToUserName,
Content = "哟,少年郎,欢迎关注大块头哟。" };
//您也可以通过Context.WeiXinParameters["p"],来访问微信的请求参数 return m;
}
}
}
2. 将实现类注册到框架
DKT.WeiXinAPI.Handler.Register(typeof(DKT.WeiXin.Service.Welcome));
3. 在Controller或者ASPX来进行响应
if (Request.HttpMethod.Equals("POST")) {
//在控制器,或者ASPX页面获取消息进行响应
return new ContentResult() { Content =DKT.WeiXinAPI.Handler.GetMessage() };
}
Think Python
Allen B. Downey / O'Reilly Media / 2012-8-23 / GBP 29.99
Think Python is an introduction to Python programming for students with no programming experience. It starts with the most basic concepts of programming, and is carefully designed to define all terms ......一起来看看 《Think Python》 这本书的介绍吧!
