ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、视频、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
~~~ class HTTP { request(param) { //param是一个对象,包含url,data,method,success if (!param.method) { param.method = "GET"; } wx.request({ url: param.url, data: param.data, method: param.method, header: { 'Content-Type': 'application/json', "appkey": config.appkey }, success: function (res) { let code = res.statusCode.toString(); if (code.startsWith("2")) { param.success(res.data); } else { wx.showToast({ title: '网络错误', icon: 'none' }) } }, fail: function () { wx.showToast({ title: '网络错误', icon: 'none' }) } }) } } ~~~