修复 微信获取临时素材 使用get请求
This commit is contained in:
parent
7498d79c37
commit
a4cd70cbd1
|
|
@ -217,16 +217,10 @@ export class WechatMpInstance {
|
|||
async getTemporaryMaterial(options) {
|
||||
const { mediaId } = options;
|
||||
const myInit = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
media_id: mediaId,
|
||||
}),
|
||||
method: 'GET',
|
||||
};
|
||||
const token = await this.getAccessToken();
|
||||
const result = await this.access(`https://api.weixin.qq.com/cgi-bin/media/get?access_token=${token}`, myInit);
|
||||
const result = await this.access(`https://api.weixin.qq.com/cgi-bin/media/get?access_token=${token}&media_id=${mediaId}`, myInit);
|
||||
if (this.isJson(result)) {
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -614,16 +614,10 @@ export class WechatPublicInstance {
|
|||
async getTemporaryMaterial(options) {
|
||||
const { mediaId } = options;
|
||||
const myInit = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
media_id: mediaId,
|
||||
}),
|
||||
method: 'GET',
|
||||
};
|
||||
const token = await this.getAccessToken();
|
||||
const result = await this.access(`https://api.weixin.qq.com/cgi-bin/media/get?access_token=${token}`, myInit);
|
||||
const result = await this.access(`https://api.weixin.qq.com/cgi-bin/media/get?access_token=${token}&media_id=${mediaId}`, myInit);
|
||||
if (this.isJson(result)) {
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,16 +221,10 @@ class WechatMpInstance {
|
|||
async getTemporaryMaterial(options) {
|
||||
const { mediaId } = options;
|
||||
const myInit = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
media_id: mediaId,
|
||||
}),
|
||||
method: 'GET',
|
||||
};
|
||||
const token = await this.getAccessToken();
|
||||
const result = await this.access(`https://api.weixin.qq.com/cgi-bin/media/get?access_token=${token}`, myInit);
|
||||
const result = await this.access(`https://api.weixin.qq.com/cgi-bin/media/get?access_token=${token}&media_id=${mediaId}`, myInit);
|
||||
if (this.isJson(result)) {
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -618,16 +618,10 @@ class WechatPublicInstance {
|
|||
async getTemporaryMaterial(options) {
|
||||
const { mediaId } = options;
|
||||
const myInit = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
media_id: mediaId,
|
||||
}),
|
||||
method: 'GET',
|
||||
};
|
||||
const token = await this.getAccessToken();
|
||||
const result = await this.access(`https://api.weixin.qq.com/cgi-bin/media/get?access_token=${token}`, myInit);
|
||||
const result = await this.access(`https://api.weixin.qq.com/cgi-bin/media/get?access_token=${token}&media_id=${mediaId}`, myInit);
|
||||
if (this.isJson(result)) {
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -379,17 +379,11 @@ export class WechatMpInstance {
|
|||
async getTemporaryMaterial(options: { mediaId: string }) {
|
||||
const { mediaId } = options;
|
||||
const myInit = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
media_id: mediaId,
|
||||
}),
|
||||
method: 'GET',
|
||||
};
|
||||
const token = await this.getAccessToken();
|
||||
const result = await this.access(
|
||||
`https://api.weixin.qq.com/cgi-bin/media/get?access_token=${token}`,
|
||||
`https://api.weixin.qq.com/cgi-bin/media/get?access_token=${token}&media_id=${mediaId}`,
|
||||
myInit
|
||||
);
|
||||
if (this.isJson(result)) {
|
||||
|
|
|
|||
|
|
@ -892,17 +892,11 @@ export class WechatPublicInstance {
|
|||
async getTemporaryMaterial(options: { mediaId: string }) {
|
||||
const { mediaId } = options;
|
||||
const myInit = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify({
|
||||
media_id: mediaId,
|
||||
}),
|
||||
method: 'GET',
|
||||
};
|
||||
const token = await this.getAccessToken();
|
||||
const result = await this.access(
|
||||
`https://api.weixin.qq.com/cgi-bin/media/get?access_token=${token}`,
|
||||
`https://api.weixin.qq.com/cgi-bin/media/get?access_token=${token}&media_id=${mediaId}`,
|
||||
myInit
|
||||
);
|
||||
if (this.isJson(result)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue