|
|
import Promise from '../vendors/es6-promise';
|
|
|
import {APP_VERSION, ICONFIG_HOST} from '../libs/config';
|
|
|
import {encrypt, decrypt} from '../utils/icfg-aes';
|
|
|
import {stringify} from '../vendors/query-string';
|
|
|
|
|
|
let iconfSwitch = function (app) {
|
|
|
let data = {};
|
|
|
let device = app.globalData.systemInfo;
|
|
|
|
|
|
data.app_ver = APP_VERSION;
|
|
|
data.uid = app.getUid() || '';
|
|
|
data.os = device.platform.indexOf('ios') > -1 ? 0 : 1;
|
|
|
data.osv = device.osv || device.version;
|
|
|
data.model = device.model;
|
|
|
data.udid = app.globalData.udid ? app.globalData.udid : '';
|
|
|
data.patchv = '';
|
|
|
data.ci = (app.getUnion_type() ? app.getUnion_type() : app.globalData.ch) || '';
|
|
|
|
|
|
return new Promise(function (resolve, reject) {
|
|
|
wx.request({
|
|
|
url: `${ICONFIG_HOST}?${encrypt(stringify(data))}`,
|
|
|
success({data} = {}) {
|
|
|
resolve(JSON.parse(decrypt(data)));
|
|
|
},
|
|
|
fail(err) {
|
|
|
reject(err);
|
|
|
}
|
|
|
});
|
|
|
})
|
|
|
|
|
|
};
|
|
|
|
|
|
export default iconfSwitch; |
|
|
\ No newline at end of file |
...
|
...
|
|