Skip to content

Commit

Permalink
update something
Browse files Browse the repository at this point in the history
  • Loading branch information
binarywang committed Oct 29, 2018
1 parent a550ea5 commit 6d744a9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 13 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
[![码云Gitee](https://gitee.com/binary/weixin-java-mp-demo-springboot/badge/star.svg?theme=blue)](https://gitee.com/binary/weixin-java-mp-demo-springboot)
[![Github](http://github-svg-buttons.herokuapp.com/star.svg?user=binarywang&repo=weixin-java-mp-demo-springboot&style=flat&background=1081C1)](https://github.com/binarywang/weixin-java-mp-demo-springboot)
[![Build Status](https://travis-ci.org/binarywang/weixin-java-mp-demo-springboot.svg?branch=master)](https://travis-ci.org/binarywang/weixin-java-mp-demo-springboot)
-----------------------

### 本Demo基于Spring Boot构建,实现微信公众号后端开发功能。
### 本项目为weixin-java-tools的Demo演示程序,更多Demo请[查阅此处](https://github.com/Wechat-Group/weixin-java-tools/blob/master/demo.md)
#### 如有问题请[【在此提问】](https://github.com/binarywang/weixin-java-mp-demo-springboot/issues),谢谢配合。

[![Build Status](https://travis-ci.org/binarywang/weixin-java-mp-demo-springboot.svg?branch=master)](https://travis-ci.org/binarywang/weixin-java-mp-demo-springboot)
-----------------------

## 使用步骤:
1. 请注意,本demo为简化代码编译时加入了lombok支持,如果不了解lombok的话,请先学习下相关知识,比如可以阅读[此文章](https://mp.weixin.qq.com/s/cUc-bUcprycADfNepnSwZQ)
1. 配置:复制 `/src/main/resources/application.yml.template` 或修改其扩展名生成 `application.yml` 文件,根据自己需要填写相关配置(需要注意的是:yml文件内的属性冒号后面的文字之前需要加空格,可参考已有配置,否则属性会设置不成功);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
package com.github.binarywang.demo.wx.mp.controller;

import java.net.MalformedURLException;
import java.net.URL;
import javax.servlet.http.HttpServletRequest;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import com.github.binarywang.demo.wx.mp.config.WxMpConfiguration;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.bean.menu.WxMenu;
import me.chanjar.weixin.common.bean.menu.WxMenuButton;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.bean.menu.WxMpGetSelfMenuInfoResult;
import me.chanjar.weixin.mp.bean.menu.WxMpMenu;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

import java.net.MalformedURLException;
import java.net.URL;

import static me.chanjar.weixin.common.api.WxConsts.MenuButtonType;

Expand Down Expand Up @@ -112,8 +117,8 @@ public String menuCreateSample(@PathVariable String appid) throws WxErrorExcepti
* @param json
* @return 如果是个性化菜单,则返回menuid,否则返回null
*/
@GetMapping("/create/{json}")
public String menuCreate(@PathVariable String appid, @PathVariable String json) throws WxErrorException {
@PostMapping("/createByJson")
public String menuCreate(@PathVariable String appid, @RequestBody String json) throws WxErrorException {
return WxMpConfiguration.getMpServices().get(appid).getMenuService().menuCreate(json);
}

Expand Down

0 comments on commit 6d744a9

Please sign in to comment.