コード例 #1
0
        /// <summary>
        /// 菜单项目
        /// </summary>
        public void MyMenu()
        {
            string weixin1 = "";

            weixin1 = @" {
                         ""button"":[
                           {	
                               ""type"":""click"",
                               ""name"":""你好!"",
                               ""key"":""HELLO""
                           },
                           {
                               ""type"":""click"",
                               ""name"":""谁简介"",
                               ""key"":""myprofile""
                           },
                           {
                               ""name"":""测试菜单"",
                               ""sub_button"":[
                                {
                                   ""type"":""view"",
                                   ""name"":""全程陪诊"",
                                   ""url"":""http://543av8.natappfree.cc/WebUI/Index.aspx""
                                },
                                {
                                   ""type"":""view"",
                                   ""name"":""全程陪诊H5"",
                                   ""url"":""" + GetCodeUrl("http://543av8.natappfree.cc/vip-c/index.html") + @"""
                                },
                                {
                                   ""type"":""click"",
                                   ""name"":""疾控中心"",
                                   ""key"":""jkzx""
                                }
                           }]
                         }";

            //string filepath = HttpContext.Current.Server.MapPath("menu.txt");
            //StreamReader sr = new StreamReader(filepath, Encoding.Default);
            //string line = sr.ReadToEnd();
            Access_token model = new Access_token();

            model.access_token = HttpRequestUtil.GetAccessToken();//将access_token进行缓存
            //model = GetAccess_token();
            //GetPage("https://api.weixin.qq.com/cgi-bin/menu/delete?access_token=" + model.access_token + "", ""); //删除菜单
            GetPage("https://api.weixin.qq.com/cgi-bin/menu/create?access_token=" + model.access_token + "", weixin1);
        }