public async Task <MenuResponse> DeleteMenu() { var delMenuReq = new CreateMenuRequest((await GetTokenAsync()).Access_Token); var delMenuResp = await _clientService.ExecuteAsync(delMenuReq, RequestStringDataTypes.String); return(delMenuResp); }
public static void CreateMenuTest(string weixinID) { MenuInfo firstButon1 = new MenuInfo(); firstButon1.type = MenuType.click.ToString(); firstButon1.name = "下一个笑话"; firstButon1.key = "V1001_HOT"; List <MenuInfo> button = new List <MenuInfo>(); button.Add(firstButon1); string menuInfostr = JsonConvert.SerializeObject(new { button = button }); CreateMenuRequest request = new CreateMenuRequest(menuInfostr, ApiAccessTokenManager.Instance.GetTokenByWeixinID(weixinID)); ApiClient client = new ApiClient(); var response = client.Execute(request); if (!response.IsError) { Console.WriteLine(response.ToString()); } else { Console.WriteLine(response.ErrorCode + ", " + response.ErrorMessage); } }
public void CreatMenuTest() { TokenManager manger = new TokenManager(); TokenEntity entiy = manger.GetToken("0"); IWeiXinClient client = new DefaultWeiXinClient(); client.Token = entiy; CreateMenuRequest request = new CreateMenuRequest(); MenuEntity entity = new MenuEntity(); entity.Buttons.Add(new ClickEvent { Name = "测试", Key = "KEY1" }); entity.Buttons.Add(new MenuEventBase { Name = "主页", SubButton = new List <MenuEventBase> { new LocationSelectEvent { Name = "上传坐标", Key = "KEY2" }, new PicSysphotoEvent { Name = "拍照发图", Key = "KEY3" } } }); request.Menu = entity; request.AgentId = entiy.AgentID; CreateMenuResponse response = client.Execute <CreateMenuResponse>(request); Assert.AreEqual(0, response.ErrCode); }
public static void CreateMenuTest(string weixinID) { MenuInfo firstButon1 = new MenuInfo(); firstButon1.type = MenuType.click.ToString(); firstButon1.name = "下一个笑话"; firstButon1.key = "V1001_HOT"; List<MenuInfo> button = new List<MenuInfo>(); button.Add(firstButon1); string menuInfostr = JsonConvert.SerializeObject(new { button = button }); CreateMenuRequest request = new CreateMenuRequest(menuInfostr, ApiAccessTokenManager.Instance.GetTokenByWeixinID(weixinID)); ApiClient client = new ApiClient(); var response = client.Execute(request); if (!response.IsError) { Console.WriteLine(response.ToString()); } else { Console.WriteLine(response.ErrorCode + ", " + response.ErrorMessage); } }
public async Task <IActionResult> Create(MenuEditViewModel model) { try { if (!ModelState.IsValid) { return(BadRequest("Invalid ModelState")); } var request = new CreateMenuRequest { DisplayOrder = model.DisplayOrder, Icon = model.Icon, Title = model.Title, Url = model.Url, IsOpenInNewTab = model.IsOpenInNewTab }; var response = await _menuService.CreateAsync(request); return(Json(response)); } catch (Exception e) { Logger.LogError(e, "Error Create Nav Menu."); ModelState.AddModelError("", e.Message); return(ServerError(e.Message)); } }
public async Task <IActionResult> Create(NavMenuEditViewModel model) { try { if (ModelState.IsValid) { var request = new CreateMenuRequest { DisplayOrder = model.DisplayOrder, Icon = model.Icon, Title = model.Title, Url = model.Url }; var response = await _menuService.CreateMenuAsync(request); if (response.IsSuccess) { return(Json(response)); } Logger.LogError($"Create menu failed: {response.Message}"); ModelState.AddModelError("", response.Message); return(BadRequest("Create Menu Failed.")); } return(BadRequest("Invalid ModelState")); } catch (Exception e) { Logger.LogError(e, "Error Create Nav Menu."); ModelState.AddModelError("", e.Message); return(ServerError(e.Message)); } }
public void CreateMenu() { var buttons = new List <RootButtonItem> { new RootButtonItem { Name = "菜单1", Type = MenuTypeEnum.Click, Key = "MENU_1" }, new RootButtonItem { Name = "有子菜单", SubButton = new List <ButtonItem> { new ButtonItem { Name = "子菜单1", Type = MenuTypeEnum.View, Url = "http://baidu.com" }, new ButtonItem { Name = "子菜单2", Type = MenuTypeEnum.View, Url = "http://qq.com" } } } }; var request = new CreateMenuRequest { Button = buttons }; var rtn = _smartWeChatRequest.Execute(request).Result; Assert.Equal(0, rtn.ErrorCode); }
public async Task <MenuResponse> CreateMenu(string button) { var createMenuReq = new CreateMenuRequest((await GetTokenAsync()).Access_Token); createMenuReq.button = button; var createMenuResp = await _clientService.ExecuteAsync(createMenuReq, RequestStringDataTypes.String); return(createMenuResp); }
public IActionResult CreateMenuByBrand(long brandId, [FromBody] CreateMenuRequest request) { try { var created = _serviceUow.MenuService.CreateMenuByBrand(brandId, request); return(Created("/Menu", Mapper.Map <MenuDTO>(created))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public IActionResult Create(CreateMenuRequest request) { try { var menu = Mapper.Map <Menu>(request); var created = _serviceUow.MenuService.CreateMenu(menu); return(Created("/Menu", Mapper.Map <MenuDTO>(created))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public CreateMenuResponse Create(CreateMenuRequest request) { var response = new CreateMenuResponse(); try { var menu = request.MapTo <Data.Entities.Menu>(); //set IsRoot if no menu as parent menu.IsRoot = request.ParentId <= 0; menu.ParentId = menu.IsRoot ? null : menu.ParentId; //check if has role group if (request.RoleGroupIds.Count > 0) { menu.RoleGroups = new HashSet <Data.Entities.RoleGroup>(); foreach (int roleGroupId in request.RoleGroupIds) { var roleGroup = DataContext.RoleGroups.Where(r => r.Id == roleGroupId).First(); //add selected role group to menu menu.RoleGroups.Add(roleGroup); } } else { menu.RoleGroups = null; } //ensure url end with slash menu.Url = menu.Url != null && menu.Url.Length > 0 ? _CleanUpMenuUrl(menu.Url) : menu.Url; DataContext.Menus.Add(menu); DataContext.SaveChanges(); if (request.AddParent && !menu.IsRoot) { AddParentMenu(menu.ParentId, request.RoleGroupIds); } response.IsSuccess = true; response.Message = "Menu item has been added successfully"; } catch (DbUpdateException dbUpdateException) { response.Message = dbUpdateException.Message; } return(response); }
public async Task <Guid> CreateAsync(CreateMenuRequest request) { var uid = Guid.NewGuid(); var menu = new MenuEntity { Id = uid, Title = request.Title.Trim(), DisplayOrder = request.DisplayOrder, Icon = request.Icon, Url = request.Url, IsOpenInNewTab = request.IsOpenInNewTab }; await _menuRepository.AddAsync(menu); await _blogAudit.AddAuditEntry(EventType.Content, AuditEventId.MenuCreated, $"Menu '{menu.Id}' created."); return(uid); }
public async Task <IActionResult> Create([FromBody] CreateMenuRequest menuRequest) { var menu = new Menu { id = menuRequest.id, Name = menuRequest.Name, }; await _menuService.CreateMenuAsync(menu); var baseUrl = $"{HttpContext.Request.Scheme}://{HttpContext.Request.Host.ToUriComponent()}"; var locationUri = baseUrl + "/" + ApiRoutes.Menus.Get.Replace("{id}", menu.id.ToString()); return(Created(locationUri, new MenuResponse { id = menu.id })); }
public Task <Response <Guid> > CreateMenuAsync(CreateMenuRequest request) { return(TryExecuteAsync <Guid>(async() => { var uid = Guid.NewGuid(); var menu = new MenuEntity { Id = uid, Title = request.Title.Trim(), DisplayOrder = request.DisplayOrder, Icon = request.Icon, Url = request.Url }; await _menuRepository.AddAsync(menu); await _moongladeAudit.AddAuditEntry(EventType.Content, EventId.MenuCreated, $"Menu '{menu.Id}' created."); return new SuccessResponse <Guid>(uid); })); }
public async Task <IActionResult> Create(MenuEditViewModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var request = new CreateMenuRequest { DisplayOrder = model.DisplayOrder, Icon = model.Icon, Title = model.Title, Url = model.Url, IsOpenInNewTab = model.IsOpenInNewTab }; var response = await _menuService.CreateAsync(request); return(Ok(response)); }
public override Task <Error> CreateMenu(CreateMenuRequest request, ServerCallContext context) { var resp = new Error(); var accessToken = _redis.StringGet(CacheKey.UserAccessTokenPrefix + request.AppId); if (accessToken.HasValue) { var data = WxWebApi.SetMenu(accessToken, request.Config); if (data.ErrCode != 0) { resp.ErrCode = data.ErrCode; resp.ErrMsg = data.ErrMsg; } } else { resp.ErrCode = 99999; resp.ErrMsg = "AccessToken Missing"; } return(Task.FromResult(resp)); }
public async Task <IActionResult> CreateMenu([Required][FromBody] CreateMenuRequest body) { // NOTE: Please ensure the API returns the response codes annotated above var id = await commandHandler.HandleAsync( new CreateMenu( correlationId : GetCorrelationId(), tenantId : body.TenantId, //Should check if user logged-in owns it name : body.Name, description : body.Description, enabled : body.Enabled ) ); return(new CreatedAtActionResult( "GetMenu", "GetMenuById", new { id = id }, new ResourceCreatedResponse(id) )); }
public async Task <ActionResult> Create([FromBody] CreateMenuRequest command) { return(await base.Command <CreateMenuRequest, ICollection <MenuDto> >(command)); }
public CreateMenuFixture(CreateMenuRequest newMenu) { this.newMenu = newMenu; }
/// <summary> /// Send a POST Http request to the API CreateMenu endpoint passing the menu being created /// </summary> /// <param name="menu">Menu being created</param> public async Task <HttpResponseMessage> CreateMenu(CreateMenuRequest menu) { return(await SendAsync(HttpMethod.Post, "/v1/menu", menu)); }
public Menu CreateMenuByBrand(long brandId, CreateMenuRequest request) { using (var scope = new TransactionScope()) { var photo = (request.Photos != null && request.Photos.Count > 0) ? string.Join(";", request.Photos) : null; var menu = new Menu { MenuName = request.MenuName, Description = request.Description, Price = request.Price, ServingNumber = request.ServingNumber, BrandId = brandId, IsActive = true, IsDeleted = false, Photo = photo }; var createdMenu = _opfcUow.MenuRepository.CreateMenu(menu); var mealIds = request.MealIds; var menuMealList = _opfcUow.MealRepository .GetAllMeal() .Where(m => mealIds.Contains(m.Id)) .Select(m => new MenuMeal { MenuId = menu.Id, MealId = m.Id }) .ToList(); var eventTypeIds = request.EventTypeIds; var menuEventTypeList = _opfcUow.EventTypeRepository .GetAllEventType() .Where(e => eventTypeIds.Contains(e.Id)) .Select(e => new MenuEventType { MenuId = menu.Id, EventTypeId = e.Id, }) .ToList(); var categoryIds = request.CategoryIds; var menuCategoryList = _opfcUow.CategoryRepository .GetAllByIds(categoryIds) .Select(c => new MenuCategory { MenuId = menu.Id, CategoryId = c.Id, }) .ToList(); _opfcUow.MenuMealRepository.CreateRange(menuMealList); _opfcUow.MenuEventTypeRepository.CreateRange(menuEventTypeList); _opfcUow.MenuCategoryRepository.CreateRange(menuCategoryList); _opfcUow.Commit(); var brandSummary = _opfcUow.BrandSummaryRepository.GetByBrandId(brandId); brandSummary.MenuCount += 1; _opfcUow.BrandSummaryRepository.Update(brandSummary); _opfcUow.Commit(); scope.Complete(); return(createdMenu); } }
/// <summary> /// 创建菜单测试 /// </summary> public static void CreateMenuTest() { IMpClient mpClient = new MpClient(); AccessTokenGetRequest request = new AccessTokenGetRequest() { AppIdInfo = new AppIdInfo() { AppID = appId, AppSecret = appSecret } }; AccessTokenGetResponse response = mpClient.Execute(request); if (response.IsError) { Console.WriteLine("获取令牌环失败.."); return; } Menu menu = new Menu(); List <Button> button = new List <Weixin.Mp.Sdk.Domain.Button>(); Button subBtn1 = new Button() { key = "subkey1", name = "子按钮1", sub_button = null, type = "click", url = "http://" }; Button subBtn2 = new Button() { key = "subkey1", name = "子按钮1", sub_button = null, type = "click", url = "http://" }; Button subBtn3 = new Button() { key = "subkey1", name = "子按钮1", sub_button = null, type = "click", url = "http://" }; List <Button> subBtnAll = new List <Button>(); subBtnAll.Add(subBtn1); subBtnAll.Add(subBtn2); subBtnAll.Add(subBtn3); Button btn = new Button() { key = "key3", name = "联系", url = "httpbig", type = "click", sub_button = subBtnAll }; button.Add(btn); btn = new Button() { key = "key1", name = "帮助", url = "httpbig", type = "click", sub_button = subBtnAll }; button.Add(btn); btn = new Button() { key = "key2", name = "关于", url = "httpbig", type = "click", //sub_button = subBtnAll }; button.Add(btn); menu.button = button; MenuGroup mg = new MenuGroup() { menu = menu }; string postData = mg.ToJsonString(); CreateMenuRequest createRequest = new CreateMenuRequest() { AccessToken = response.AccessToken.AccessToken, SendData = postData }; CreateMenuResponse createResponse = mpClient.Execute(createRequest); if (createResponse.IsError) { Console.WriteLine("创建菜单失败,错误信息为:" + createResponse.ErrInfo.ErrCode + "-" + createResponse.ErrInfo.ErrMsg); } else { Console.WriteLine("创建菜单成功"); } }
/// <summary> /// 创建菜单 /// </summary> public static WeiXinResult CreateMenu() { WeiXinResult rv = new WeiXinResult { IsResult = false, ResultMsg = "系统错误!" }; IMpClient mpClient = new MpClient(); AccessTokenGetRequest request = new AccessTokenGetRequest() { AppIdInfo = new AppIdInfo() { AppID = appId, AppSecret = appSecret } }; AccessTokenGetResponse response = mpClient.Execute(request); if (response.IsError) { rv.ResultMsg = "获取令牌环失败"; return rv; } else { Menu menu = new Menu(); List<Button> button = new List<Weixin.Mp.Sdk.Domain.Button>(); #region 菜单一 产品中心 Button subBtn1 = new Button() { key = "guoneiyou", name = "国内游", sub_button = null, type = "view", url = "http://www.4008005216.com/AppPage/weixin/ProductView.aspx?xianlu=0" }; Button subBtn2 = new Button() { key = "guojiyou", name = "国际游", sub_button = null, type = "view", url = "http://www.4008005216.com/AppPage/weixin/ProductView.aspx?xianlu=1" }; Button subBtn3 = new Button() { key = "chanpintuijian", name = "产品推荐", sub_button = null, type = "view", url = "http://www.4008005216.com/AppPage/weixin/ProductList.aspx?tuijian=1" }; Button subBtn4 = new Button() { key = "chanpinmachaxun", name = "产品码查询", sub_button = null, type = "click", url = "http://www.4008005216.com/AppPage/weixin/Register.aspx" }; Button subBtn5 = new Button() { key = "guoneijipiao", name = "国内机票", sub_button = null, type = "view", url = "http://www.4008005216.com/AppPage/weixin/jp_Search.aspx" }; List<Button> subBtnAll = new List<Button>(); subBtnAll.Add(subBtn1); subBtnAll.Add(subBtn2); subBtnAll.Add(subBtn3); subBtnAll.Add(subBtn4); subBtnAll.Add(subBtn5); Button btn = new Button() { key = "menu1", name = "旅游超市", url = "httpbig", type = "click", sub_button = subBtnAll }; button.Add(btn); #endregion #region 菜单二 会员中心 Button Menu2SubBtn1 = new Button() { key = "dingdanguanli", name = "订单管理", sub_button = null, type = "view", url = "http://www.4008005216.com/AppPage/weixin/OrderList.aspx" }; Button Menu2SubBtn2 = new Button() { key = "zhanghuguanli", name = "账户管理", sub_button = null, type = "view", url = "http://www.4008005216.com/AppPage/weixin/updateUser.aspx" }; Button Menu2SubBtn3 = new Button() { key = "yuyue", name = "预约办理", sub_button = null, type = "view", url = "http://www.4008005216.com/AppPage/weixin/YuYue.aspx" }; string _weidianurl = "https://open.weixin.qq.com/connect/oauth2/authorize?"; _weidianurl += "appid=" + appId; _weidianurl += "&redirect_uri=http://www.4008005216.com/WeiXin/oauth2_authorize.aspx"; _weidianurl += "&response_type=code"; _weidianurl += "&scope=snsapi_base"; _weidianurl += "&state=weidian_snsapi_base"; _weidianurl += "#wechat_redirect"; Button Menu2SubBtn4 = new Button() { key = "wodeweidian", name = "我的微店", sub_button = null, type = "view", url = _weidianurl }; Button Menu2SubBtn5 = new Button() { key = "fenxiang", name = "最新分享", sub_button = null, type = "view", url = "http://www.4008005216.com/HuiYuanWeiXin/TuWenFenXiang.aspx" }; List<Button> subBtnAll2 = new List<Button>(); subBtnAll2.Add(Menu2SubBtn1); subBtnAll2.Add(Menu2SubBtn2); subBtnAll2.Add(Menu2SubBtn3); subBtnAll2.Add(Menu2SubBtn4); subBtnAll2.Add(Menu2SubBtn5); btn = new Button() { key = "huiyuanzhongxin", name = "会员中心", url = "httpbig", type = "click", sub_button = subBtnAll2 }; button.Add(btn); #endregion #region 菜单三 惠旅游 Button Menu3SubBtn1 = new Button() { key = "aboutus", name = "关于我们", sub_button = null, type = "view", url = "http://www.4008005216.com/AppPage/weixin/AboutUs.aspx" }; Button Menu3SubBtn2 = new Button() { key = "appdown", name = "APP下载", sub_button = null, type = "view", url = "http://www.4008005216.com/DownApp.aspx" }; Button Menu3SubBtn3 = new Button() { key = "recommend", name = "客服反馈", sub_button = null, type = "click", url = "http://www.4008005216.com/AppPage/weixin/Recommend.aspx" }; Button Menu3SubBtn4 = new Button() { key = "weimingpian", name = "我的频道", sub_button = null, type = "view", url = "http://www.4008005216.com/huiyuanweixin/mingpian.aspx" }; Button Menu3SubBtn5 = new Button() { key = "lvyouguwen", name = "旅游顾问", sub_button = null, type = "view", url = "http://www.4008005216.com/huiyuanweixin/lvyouguwen.aspx" }; List<Button> subBtnAll3 = new List<Button>(); subBtnAll3.Add(Menu3SubBtn1); subBtnAll3.Add(Menu3SubBtn2); subBtnAll3.Add(Menu3SubBtn3); subBtnAll3.Add(Menu3SubBtn4); subBtnAll3.Add(Menu3SubBtn5); btn = new Button() { key = "menu3", name = "旅游频道", url = "httpbig", type = "click", sub_button = subBtnAll3 }; button.Add(btn); #endregion menu.button = button; MenuGroup mg = new MenuGroup() { menu = menu }; string postData = mg.ToJsonString(); CreateMenuRequest createRequest = new CreateMenuRequest() { AccessToken = response.AccessToken.AccessToken, SendData = postData }; CreateMenuResponse createResponse = mpClient.Execute(createRequest); if (createResponse.IsError) { rv.ResultMsg = "创建菜单失败,错误信息为:" + createResponse.ErrInfo.ErrCode + "-" + createResponse.ErrInfo.ErrMsg; return rv; } else { rv.IsResult = true; rv.ResultMsg = "创建成功"; return rv; } } }
/// <summary> /// 创建菜单 /// </summary> public static WeiXinResult CreateMenu() { WeiXinResult rv = new WeiXinResult { IsResult = false, ResultMsg = "系统错误!" }; IMpClient mpClient = new MpClient(); AccessTokenGetRequest request = new AccessTokenGetRequest() { AppIdInfo = new AppIdInfo() { AppID = appId, AppSecret = appSecret } }; AccessTokenGetResponse response = mpClient.Execute(request); if (response.IsError) { rv.ResultMsg = "获取令牌环失败"; return(rv); } else { Menu menu = new Menu(); List <Button> button = new List <Weixin.Mp.Sdk.Domain.Button>(); #region 菜单一 产品中心 Button subBtn1 = new Button() { key = "guoneiyou", name = "国内游", sub_button = null, type = "view", url = "http://www.4008005216.com/AppPage/weixin/ProductView.aspx?xianlu=0" }; Button subBtn2 = new Button() { key = "guojiyou", name = "国际游", sub_button = null, type = "view", url = "http://www.4008005216.com/AppPage/weixin/ProductView.aspx?xianlu=1" }; Button subBtn3 = new Button() { key = "chanpintuijian", name = "产品推荐", sub_button = null, type = "view", url = "http://www.4008005216.com/AppPage/weixin/ProductList.aspx?tuijian=1" }; Button subBtn4 = new Button() { key = "chanpinmachaxun", name = "产品码查询", sub_button = null, type = "click", url = "http://www.4008005216.com/AppPage/weixin/Register.aspx" }; Button subBtn5 = new Button() { key = "guoneijipiao", name = "国内机票", sub_button = null, type = "view", url = "http://www.4008005216.com/AppPage/weixin/jp_Search.aspx" }; List <Button> subBtnAll = new List <Button>(); subBtnAll.Add(subBtn1); subBtnAll.Add(subBtn2); subBtnAll.Add(subBtn3); subBtnAll.Add(subBtn4); subBtnAll.Add(subBtn5); Button btn = new Button() { key = "menu1", name = "旅游超市", url = "httpbig", type = "click", sub_button = subBtnAll }; button.Add(btn); #endregion #region 菜单二 会员中心 Button Menu2SubBtn1 = new Button() { key = "dingdanguanli", name = "订单管理", sub_button = null, type = "view", url = "http://www.4008005216.com/AppPage/weixin/OrderList.aspx" }; Button Menu2SubBtn2 = new Button() { key = "zhanghuguanli", name = "账户管理", sub_button = null, type = "view", url = "http://www.4008005216.com/AppPage/weixin/updateUser.aspx" }; Button Menu2SubBtn3 = new Button() { key = "yuyue", name = "预约办理", sub_button = null, type = "view", url = "http://www.4008005216.com/AppPage/weixin/YuYue.aspx" }; string _weidianurl = "https://open.weixin.qq.com/connect/oauth2/authorize?"; _weidianurl += "appid=" + appId; _weidianurl += "&redirect_uri=http://www.4008005216.com/WeiXin/oauth2_authorize.aspx"; _weidianurl += "&response_type=code"; _weidianurl += "&scope=snsapi_base"; _weidianurl += "&state=weidian_snsapi_base"; _weidianurl += "#wechat_redirect"; Button Menu2SubBtn4 = new Button() { key = "wodeweidian", name = "我的微店", sub_button = null, type = "view", url = _weidianurl }; Button Menu2SubBtn5 = new Button() { key = "fenxiang", name = "最新分享", sub_button = null, type = "view", url = "http://www.4008005216.com/HuiYuanWeiXin/TuWenFenXiang.aspx" }; List <Button> subBtnAll2 = new List <Button>(); subBtnAll2.Add(Menu2SubBtn1); subBtnAll2.Add(Menu2SubBtn2); subBtnAll2.Add(Menu2SubBtn3); subBtnAll2.Add(Menu2SubBtn4); subBtnAll2.Add(Menu2SubBtn5); btn = new Button() { key = "huiyuanzhongxin", name = "会员中心", url = "httpbig", type = "click", sub_button = subBtnAll2 }; button.Add(btn); #endregion #region 菜单三 惠旅游 Button Menu3SubBtn1 = new Button() { key = "aboutus", name = "关于我们", sub_button = null, type = "view", url = "http://www.4008005216.com/AppPage/weixin/AboutUs.aspx" }; Button Menu3SubBtn2 = new Button() { key = "appdown", name = "APP下载", sub_button = null, type = "view", url = "http://www.4008005216.com/DownApp.aspx" }; Button Menu3SubBtn3 = new Button() { key = "recommend", name = "客服反馈", sub_button = null, type = "click", url = "http://www.4008005216.com/AppPage/weixin/Recommend.aspx" }; Button Menu3SubBtn4 = new Button() { key = "weimingpian", name = "我的频道", sub_button = null, type = "view", url = "http://www.4008005216.com/huiyuanweixin/mingpian.aspx" }; Button Menu3SubBtn5 = new Button() { key = "lvyouguwen", name = "旅游顾问", sub_button = null, type = "view", url = "http://www.4008005216.com/huiyuanweixin/lvyouguwen.aspx" }; List <Button> subBtnAll3 = new List <Button>(); subBtnAll3.Add(Menu3SubBtn1); subBtnAll3.Add(Menu3SubBtn2); subBtnAll3.Add(Menu3SubBtn3); subBtnAll3.Add(Menu3SubBtn4); subBtnAll3.Add(Menu3SubBtn5); btn = new Button() { key = "menu3", name = "旅游频道", url = "httpbig", type = "click", sub_button = subBtnAll3 }; button.Add(btn); #endregion menu.button = button; MenuGroup mg = new MenuGroup() { menu = menu }; string postData = mg.ToJsonString(); CreateMenuRequest createRequest = new CreateMenuRequest() { AccessToken = response.AccessToken.AccessToken, SendData = postData }; CreateMenuResponse createResponse = mpClient.Execute(createRequest); if (createResponse.IsError) { rv.ResultMsg = "创建菜单失败,错误信息为:" + createResponse.ErrInfo.ErrCode + "-" + createResponse.ErrInfo.ErrMsg; return(rv); } else { rv.IsResult = true; rv.ResultMsg = "创建成功"; return(rv); } } }
public CreateMenuFixture(CreateMenuRequest newMenu, IOptions <JwtBearerAuthenticationConfiguration> jwtBearerAuthenticationOptions) : base(jwtBearerAuthenticationOptions) { this.newMenu = newMenu; }