收藏
回答

【智商是硬伤】获取小程序二维码流是多少进制的(二进制,八进制)?

为啥不给二维码服务器图片地址啊

//

function getToken(){

var loadurl="https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid="+

getApp().data.appkey.appid+"&secret="+getApp().data.appkey.secret; 

wx.request({ url: loadurl,method: 'POST',

 header: {'content-type': 'application/x-www-form-urlencoded'},  

   data: {  }

 ,success: function (res) { 

    var access_token=res.data.access_token; console.log(access_token);

    getCode(access_token);

   }

});

}


function getCode(access_token){

var loadurl="https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token="+access_token; 

wx.request({ url: loadurl,method: 'POST',

 //header: {'content-type': 'application/x-www-form-urlencoded'},  

 data: {

 "path":"pag/index/index",

 "width":200,

 },success: function (res) {//图片 二进制流 

 pag.setData({img_code:res.data });

    console.log("图片"+res.data.length);

   

    //for(var p in res.data){  console.log(p + " " + res.data[p]); }

   }

});

}



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

3 个回答

  • 小益[奸笑]
    小益[奸笑]
    2017-06-21

    为啥JAVA得不到图片流咯,在微信模拟器里面可以的

    URL address=new URL(url);  

    HttpURLConnection uc=(HttpURLConnection)address.openConnection();

    uc.setRequestProperty("Connection", "keep-alive");

    uc.setRequestProperty("Accept", "*/*");

    uc.setRequestProperty("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");

    uc.setRequestProperty("Host", "api.mch.weixin.qq.com");

    uc.setRequestProperty("X-Requested-With", "XMLHttpRequest");

    uc.setRequestProperty("Cache-Control", "max-age=0");

    uc.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) ");

    uc.setRequestMethod("POST"); 

    uc.setDoOutput(true); 

    OutputStream os = uc.getOutputStream(); 

    os.write(where.getBytes());  // &password=admin

    os.close();  

    uc.connect(); 

    InputStream inputStream=uc.getInputStream();

    InputStreamReader inputStreamReader=new InputStreamReader(inputStream,"utf8");

    BufferedReader news=new   BufferedReader(inputStreamReader);

    String  line=news.readLine();

    while (line!=null)   { 

    result+=line; line=news.readLine(); 

    news.close();

    inputStreamReader.close();

    inputStream.close();


    2017-06-21
    有用
    回复
  • 小益[奸笑]
    小益[奸笑]
    2017-06-21

    靠我的是JAVA

    2017-06-21
    有用
    回复
  • 云选片~影楼在线选片小程序
    云选片~影楼在线选片小程序
    2017-06-09

    参考我回答的另一帖子

    2017-06-09
    有用
    回复
登录 后发表内容