12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- function request(dever, url, param, callback, method, header)
- {
- if (!header) {
- var header = {};
- header['content-type'] = 'application/x-www-form-urlencoded';
- }
- var types = url;
- for (var i in dever.config.host) {
- if (url.indexOf(i + '.') != -1) {
- url = url.replace(i + '.', dever.config.host[i]);
- break;
- }
- }
- if (url.indexOf('http') == -1 || dever.config.local) {
- return dever.package('analog').data(dever, types, param, callback);
- }
- wx.request(
- {
- url: url,
- data: param,
- method: method.toUpperCase(),
- header: header,
- success: function (res) {
- if (res.data.status == 1) {
- if (res.data.data.config) {
- dever.setSetting(res.data.data.config);
- }
- dever.stopPullDown();
- callback.success(res.data.data, res);
- } else {
- dever.alert(res.msg);
- }
- },
- fail: function () {
-
- },
- complete: function () {
-
- }
- })
- }
- module.exports = {
- request:request
- }
|