private void btnDelete_Click(object sender, EventArgs e) { try { if (dgv.CurrentRow == null || dgv.CurrentRow.Index < 0) { FrmTips.ShowTipsError(AppHelper.MainForm, "未选中任何行!", ContentAlignment.MiddleCenter, 1000); return; } Menus entity = CGridHelper.GetCurrentData <Menus>(dgv); MenuApi constantApi = new MenuApi(); var resp = constantApi.DeleteMenu(entity.Id); if (resp.Code == 1) { FrmTips.ShowTipsSuccess(AppHelper.MainForm, "删除成功!", ContentAlignment.MiddleCenter, 1000); CGridHelper.DeleteRow(dgv); } else { FrmTips.ShowTipsError(AppHelper.MainForm, "删除失败!" + resp.Message, ContentAlignment.MiddleCenter, 1000); } } catch (Exception ex) { FrmTips.ShowTipsError(AppHelper.MainForm, "删除异常!" + ex.Message, ContentAlignment.MiddleCenter, 3000); } }
protected void DeleteBtn_Click(object sender, EventArgs e) { IMenuApi menuapi = new MenuApi(); ErrJson EJ = menuapi.DeleteMenu(token); lblMsg.Text = EJ.errcode + ":" + EJ.errmsg; }
public string CreateMenu() { string token = this.GetToken(); string menuJson = this.GetMenuJson(); return(MenuApi.CreateMenus(token, menuJson)); }
protected void GetBtn_Click(object sender, EventArgs e) { IMenuApi menuapi = new MenuApi(); MenuJson MJ = menuapi.GetMenu(token); lblMsg.Text = MJ.ToJson(); }
protected override void Render(HtmlTextWriter writer) { base.Text = ""; SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); this.htmlAppID = masterSettings.WeixinAppId; string weixinAppSecret = masterSettings.WeixinAppSecret; try { this.htmlToken = this.GetToken(this.htmlAppID, weixinAppSecret); } catch (Exception) { } this.htmlTimeStamp = WeixinSet.ConvertDateTimeInt(DateTime.Now).ToString(); this.htmlSignature = this.GetSignature(this.htmlToken, this.htmlTimeStamp, this.htmlNonceStr, out this.htmlstring1); string token = TokenApi.GetToken(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret); MenuApi.GetMenus(token); base.Text = string.Concat(new string[] { "<script>wx.config({ debug: false,appId: '", this.htmlAppID, "',timestamp: '", this.htmlTimeStamp, "', nonceStr: '", this.htmlNonceStr, "',signature: '", this.htmlSignature, "',jsApiList: ['checkJsApi','onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo','getLocation']});</script>" }); base.Render(writer); }
protected void CreateBtn_Click(object sender, EventArgs e) { IMenuApi menuapi = new MenuApi(); MenuJson MJ = DealWithMenu.GetMenuJson(); ErrJson EJ = menuapi.CreateMenu(token, MJ); lblMsg.Text = EJ.errcode + ":" + EJ.errmsg; }
private void btnGetMenuJson_Click(object sender, EventArgs e) { IMenuApi menuBLL = new MenuApi(); MenuJson menu = menuBLL.GetMenu(token); if (menu != null) { Console.WriteLine(menu.ToJson()); } }
private void btnSearch_Click(object sender, EventArgs e) { List <Menus> list = null; ControlHelper.ThreadRunExt(AppHelper.MainForm, () => { var succ = true; var msg = ""; try { ResponseModel responseModel = new ResponseModel(); MenuApi menuApi = new MenuApi(); responseModel = menuApi.GetMenus(); if (responseModel.Code == 1) { if (responseModel.DataCount > 0) { list = JsonConvert.DeserializeObject <List <Menus> >(responseModel?.Data?.ToString()); ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () => { if (list != null) { CGridHelper.ClearGrid(dgv); CGridHelper.FillGrid <Menus>(dgv, list); } }); } else { succ = false; msg = "查询数据为空!"; } } else { succ = false; msg = responseModel?.Message; } } catch (Exception ex) { succ = false; msg = ex.Message; } if (!succ) { ControlHelper.ThreadInvokerControl(AppHelper.MainForm, () => { FrmTips.ShowTips(AppHelper.MainForm, msg, 2000, true, ContentAlignment.MiddleCenter, null, TipsSizeMode.Medium, new Size(300, 100), TipsState.Error); }); } }, null, AppHelper.MainForm, true, "正在查询……", 200); }
/// <summary> /// 发布微信菜单到微信公众号服务器。 /// </summary> /// <returns></returns> public PublishWxMenuResponse PublishMenus() { var resp = new PublishWxMenuResponse(); IList <WxMenuDto> initMenus = this.GetInitMenus(MenuClient.Weixin); Menu menu = new Menu(); foreach (var info in initMenus.OrderBy(p => p.Sequence)) { if ((info.Chilren == null) || (info.Chilren.Count == 0)) { menu.menu.button.Add(this.BuildMenu(info)); continue; } SubMenu item = new SubMenu { name = info.Name }; foreach (var info2 in info.Chilren.OrderBy(x => x.Sequence)) { item.sub_button.Add(this.BuildMenu(info2)); } menu.menu.button.Add(item); } string json = JsonConvert.SerializeObject(menu.menu); var masterSettings = GetOfficalAccount(); if (string.IsNullOrEmpty(masterSettings.AppId) || string.IsNullOrEmpty(masterSettings.AppSecret)) { resp.AddMessage("您的服务号配置存在问题,请您先检查配置!").SetSuccess(false); } else { string token = TokenApi.GetToken(masterSettings.AppId, masterSettings.AppSecret); try { token = (JsonConvert.DeserializeObject(token, typeof(Token)) as Token).access_token; if (MenuApi.CreateMenus(token, json).Contains("ok")) { resp.AddMessage("成功的把自定义菜单保存到了微信").SetSuccess(true); } else { resp.AddMessage("操作失败!服务号配置信息错误或没有微信自定义菜单权限,请检查配置信息以及菜单的长度。") .SetSuccess(false); } } catch (Exception exception) { resp.AddMessage(exception.Message + "---" + token + "---" + masterSettings.AppId + "---" + masterSettings.AppSecret) .SetSuccess(false).Error = exception; } } return(resp); }
private void BtnSave_Click(object sender, EventArgs e) { IList <MenuInfo> initMenus = VShopHelper.GetInitMenus(this.wid); Hishop.Weixin.MP.Domain.Menu.Menu menu = new Hishop.Weixin.MP.Domain.Menu.Menu(); foreach (MenuInfo info in initMenus) { if ((info.Chilren == null) || (info.Chilren.Count == 0)) { menu.menu.button.Add(this.BuildMenu(info)); } else { SubMenu item = new SubMenu { name = info.Name }; foreach (MenuInfo info2 in info.Chilren) { item.sub_button.Add(this.BuildMenu(info2)); } menu.menu.button.Add(item); } } bll = new Chenduo.BLL.sf_website(); website = bll.GetModelByWid(this.wid); if (website == null) { return; } string json = JsonConvert.SerializeObject(menu.menu); //SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); //if (string.IsNullOrEmpty(masterSettings.WeixinAppId) || string.IsNullOrEmpty(masterSettings.WeixinAppSecret)) //{ // base.Response.Write("<script>alert('您的服务号配置存在问题,请您先检查配置!');location.href='PayConfig.aspx'</script>"); //} //else if (MenuApi.CreateMenus(JsonConvert.DeserializeObject<Token>(TokenApi.GetToken(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret)).access_token, json).Contains("\"ok\"")) //{ // this.ShowMsg("成功的把自定义菜单保存到了微信", true); //} if (string.IsNullOrEmpty(website.appid) || string.IsNullOrEmpty(website.appsecret)) { base.Response.Write("<script>alert('您的服务号配置存在问题,请您先检查配置!');location.href='PayConfig.aspx'</script>"); } else if (MenuApi.CreateMenus(JsonConvert.DeserializeObject <Token>(TokenApi.GetToken(website.appid, website.appsecret)).access_token, json).Contains("\"ok\"")) { this.ShowMsg("成功的把自定义菜单保存到了微信", true); } else { this.ShowMsg("操作失败!服务号配置信息错误或没有微信自定义菜单权限", false); } }
public async Task <IActionResult> Index() { var token = _weixinAccessToken.GetToken(); var resultJson = await MenuApi.GetMenuAsync(token); var vm = new WeixinJsonViewModel { Token = token, Json = JsonConvert.SerializeObject(resultJson, Formatting.Indented) }; return(View(vm)); }
private void SelectDefaultMenus(int roleid) { MenuApi menuApi = new MenuApi(); var response = menuApi.GetMenuByRole(roleid); if (response.Code == 1 && response.DataCount > 0) { List <Menus> menuList = JsonConvert.DeserializeObject <List <Menus> >(response.Data?.ToString()); List <int> MenuIds = menuList.Select(m => m.Id).ToList(); CheckTvNodes(tvMenus.Nodes[0].Nodes, MenuIds); } }
public MainForm() { InitializeComponent(); AppHelper.MainForm = this; _list = JsonConvert.DeserializeObject <List <Menus> >(File.ReadAllText("MenuConfig.json")); //加载菜单列表 MenuApi menuApi = new MenuApi(); var response = menuApi.GetMenuByUser(AppHelper.UserId); if (response.Code == 1 && response.DataCount > 0) { _menus = JsonConvert.DeserializeObject <List <Menus> >(response.Data.ToString()); } InitMenu(); tvMenu.AfterSelect += tvMenu_AfterSelect; }
private void Init() { MenuApi menuApi = new MenuApi(); var response = menuApi.GetMenuByUser(AppHelper.UserId); if (response.Code == 1 && response.DataCount > 0) { List <Menus> menuList = JsonConvert.DeserializeObject <List <Menus> >(response.Data?.ToString()); tvMenus.Nodes.Clear(); tvMenus.CheckBoxes = true; TreeNode rootNode = new TreeNode("系统菜单"); rootNode.Name = "0"; tvMenus.Nodes.Add(rootNode); CreateTreeNode(menuList, rootNode, 0); tvMenus.ExpandAll(); } }
public async Task <IActionResult> UpdateWeixinMenu(WeixinJsonViewModel vm) { if (ModelState.IsValid) { if (!string.IsNullOrEmpty(vm.Json)) { var token = _weixinAccessToken.GetToken(); var result = await MenuApi.CreateMenuAsync(token, vm.Json); _logger.LogDebug(result.ToString()); return(View("UpdateMenuResult", result)); } } // If we got this far, something failed; redisplay form. return(RedirectToAction(nameof(Index), new { input = vm.Json })); }
private void BtnSave_Click(object sender, System.EventArgs e) { System.Collections.Generic.IList <MenuInfo> initMenus = VShopHelper.GetInitMenus(); Hishop.Weixin.MP.Domain.Menu.Menu menu = new Hishop.Weixin.MP.Domain.Menu.Menu(); foreach (MenuInfo current in initMenus) { if (current.Chilren == null || current.Chilren.Count == 0) { menu.menu.button.Add(this.BuildMenu(current)); } else { SubMenu subMenu = new SubMenu { name = current.Name }; foreach (MenuInfo current2 in current.Chilren) { subMenu.sub_button.Add(this.BuildMenu(current2)); } menu.menu.button.Add(subMenu); } } string json = JsonConvert.SerializeObject(menu.menu); SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); if (string.IsNullOrEmpty(masterSettings.WeixinAppId) || string.IsNullOrEmpty(masterSettings.WeixinAppSecret)) { base.Response.Write("<script>alert('您的服务号配置存在问题,请您先检查配置!');location.href='wxconfig.aspx'</script>"); return; } string text = TokenApi.GetToken(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret); text = JsonConvert.DeserializeObject <Token>(text).access_token; string text2 = MenuApi.CreateMenus(text, json); if (text2.Contains("\"ok\"")) { this.ShowMsg("自定义菜单已同步到微信,24小时内生效!", true); return; } this.ShowMsg("操作失败!服务号配置信息错误或没有微信自定义菜单权限", false); }
private void btnSave_BtnClick(object sender, EventArgs e) { try { if (!validator1.Validate()) { return; } entityFiller.FillEntity(m_menus); m_menus.ParentId = Convert.ToInt32(combMenus.SelectedValue); if (m_menus.ParentId != 0) { m_menus.ParentName = combMenus.Text; } MenuApi menuApi = new MenuApi(); ResponseModel responseModel = new ResponseModel(); if (!IsModify) { responseModel = menuApi.AddMenu(m_menus); } else { responseModel = menuApi.ModifyMenu(m_menus); } if (responseModel.Code == 1) { FrmTips.ShowTipsSuccess(AppHelper.MainForm, "保存成功!", ContentAlignment.MiddleCenter, 1000); m_menus = JsonConvert.DeserializeObject <Menus>(responseModel.Data.ToString()); bIsUpdate = true; this.DialogResult = DialogResult.OK; this.Close(); } else { FrmTips.ShowTipsError(AppHelper.MainForm, "保存失败!" + responseModel.Message, ContentAlignment.MiddleCenter, 1000); } } catch (Exception ex) { FrmTips.ShowTipsError(AppHelper.MainForm, "保存失败!" + ex.Message, ContentAlignment.MiddleCenter, 1000); } }
private void btnSubmit_Click(object sender, System.EventArgs e) { System.Collections.Generic.IList <MenuInfo> initMenus = VShopHelper.GetInitMenus(ClientType.VShop); Hishop.Weixin.MP.Domain.Menu.Menu menu = new Hishop.Weixin.MP.Domain.Menu.Menu(); foreach (MenuInfo info in initMenus) { if (info.Chilren == null || info.Chilren.Count == 0) { menu.menu.button.Add(this.BuildMenu(info)); } else { SubMenu item = new SubMenu { name = info.Name }; foreach (MenuInfo info2 in info.Chilren) { item.sub_button.Add(this.BuildMenu(info2)); } menu.menu.button.Add(item); } } string json = JsonConvert.SerializeObject(menu.menu); SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); if (string.IsNullOrEmpty(masterSettings.WeixinAppId) || string.IsNullOrEmpty(masterSettings.WeixinAppSecret)) { base.Response.Write("<script>alert('您的服务号配置存在问题,请您先检查配置!');location.href='AppConfig.aspx'</script>"); } else { if (MenuApi.CreateMenus(JsonConvert.DeserializeObject <Token>(TokenApi.GetToken(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret)).access_token, json).Contains("ok")) { this.ShowMsg("成功的把自定义菜单保存到了微信", true); } else { this.ShowMsg("操作失败!服务号配置信息错误或没有微信自定义菜单权限", false); } } }
private void Init() { List <Menus> menus = new List <Menus>(); menus.Add(new Menus() { Id = 0, MenuName = "请选择" }); MenuApi menuApi = new MenuApi(); var response = menuApi.GetMenus(); if (response.Code == 1 && response.DataCount > 0) { var menus1 = JsonConvert.DeserializeObject <List <Menus> >(response.Data?.ToString()); menus.AddRange(menus1); } combMenus.DataSource = menus; combMenus.DisplayMember = "MenuName"; combMenus.ValueMember = "Id"; }
public string DeleteMenu() { return(MenuApi.DeleteMenus(this.GetToken())); }
public void ConsistentToWeixin(long shopId) { string empty = string.Empty; string weixinAppSecret = string.Empty; if (shopId == 0) { SiteSettingsInfo siteSettings = Instance <ISiteSettingService> .Create.GetSiteSettings(); if (string.IsNullOrEmpty(siteSettings.WeixinAppId) || string.IsNullOrEmpty(siteSettings.WeixinAppSecret)) { throw new HimallException("您的服务号配置存在问题,请您先检查配置!"); } empty = siteSettings.WeixinAppId; weixinAppSecret = siteSettings.WeixinAppSecret; } if (shopId > 0) { WXShopInfo vShopSetting = Instance <IVShopService> .Create.GetVShopSetting(shopId); if (string.IsNullOrEmpty(vShopSetting.AppId) || string.IsNullOrEmpty(vShopSetting.AppSecret)) { throw new HimallException("您的服务号配置存在问题,请您先检查配置!"); } empty = vShopSetting.AppId; weixinAppSecret = vShopSetting.AppSecret; } string str = CommonApi.GetToken(empty, weixinAppSecret).access_token; IQueryable <MenuInfo> allMenu = GetAllMenu(shopId); if (allMenu == null) { throw new HimallException("你还没有添加菜单!"); } List <MenuInfo> list = ( from item in allMenu where item.ParentId == 0 select item).ToList(); foreach (MenuInfo menuInfo in list) { if (GetMenuByParentId(menuInfo.Id).Count() != 0) { continue; } MenuInfo.UrlTypes?urlType = menuInfo.UrlType; if ((urlType.GetValueOrDefault() != MenuInfo.UrlTypes.Nothing ? true : !urlType.HasValue)) { continue; } throw new HimallException("你有一级菜单下没有二级菜单并且也没有绑定链接"); } Menu menu = new Menu(); foreach (MenuInfo menuInfo1 in list) { if (GetMenuByParentId(menuInfo1.Id).Count() != 0) { SubMenu subMenu = new SubMenu() { name = menuInfo1.Title }; foreach (MenuInfo menuByParentId in GetMenuByParentId(menuInfo1.Id)) { subMenu.sub_button.Add(BuildMenu(menuByParentId)); } menu.menu.button.Add(subMenu); } else { menu.menu.button.Add(BuildMenu(menuInfo1)); } } string str1 = JsonConvert.SerializeObject(menu.menu); string str2 = MenuApi.CreateMenus(str, str1); Log.Info(string.Concat("微信菜单:", str1)); if (!str2.Contains("ok")) { Log.Info(string.Concat("微信菜单同步错误,返回内容:", str2)); throw new HimallException("服务号配置信息错误或没有微信自定义菜单权限,请检查配置信息以及菜单的长度。"); } }
private void btnSubmit_Click(object sender, EventArgs e) { SiteSettings masterSettings = SettingsManager.GetMasterSettings(); if (masterSettings.IsDemoSite) { this.ShowMsg("演示站点不允许修改微信自定义菜单", false); } else { IList <MenuInfo> initMenus = VShopHelper.GetInitMenus(ClientType.VShop); Hishop.Weixin.MP.Domain.Menu.Menu menu = new Hishop.Weixin.MP.Domain.Menu.Menu(); foreach (MenuInfo item in initMenus) { if (item.Chilren == null || item.Chilren.Count == 0) { menu.menu.button.Add(this.BuildMenu(item)); } else { SubMenu subMenu = new SubMenu { name = item.Name }; foreach (MenuInfo item2 in item.Chilren) { subMenu.sub_button.Add(this.BuildMenu(item2)); } menu.menu.button.Add(subMenu); } } string json = JsonConvert.SerializeObject(menu.menu); if (string.IsNullOrEmpty(masterSettings.WeixinAppId) || string.IsNullOrEmpty(masterSettings.WeixinAppSecret)) { base.Response.Write("<script>alert('您的服务号配置存在问题,请您先检查配置!');location.href='VServerConfig.aspx'</script>"); } else { string text = AccessTokenContainer.TryGetToken(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret, false); string sign = text; try { if (string.IsNullOrEmpty(text)) { this.ShowMsg("操作失败!您的服务号配置可能存在问题,请您先检查配置!", false); } else { string text2 = MenuApi.CreateMenus(text, json); if (text2.Contains("\"errmsg\":\"ok\"")) { this.ShowMsg("成功的把自定义菜单保存到了微信", true); } else { Globals.AppendLog(text2, sign, "", "SaveMenu"); this.ShowMsg("操作失败!服务号配置信息错误或没有微信自定义菜单权限,请检查配置信息以及菜单的长度。", false); } } } catch (Exception ex) { base.Response.Write(ex.Message + "---" + text + "---" + masterSettings.WeixinAppId + "---" + masterSettings.WeixinAppSecret); base.Response.End(); } } } }
public string CreateMenu() { string token = GetToken(); return(MenuApi.CreateMenus(token, GetMenuJson())); }
public string GetMenu() { string token = this.GetToken(); return(MenuApi.GetMenus(token)); }
public ApiResult SaveAndPublishMenu(string json, UserContext userContext, DomainContext domainContext) { MenuEntity menuEntity = new MenuEntity(); menuEntity.DomainId = userContext.User.Domain; menuEntity.Menu = json; _dataBase.Remove(menuEntity); _dataBase.Insert(menuEntity); ApiResult result = new ApiResult(); //未认证订阅号没有自定义菜单权限 if (domainContext.Authorizer == null || domainContext.Authorizer.AuthorizationType == EnumAuthorizationType.UnauthorizedSubscription) { result.Success = false; result.Message = "未认证订阅号没有自定义菜单权限。"; return(result); } List <ButtonBase> _buttonList = new List <ButtonBase>(); JObject jObject = JObject.Parse(json); #region 解析 JArray buttonArray = (JArray)jObject["button"]; foreach (var button in buttonArray) { if (button["sub_button"] == null || button["sub_button"].Count() == 0) { ButtonBase newButton = null; switch (button["type"].ToString()) { case "wxc_function": newButton = GetWxcFunctionButton(button, domainContext); break; case "click": newButton = GetClickButton(button, domainContext); break; case "view": newButton = JsonHelper.Deserialize <ButtonView>(button.ToString()); break; case "wxc_campaign": newButton = GetWxcCampaignButton(button, domainContext); break; case "wxc_information": newButton = GetWxcInformationButton(button, domainContext); break; case "wxc_customForm": newButton = GetWxcCustomFormButton(button, domainContext); break; case "mediaId": newButton = GetMediaIdButton(button); break; } _buttonList.Add(newButton); } else { ParentButton parentButton = JsonHelper.Deserialize <ParentButton>(button.ToString()); parentButton.SubButton = new List <ButtonBase>(); JArray subButtonArray = (JArray)button["sub_button"]; foreach (var subButton in subButtonArray) { ButtonBase newSubButton = null; switch (subButton["type"].ToString()) { case "wxc_function": newSubButton = GetWxcFunctionButton(subButton, domainContext); break; case "click": newSubButton = GetClickButton(subButton, domainContext); break; case "view": newSubButton = JsonHelper.Deserialize <ButtonView>(subButton.ToString()); break; case "wxc_campaign": newSubButton = GetWxcCampaignButton(subButton, domainContext); break; case "wxc_information": newSubButton = GetWxcInformationButton(subButton, domainContext); break; case "wxc_customForm": newSubButton = GetWxcCustomFormButton(subButton, domainContext); break; case "mediaId": newSubButton = GetMediaIdButton(subButton); break; } parentButton.SubButton.Add(newSubButton); } _buttonList.Add(parentButton); } } #endregion ButtonWrapper menu = new ButtonWrapper(); menu.Button = _buttonList; RequestApiResult apiResult = MenuApi.Create(menu, domainContext.AccessToken); result.Success = apiResult.Success; result.Message = apiResult.Message; return(result); }
public string GetMenu() { return(MenuApi.GetMenus(this.GetToken())); }
public void Init() { instance = new MenuApi(); }
private void btnSubmit_Click(object sender, System.EventArgs e) { System.Collections.Generic.IList <MenuInfo> initMenus = VShopHelper.GetInitMenus(ClientType.VShop); Ecdev.Weixin.MP.Domain.Menu.Menu menu = new Ecdev.Weixin.MP.Domain.Menu.Menu(); foreach (MenuInfo current in initMenus) { if (current.Chilren == null || current.Chilren.Count == 0) { menu.menu.button.Add(this.BuildMenu(current)); } else { SubMenu subMenu = new SubMenu { name = current.Name }; foreach (MenuInfo current2 in current.Chilren) { subMenu.sub_button.Add(this.BuildMenu(current2)); } menu.menu.button.Add(subMenu); } } string json = JsonConvert.SerializeObject(menu.menu); SiteSettings masterSettings = SettingsManager.GetMasterSettings(false); if (string.IsNullOrEmpty(masterSettings.WeixinAppId) || string.IsNullOrEmpty(masterSettings.WeixinAppSecret)) { base.Response.Write("<script>alert('您的服务号配置存在问题,请您先检查配置!');location.href='VServerConfig.aspx'</script>"); return; } string text = TokenApi.GetToken(masterSettings.WeixinAppId, masterSettings.WeixinAppSecret); try { text = (JsonConvert.DeserializeObject(text, typeof(Token)) as Token).access_token; string text2 = MenuApi.CreateMenus(text, json); if (text2.Contains("ok")) { this.ShowMsg("成功的把自定义菜单保存到了微信", true); } else { this.ShowMsg("操作失败!服务号配置信息错误或没有微信自定义菜单权限,请检查配置信息以及菜单的长度。", false); } } catch (System.Exception ex) { base.Response.Write(string.Concat(new string[] { ex.Message, "---", text, "---", masterSettings.WeixinAppId, "---", masterSettings.WeixinAppSecret })); base.Response.End(); } }
public string DeleteMenu() { string token = this.GetToken(); return(MenuApi.DeleteMenus(token)); }