// 云函数入口文件 const cloud = require('wx-server-sdk') var req = require('request-promise'); cloud.init() // 云函数入口函数 exports.main = async (event, context) => { const {method,param1,param2} = event let url = 'http://ttttt.com'; let options = {}; if(method == 'post'){ options = { uri: url, method:"POST", headers: { 'User-Agent': 'Request-Promise' }, body: { param1:param1, param2:param2, }, json: true }; }else{ options = { uri: url, method:"GET", headers: { 'User-Agent': 'Request-Promise' }, qs: { param1:param1, param2:param2, }, json: true }; } return await req(options); }