mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2026-03-10 00:13:40 +08:00
改造查询菜单接口,以支持个性化菜单的conditionalmenu和menuid属性, #126
This commit is contained in:
@@ -3,6 +3,7 @@ package me.chanjar.weixin.mp.api;
|
||||
import me.chanjar.weixin.common.bean.menu.WxMenu;
|
||||
import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.mp.bean.menu.WxMpGetSelfMenuInfoResult;
|
||||
import me.chanjar.weixin.mp.bean.menu.WxMpMenu;
|
||||
|
||||
/**
|
||||
* 菜单相关操作接口
|
||||
@@ -54,10 +55,10 @@ public interface WxMpMenuService {
|
||||
/**
|
||||
* <pre>
|
||||
* 自定义菜单查询接口
|
||||
* 详情请见: http://mp.weixin.qq.com/wiki/index.php?title=自定义菜单查询接口
|
||||
* 详情请见: https://mp.weixin.qq.com/wiki?t=resource/res_main&id=mp1421141014&token=&lang=zh_CN
|
||||
* </pre>
|
||||
*/
|
||||
WxMenu menuGet() throws WxErrorException;
|
||||
WxMpMenu menuGet() throws WxErrorException;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
|
||||
@@ -7,6 +7,7 @@ import me.chanjar.weixin.common.exception.WxErrorException;
|
||||
import me.chanjar.weixin.mp.api.WxMpMenuService;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.bean.menu.WxMpGetSelfMenuInfoResult;
|
||||
import me.chanjar.weixin.mp.bean.menu.WxMpMenu;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@@ -78,11 +79,11 @@ public class WxMpMenuServiceImpl implements WxMpMenuService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public WxMenu menuGet() throws WxErrorException {
|
||||
public WxMpMenu menuGet() throws WxErrorException {
|
||||
String url = API_URL_PREFIX + "/get";
|
||||
try {
|
||||
String resultContent = this.wxMpService.get(url, null);
|
||||
return WxMenu.fromJson(resultContent);
|
||||
return WxMpMenu.fromJson(resultContent);
|
||||
} catch (WxErrorException e) {
|
||||
// 46003 不存在的菜单数据
|
||||
if (e.getError().getErrorCode() == 46003) {
|
||||
|
||||
Reference in New Issue
Block a user