// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()
var rp = require('request-promise')
// 云函数入口函数
exports.main = async (event, context) => {
  var formData = {
    devcodes:event.devcodes
	}
  return await new Promise((resolve, reject) => {
    rp({
      url: event.url,
      method: "POST",
      json: true,
      formData: formData,
      headers: {
        // "content-type": "application/json",
        "content-Type": "application/x-www-form-urlencoded",
        // 'User-Agent': 'Request-Promise'
        // "token": event.token
      },
    }, function (error, response, body) {
      console.log("响应" + body)
      resolve(body)
      if (!error && response.statusCode == 200) {
        try {

        } catch (e) {
          reject()
        }
      }
    })
  })
}