1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        大塊頭微信消息

        聯(lián)合創(chuàng)作 · 2023-09-24 15:25

        快速實現(xiàn)簡單的微信消息,事件響應(yīng)功能

        使用示例:

        1. 繼承

        DKT.WeiXinAPI.Message.* 或者 DKT.WeiXinAPI.Event.*

        中需要的事件或者消息類型,override Reply()方法,返回消息進行邏輯實現(xiàn)。 

        下面是一個訂閱事件的邏輯片段

        namespace DKT.WeiXin.Service
        {
        public class Welcome : DKT.WeiXinAPI.Event.Subscribe
        {
        public override MessageBody Reply()
        {
        //這里用戶在觸發(fā)訂閱事件后,返回一個 Text類型的消息
        //您也可以選擇 WeiXinAPI.Message.News.Response 等消息類型
        //具體在WeiXinAPI.Message命名空間查看
        var m = new WeiXinAPI.Message.Text.Response() {
        ToUserName = Context.FromUserName,
        FromUserName = Context.ToUserName,
        Content = "喲,少年郎,歡迎關(guān)注大塊頭喲。" };
        //您也可以通過Context.WeiXinParameters["p"],來訪問微信的請求參數(shù) return m;
        }
        }
        }

        2. 將實現(xiàn)類注冊到框架

        DKT.WeiXinAPI.Handler.Register(typeof(DKT.WeiXin.Service.Welcome));

        3. 在Controller或者ASPX來進行響應(yīng)

        if (Request.HttpMethod.Equals("POST")) {

        //在控制器,或者ASPX頁面獲取消息進行響應(yīng)

        return new ContentResult() { Content =DKT.WeiXinAPI.Handler.GetMessage() };

        }

        瀏覽 16
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        編輯 分享
        舉報
        評論
        圖片
        表情
        推薦
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        編輯 分享
        舉報
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            免费无码在线播放 | 高清国产一卡二卡三卡四卡免费 | 亚洲欧美日韩电影 | 小骚逼超碰 | 国产伦子伦对白视频 | 亚洲777 | 久久久精品美女 | 国产精品人妖被c视频 | 美女被插在线观看 | 可以免费看的A片 |