diff --git a/src/main/java/com/rymcu/vertical/wx/mp/controller/WxMenuController.java b/src/main/java/com/rymcu/vertical/wx/mp/controller/WxMenuController.java index 03c2372..40ad886 100644 --- a/src/main/java/com/rymcu/vertical/wx/mp/controller/WxMenuController.java +++ b/src/main/java/com/rymcu/vertical/wx/mp/controller/WxMenuController.java @@ -23,7 +23,7 @@ import static me.chanjar.weixin.common.api.WxConsts.MenuButtonType; */ @AllArgsConstructor @RestController -@RequestMapping("/wx/menu/{appid}") +@RequestMapping("/wx/menu/{appId}") public class WxMenuController { private final WxMpService wxService; @@ -38,12 +38,12 @@ public class WxMenuController { * @return 如果是个性化菜单,则返回menuid,否则返回null */ @PostMapping("/create") - public String menuCreate(@PathVariable String appid, @RequestBody WxMenu menu) throws WxErrorException { - return this.wxService.switchoverTo(appid).getMenuService().menuCreate(menu); + public String menuCreate(@PathVariable String appId, @RequestBody WxMenu menu) throws WxErrorException { + return this.wxService.switchoverTo(appId).getMenuService().menuCreate(menu); } @GetMapping("/create") - public String menuCreateSample(@PathVariable String appid) throws WxErrorException, MalformedURLException { + public String menuCreateSample(@PathVariable String appId) throws WxErrorException, MalformedURLException { WxMenu menu = new WxMenu(); WxMenuButton button1 = new WxMenuButton(); button1.setType(MenuButtonType.CLICK); @@ -88,8 +88,8 @@ public class WxMenuController { if (servletRequestAttributes != null) { HttpServletRequest request = servletRequestAttributes.getRequest(); URL requestURL = new URL(request.getRequestURL().toString()); - String url = this.wxService.switchoverTo(appid).oauth2buildAuthorizationUrl( - String.format("%s://%s/wx/redirect/%s/greet", requestURL.getProtocol(), requestURL.getHost(), appid), + String url = this.wxService.switchoverTo(appId).oauth2buildAuthorizationUrl( + String.format("%s://%s/wx/redirect/%s/greet", requestURL.getProtocol(), requestURL.getHost(), appId), WxConsts.OAuth2Scope.SNSAPI_USERINFO, null); button34.setUrl(url); } @@ -99,7 +99,7 @@ public class WxMenuController { button3.getSubButtons().add(button33); button3.getSubButtons().add(button34); - this.wxService.switchover(appid); + this.wxService.switchover(appId); return this.wxService.getMenuService().menuCreate(menu); } @@ -114,8 +114,8 @@ public class WxMenuController { * @return 如果是个性化菜单,则返回menuid,否则返回null */ @PostMapping("/createByJson") - public String menuCreate(@PathVariable String appid, @RequestBody String json) throws WxErrorException { - return this.wxService.switchoverTo(appid).getMenuService().menuCreate(json); + public String menuCreate(@PathVariable String appId, @RequestBody String json) throws WxErrorException { + return this.wxService.switchoverTo(appId).getMenuService().menuCreate(json); } /** @@ -125,8 +125,8 @@ public class WxMenuController { * */ @GetMapping("/delete") - public void menuDelete(@PathVariable String appid) throws WxErrorException { - this.wxService.switchoverTo(appid).getMenuService().menuDelete(); + public void menuDelete(@PathVariable String appId) throws WxErrorException { + this.wxService.switchoverTo(appId).getMenuService().menuDelete(); } /** @@ -138,8 +138,8 @@ public class WxMenuController { * @param menuId 个性化菜单的menuid */ @GetMapping("/delete/{menuId}") - public void menuDelete(@PathVariable String appid, @PathVariable String menuId) throws WxErrorException { - this.wxService.switchoverTo(appid).getMenuService().menuDelete(menuId); + public void menuDelete(@PathVariable String appId, @PathVariable String menuId) throws WxErrorException { + this.wxService.switchoverTo(appId).getMenuService().menuDelete(menuId); } /** @@ -149,8 +149,8 @@ public class WxMenuController { * */ @GetMapping("/get") - public WxMpMenu menuGet(@PathVariable String appid) throws WxErrorException { - return this.wxService.switchoverTo(appid).getMenuService().menuGet(); + public WxMpMenu menuGet(@PathVariable String appId) throws WxErrorException { + return this.wxService.switchoverTo(appId).getMenuService().menuGet(); } /** @@ -162,8 +162,8 @@ public class WxMenuController { * @param userid 可以是粉丝的OpenID,也可以是粉丝的微信号。 */ @GetMapping("/menuTryMatch/{userid}") - public WxMenu menuTryMatch(@PathVariable String appid, @PathVariable String userid) throws WxErrorException { - return this.wxService.switchoverTo(appid).getMenuService().menuTryMatch(userid); + public WxMenu menuTryMatch(@PathVariable String appId, @PathVariable String userid) throws WxErrorException { + return this.wxService.switchoverTo(appId).getMenuService().menuTryMatch(userid); } /** @@ -182,7 +182,7 @@ public class WxMenuController { * */ @GetMapping("/getSelfMenuInfo") - public WxMpGetSelfMenuInfoResult getSelfMenuInfo(@PathVariable String appid) throws WxErrorException { - return this.wxService.switchoverTo(appid).getMenuService().getSelfMenuInfo(); + public WxMpGetSelfMenuInfoResult getSelfMenuInfo(@PathVariable String appId) throws WxErrorException { + return this.wxService.switchoverTo(appId).getMenuService().getSelfMenuInfo(); } } diff --git a/src/main/java/com/rymcu/vertical/wx/mp/controller/WxPortalController.java b/src/main/java/com/rymcu/vertical/wx/mp/controller/WxPortalController.java index 524549a..2462c67 100644 --- a/src/main/java/com/rymcu/vertical/wx/mp/controller/WxPortalController.java +++ b/src/main/java/com/rymcu/vertical/wx/mp/controller/WxPortalController.java @@ -26,13 +26,13 @@ import me.chanjar.weixin.mp.bean.message.WxMpXmlOutMessage; @Slf4j @AllArgsConstructor @RestController -@RequestMapping("/wx/portal/{appid}") +@RequestMapping("/wx/portal/{appId}") public class WxPortalController { private final WxMpService wxService; private final WxMpMessageRouter messageRouter; @GetMapping(produces = "text/plain;charset=utf-8") - public String authGet(@PathVariable String appid, + public String authGet(@PathVariable String appId, @RequestParam(name = "signature", required = false) String signature, @RequestParam(name = "timestamp", required = false) String timestamp, @RequestParam(name = "nonce", required = false) String nonce, @@ -44,8 +44,8 @@ public class WxPortalController { throw new IllegalArgumentException("请求参数非法,请核实!"); } - if (!this.wxService.switchover(appid)) { - throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid)); + if (!this.wxService.switchover(appId)) { + throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appId)); } if (wxService.checkSignature(timestamp, nonce, signature)) { @@ -56,7 +56,7 @@ public class WxPortalController { } @PostMapping(produces = "application/xml; charset=UTF-8") - public String post(@PathVariable String appid, + public String post(@PathVariable String appId, @RequestBody String requestBody, @RequestParam("signature") String signature, @RequestParam("timestamp") String timestamp, @@ -68,8 +68,8 @@ public class WxPortalController { + " timestamp=[{}], nonce=[{}], requestBody=[\n{}\n] ", openid, signature, encType, msgSignature, timestamp, nonce, requestBody); - if (!this.wxService.switchover(appid)) { - throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid)); + if (!this.wxService.switchover(appId)) { + throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appId)); } if (!wxService.checkSignature(timestamp, nonce, signature)) { diff --git a/src/main/java/com/rymcu/vertical/wx/mp/controller/WxRedirectController.java b/src/main/java/com/rymcu/vertical/wx/mp/controller/WxRedirectController.java index 35bf6b4..39c785f 100644 --- a/src/main/java/com/rymcu/vertical/wx/mp/controller/WxRedirectController.java +++ b/src/main/java/com/rymcu/vertical/wx/mp/controller/WxRedirectController.java @@ -19,14 +19,14 @@ import javax.xml.ws.Action; */ @AllArgsConstructor @Controller -@RequestMapping("/wx/redirect/{appid}") +@RequestMapping("/wx/redirect/{appId}") public class WxRedirectController { private final WxMpService wxService; @RequestMapping("/greet") - public String greetUser(@PathVariable String appid, @RequestParam String code, ModelMap map) { - if (!this.wxService.switchover(appid)) { - throw new IllegalArgumentException(String.format("未找到对应appid=[%s]的配置,请核实!", appid)); + public String greetUser(@PathVariable String appId, @RequestParam String code, ModelMap map) { + if (!this.wxService.switchover(appId)) { + throw new IllegalArgumentException(String.format("未找到对应appId=[%s]的配置,请核实!", appId)); } try {