|
@@ -687,6 +687,18 @@ public class WeChatServiceImpl implements WeChatService, InitializingBean {
|
|
|
}
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean delMenu(String accountId) {
|
|
|
+ String url = "https://api.weixin.qq.com/cgi-bin/menu/delete?access_token=%s";
|
|
|
+ String accessToken = getAuthorizerAccessToken(accountId);
|
|
|
+ url = String.format(url,accessToken);
|
|
|
+ logger.info("微信删除公众号菜单,accountId:{}----start,时间:{}",accountId,LocalDateTime.now().toString());
|
|
|
+ String jsonStr = restTemplate.getForObject(url,String.class);
|
|
|
+ logger.info("微信创建公众号菜单,accountId:{}----end,时间:{},微信返回:{}",accountId,LocalDateTime.now().toString(),jsonStr);
|
|
|
+ int errcode = JSONObject.parseObject(jsonStr).getIntValue("errcode");
|
|
|
+ return 0 == errcode;
|
|
|
+ }
|
|
|
+
|
|
|
private String parseToJson (List<AccountMenu> accountMenus) {
|
|
|
int size = accountMenus.size();
|
|
|
JSONObject jsonObject = new JSONObject(1);
|
|
@@ -699,6 +711,12 @@ public class WeChatServiceImpl implements WeChatService, InitializingBean {
|
|
|
temp.put("name",menu.getName());
|
|
|
if ("media_id".equals(menu.getType()) || "view_limited".equals(type)) {
|
|
|
temp.put("media_id",menu.getKey());
|
|
|
+ }else if ("view".equals(type)){
|
|
|
+ temp.put("url",menu.getKey());
|
|
|
+ }else if ("miniprogram".equals(type)) {
|
|
|
+ temp.put("url",menu.getKey());
|
|
|
+ temp.put("appid",menu.getParam1());
|
|
|
+ temp.put("pagepath",menu.getParam2());
|
|
|
}else {
|
|
|
temp.put("key",menu.getKey());
|
|
|
}
|