|
|
import Taro from '@tarojs/taro';
|
|
|
import getPrivateKey from './getPrivateKey'
|
|
|
import config from '../../config.js'
|
|
|
import trimObject from './utils/trimObject.js'
|
...
|
...
|
@@ -151,6 +152,17 @@ const sendRequest = (resolve, reject, options) => { |
|
|
const statusCode = res.statusCode;
|
|
|
const errMsg = res.message;
|
|
|
const data = res.data;
|
|
|
|
|
|
// 活动平台限流
|
|
|
if(res.statusCode === 503 && url.indexOf(config.domains.activityHost) > -1) {
|
|
|
Taro.showToast({
|
|
|
title: '目前参与人数过多请下拉刷新',
|
|
|
icon: 'none',
|
|
|
duration: 2000
|
|
|
});
|
|
|
return reject({ code: 503, message: '目前参与人数过多请下拉刷新' });
|
|
|
}
|
|
|
|
|
|
if (res.statusCode === 401) {
|
|
|
try {
|
|
|
const analytics = global.analytics;
|
...
|
...
|
@@ -183,6 +195,16 @@ const sendRequest = (resolve, reject, options) => { |
|
|
fail: function (err) {
|
|
|
const code = err.code ? err.code : 800;
|
|
|
const message = err.message ? err.message : '';
|
|
|
|
|
|
// 活动平台限流
|
|
|
if (code === 503 && url.indexOf(config.domains.activityHost) > -1) {
|
|
|
Taro.showToast({
|
|
|
title: '目前参与人数过多请下拉刷新',
|
|
|
icon: 'none',
|
|
|
duration: 2000
|
|
|
});
|
|
|
return reject({ code: 503, message: '目前参与人数过多请下拉刷新' });
|
|
|
}
|
|
|
reject({ code, message });
|
|
|
},
|
|
|
complete: options.complete, // 无论成功还是失败, 都会调用,可以用于取消 loading 等
|
...
|
...
|
|