public ActionResult EditConfirm() { var data = Request["data"]; if (data == null) { return(Json(new CommonResult { Success = false, ErrorMessage = "参数data不能为空!" }, JsonRequestBehavior.AllowGet)); } var auth = WXInterface.GetAccessToken(Config.AppID, Config.AppSecret); var ret = WXInterface.CreateMenu(auth.access_token, data); return(Json(ret, JsonRequestBehavior.AllowGet)); }
// GET: Menu public ActionResult CreateDefault() { MenuInfo productInfo = new MenuInfo("软件产品", new MenuInfo[] { new MenuInfo("移动办公平台", MenuInfo.ButtonType.click, "patient"), new MenuInfo("安全审核办公平台", MenuInfo.ButtonType.click, "aqscgl") }); MenuInfo frameworkInfo = new MenuInfo("框架产品", new MenuInfo[] { new MenuInfo("Web开发框架", MenuInfo.ButtonType.click, "web"), new MenuInfo("代码生成工具", MenuInfo.ButtonType.click, "database2sharp") }); MenuInfo relatedInfo = new MenuInfo("相关链接", new MenuInfo[] { new MenuInfo("公司介绍", MenuInfo.ButtonType.click, "Event_Company"), new MenuInfo("官方网站", MenuInfo.ButtonType.view, "http://www.bjdflld.com/wx"), //new MenuInfo("官方网站", ButtonType.click, "http://www.bjdflld.com"), new MenuInfo("提点建议", MenuInfo.ButtonType.click, "Event_Suggestion"), new MenuInfo("联系客服", MenuInfo.ButtonType.click, "Event_Contact"), //new MenuInfo("发邮件", ButtonType.view, "http://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&email=S31yfX15fn8LOjplKCQm") new MenuInfo("发邮件", MenuInfo.ButtonType.click, "Event_Mail") }); MenuJson menuJson = new MenuJson(); menuJson.button.AddRange(new MenuInfo[] { productInfo, frameworkInfo, relatedInfo }); var auth = WXInterface.GetAccessToken(Config.AppID, Config.AppSecret); if (WXInterface.DeleteMenu(auth.access_token).Success) { var ret = WXInterface.CreateMenu(auth.access_token, menuJson); if (!ret.Success) { return(Content("创建微信公众号菜单失败!\n" + ret.ErrorMessage)); } } return(View()); }