收藏
回答

小程序直播组件获取直播列表44002?

不是特别清楚该怎么传过去,求指教

回答关注问题邀请回答
收藏

2 个回答

  • Admin ²º²³
    Admin ²º²³
    2020-05-05
        public GetLiveInfo getLiveInfo(Object request){
            String url = "http://api.weixin.qq.com/wxa/business/getliveinfo?access_token={AccessToken}";
            String token = getAccessToken(appId, appSecret, false);
            Map<String, String> vars = new HashMap<>(2);
            vars.put("AccessToken", token);
            GetLiveInfo getLiveInfo = restTemplate.postForObject(url, request, GetLiveInfo.class, vars);
            if (MapUtils.isObjectNotEmpty(getLiveInfo)
                    || getLiveInfo.getErrcode() ==40001) {
                token = getAccessToken(appId, appSecret, false);
                vars = new HashMap<>(2);
                vars.put("AccessToken", token);
                getLiveInfo = restTemplate.postForObject(url, request, GetLiveInfo.class, vars);
            }
            System.out.println("当前剩余次数 ->"+NUM--);
            System.out.println("getLiveInfo ->" +getLiveInfo.getErrmsg());
            return getLiveInfo;
        }
    俺的。
    里面有些class需要你自己建
    
    2020-05-05
    有用 1
    回复 2
    • 工作使我快乐
      工作使我快乐
      2020-05-05
      好的,谢谢啦,已经解决啦
      2020-05-05
      回复
    • ^O^我喜欢你呀2021
      ^O^我喜欢你呀2021
      2020-08-05
      怎末整的 我也有api报44002,但是我之前一直都可以正常访问,换了服务器代码没换就不行了
      2020-08-05
      回复
  • Mr.Zhao
    Mr.Zhao
    2020-05-05

    用 spring 的 RestTemplate吧

    2020-05-05
    有用 1
    回复 2
登录 后发表内容
问题标签