MenuCreateController.cs 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using JCSoft.WX.Framework.Api;
  2. using JCSoft.WX.Framework.Models;
  3. using JCSoft.WX.Framework.Models.ApiRequests;
  4. using JCSoft.WX.Framework.Models.ApiResponses;
  5. using Microsoft.AspNetCore.Mvc;
  6. using Microsoft.Extensions.Caching.Memory;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Threading.Tasks;
  11. namespace SupplierWeb.Controllers
  12. {
  13. [Route("api/menuCreate")]
  14. public class MenuCreateController : BaseApiController<MenuCreateResponse>
  15. {
  16. public MenuCreateController(IMemoryCache cache, IApiClient client) : base(cache, client)
  17. {
  18. }
  19. protected override ApiRequest<MenuCreateResponse> GetApiRequest()
  20. {
  21. return new MenuCreateRequest
  22. {
  23. Buttons = new List<ClickButton>
  24. {
  25. //new ClickButton
  26. //{
  27. // Type = ClickButtonType.click,
  28. // Name = "关注我",
  29. // Key = "Key_Follow_Me"
  30. //},
  31. new ClickButton
  32. {
  33. Type = ClickButtonType.view,
  34. Url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxdc3ee459a9b8f109&redirect_uri=http://119.27.191.247/web/supplymobile/bindphone&response_type=code&scope=snsapi_base#wechat_redirect",
  35. Name = "绑定手机号"
  36. },
  37. new ClickButton
  38. {
  39. Name="主菜单",
  40. SubButton = new List<ClickButton>
  41. {
  42. //new ClickButton
  43. //{
  44. // Type = ClickButtonType.scancode_push,
  45. // Name = "扫一扫",
  46. // Key = "Event_Scan"
  47. //},
  48. //new ClickButton
  49. //{
  50. // Type = ClickButtonType.pic_sysphoto,
  51. // Name = "系统拍照发图",
  52. // Key = "Event_SysPhoto"
  53. //},
  54. //new ClickButton
  55. //{
  56. // Type = ClickButtonType.pic_weixin,
  57. // Name = "微信相册发图",
  58. // Key = "Event_Pic_WeiXin"
  59. //},
  60. new ClickButton
  61. {
  62. Type = ClickButtonType.location_select,
  63. Name = "发送位置",
  64. Key = "Event_Location_Select"
  65. }
  66. }
  67. }
  68. },
  69. AccessToken = AccessToken
  70. };
  71. }
  72. }
  73. }