|
1 | 1 | package com.github.binarywang.demo.wx.mp.controller;
|
2 | 2 |
|
| 3 | +import java.net.MalformedURLException; |
| 4 | +import java.net.URL; |
| 5 | +import javax.servlet.http.HttpServletRequest; |
| 6 | + |
| 7 | +import org.springframework.web.bind.annotation.GetMapping; |
| 8 | +import org.springframework.web.bind.annotation.PathVariable; |
| 9 | +import org.springframework.web.bind.annotation.PostMapping; |
| 10 | +import org.springframework.web.bind.annotation.RequestBody; |
| 11 | +import org.springframework.web.bind.annotation.RequestMapping; |
| 12 | +import org.springframework.web.bind.annotation.RestController; |
| 13 | +import org.springframework.web.context.request.RequestContextHolder; |
| 14 | +import org.springframework.web.context.request.ServletRequestAttributes; |
| 15 | + |
3 | 16 | import com.github.binarywang.demo.wx.mp.config.WxMpConfiguration;
|
4 | 17 | import me.chanjar.weixin.common.api.WxConsts;
|
5 | 18 | import me.chanjar.weixin.common.bean.menu.WxMenu;
|
6 | 19 | import me.chanjar.weixin.common.bean.menu.WxMenuButton;
|
7 | 20 | import me.chanjar.weixin.common.error.WxErrorException;
|
8 | 21 | import me.chanjar.weixin.mp.bean.menu.WxMpGetSelfMenuInfoResult;
|
9 | 22 | import me.chanjar.weixin.mp.bean.menu.WxMpMenu;
|
10 |
| -import org.springframework.web.bind.annotation.*; |
11 |
| -import org.springframework.web.context.request.RequestContextHolder; |
12 |
| -import org.springframework.web.context.request.ServletRequestAttributes; |
13 |
| - |
14 |
| -import javax.servlet.http.HttpServletRequest; |
15 |
| - |
16 |
| -import java.net.MalformedURLException; |
17 |
| -import java.net.URL; |
18 | 23 |
|
19 | 24 | import static me.chanjar.weixin.common.api.WxConsts.MenuButtonType;
|
20 | 25 |
|
@@ -112,8 +117,8 @@ public String menuCreateSample(@PathVariable String appid) throws WxErrorExcepti
|
112 | 117 | * @param json
|
113 | 118 | * @return 如果是个性化菜单,则返回menuid,否则返回null
|
114 | 119 | */
|
115 |
| - @GetMapping("/create/{json}") |
116 |
| - public String menuCreate(@PathVariable String appid, @PathVariable String json) throws WxErrorException { |
| 120 | + @PostMapping("/createByJson") |
| 121 | + public String menuCreate(@PathVariable String appid, @RequestBody String json) throws WxErrorException { |
117 | 122 | return WxMpConfiguration.getMpServices().get(appid).getMenuService().menuCreate(json);
|
118 | 123 | }
|
119 | 124 |
|
|
0 commit comments