html52.com
我爱小程序-开发者交流社区

客户端无法直接生成二维码



在小游戏中,测试生成二维码,调用接口B,直接在开发者工具中生成二维码,一直不成功,但是同样的代码在java端就能正常生成,求解!!

以下为主要代码

let access_token = res.data.access_token
//拼接生成json
let jsonData = '{"scene":"231221"}'
//请求二维码
wx.request({
 url: 'https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token='+access_token,
 data: jsonData,
 method: 'POST',
 success: function (res) {
   const fs = wx.getFileSystemManager()
   console.log(res)
   fs.writeFileSync(`${wx.env.USER_DATA_PATH}/QRCode.png`, res.data, "utf-8")
 },
 fail: function (res) {
   console.log("获取二维码失败")
 }
})

生成的图片,不能正常打开

生成的图片,不能正常打开

网友回复

小张?:

一样的问题啊, 折腾一天了

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付