更新自定义菜单 API 返回 “不合法的子菜单按钮 URL 长度”,我的 URL 确实没有超长啊 !
发布于 5 年前 作者 yan93 11012 次浏览 来自 问答

微信官方文档:https://developers.weixin.qq.com/doc/offiaccount/Custom_Menus/Creating_Custom-Defined_Menu.html

更新菜单时的原始报文(敏感字段已处理):

 {
  "button": [
    {
      "type": "view",
      "name": "激活会员",
      "url": "https://abcdefgh.abcdefghij.cn/wx/member/activation?abc=abcdefghi"
    },
    {
      "name": "活动入口",
      "sub_button": [
        {
          "type": "miniprogram",
          "name": "邀请有礼",
          "appid": "xxx",
          "pagepath": "pages/market/invite/inviteHome"
        },
        {
          "type": "miniprogram",
          "name": "礼品卡",
          "appid": "xxx",
          "pagepath": "pages/index/index"
        },
        {
          "type": "miniprogram",
          "name": "小程序",
          "appid": "xxx",
          "pagepath": "pages/index/index"
        },
        {
          "type": "view",
          "name": "测试",
          "url": "https://jpostest.wangdian.cn/"
        }
      ]
    },
    {
      "name": "个人中心",
      "sub_button": [
        {
          "type": "miniprogram",
          "name": "会员中心",
          "appid": "xxx",
          "pagepath": "pages/home/homeMain"
        },
        {
          "type": "miniprogram",
          "name": "我的积分",
          "appid": "xxx",
          "pagepath": "pages/score/myScore"
        },
        {
          "type": "miniprogram",
          "name": "优惠券",
          "appid": "xxx",
          "pagepath": "pages/home/homeMain?page_name=homeCoupon"
        },
        {
          "type": "miniprogram",
          "name": "会员资料",
          "appid": "xxx",
          "pagepath": "pages/member/memberInfo/memberInfo"
        },
        {
          "type": "miniprogram",
          "name": "会员特权",
          "appid": "xxx",
          "pagepath": "pages/member/memberPrivilege/memberPrivilege"
        }
      ]
    }
  ]
}
1 回复
 {
          "type": "miniprogram",
          "name": "小程序",
          "appid": "xxx",
          "pagepath": "pages/index/index"
        },
这种的要加上url,
{
          "type": "miniprogram",
          "name": "小程序",
          "appid": "xxx",
          "pagepath": "pages/index/index",
          "url": "http://www.baidu.com"
  
        }
回到顶部