Пример #1
0
        public static string SendTemplate(string template_id, string OpenID, string url, UAP.JSON data)
        {
            UAP.JSON post = new UAP.JSON();
            post.Add("touser", OpenID);
            post.Add("template_id", template_id);
            post.Add("url", url);
            string[] keys = new string[data.Keys.Count];
            data.Keys.CopyTo(keys, 0);
            foreach (string key in keys)
            {
                object v = data[key];
                if (v is UAP.JSON)
                {
                    continue;
                }
                UAP.JSON json = new UAP.JSON();
                json.Add("value", v).Add("color", "#173177");
                data[key] = json;
            }
            post.Add("data", data);
            string s = UAP.Function.Http.getPost("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + access_token, post.ToString(true));

            return(UAP.JSON.Decode(s).String("errmsg"));
        }
Пример #2
0
        /// <summary>
        /// 请参考getMenu
        /// </summary>
        /// <param name="MenuJSON"></param>
        /// <returns></returns>
        public static string setMenu(UAP.JSON MenuJSON)
        {
            string s = UAP.Function.Http.getPost("https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" + Wechat.access_token, MenuJSON.ToString(true));

            return(UAP.JSON.Decode(s).String("errmsg"));
        }