const app = require('../utils/util.js');
const request = (url, data = {}, type = 'GET') => {
  return new Promise((resolve, reject) => {
    wx.request({
      url: `${app.globalData.publicUrl}${url}`,
      method: type,
      data,
      success({
        data
      }) {
        resolve({
          status: 0,
          data,
          msg: 'request请求成功获取到数据'
        });
      },
      fail() {
        reject({
          status: 1,
          msg: 'request请求失败'
        })
      }
    });
  });
};
module.exports = {
  request
}