请求接口
let url =
'https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=' +
data.access_token;
let data2 = {
path: data.data.path,
scene: data.data.scene,
};
let data1 = await this.httpService.post(url, data2, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded;charset=utf-8',
},
responseType: 'arraybuffer',
});
存储二进制文件到腾讯云cos
await this.cosService
.putObject({
Bucket: '',
Region: '',
Key:
new Date().getTime() + //自行更改生成文件名字和存储目录
'.jpg',
Body: data1.data,
})
.then(data => {
console.log(data.Location) //图片地址
})
.catch(err => {
});