// 云函数调用文件
const cloud = require(‘wx-server-sdk’)
const got = require(‘got’);
const request = require(‘request’)
cloud.init()
// 云函数入口函数
exports.main = async(event, context) => {
let token_url = “https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx2d813496a8eef0&secret=86d1e3e67e9383284d177bc31b2c99”;
const token_info = new Promise((resolve, reject) => {
request(token_url, (err, resp, body) => {
resolve(body)
})
})
let url = “https://api.weixin.qq.com/cgi-bin/material/batchget_material?access_token=token_info”;
const res = new Promise((resolve, reject) => {
request(url, (err, resp, body) => {
resolve(body)
})
})
return token_info
}
打印出来
如果 return res 时
打印出来是
请教!个人小程序就不能调用自己的个人公众号,还是说有办法可以调用,求高人指教。