Exemplo n.º 1
0
        /// <summary>
        /// 查看分组
        /// </summary>
        /// <param name="context">Context.</param>
        public void Getgroup(JabinfoContext context)
        {
            Weixin wx = new Weixin ();
            Utils Util = new Utils ();
            string url = "https://api.weixin.qq.com/cgi-bin/groups/get?access_token="+wx.GetAccessToken();

            string json = Jabinfo.Help.Http.GetHttps(url);
            var dict = Util.JsonTo<Dictionary<string, List<Dictionary<string, object>>>>(json);
            var gs = new Groups();
            var gilist = dict["groups"];
            foreach (var gidict in gilist)
            {
                var gi = new GroupVO();
                gi.name = gidict["name"].ToString();
                gi.id = Convert.ToInt32(gidict["id"]);
                gi.count = Convert.ToInt32(gidict["count"]);
                gs.Add(gi);
            }
            context.Variable ["groupList"] = gs;
        }