Authored by 李奇

yas ak修改

... ... @@ -7,7 +7,6 @@ import Promise from './vendors/es6-promise';
import {MD5} from './vendors/crypto';
import { WeToast } from './vendors/toast/wetoast';
import { wechatAuthLogin, verifySessionKey } from './common/login';
import { logEvent } from './common/analytics';
import { stringify } from './vendors/query-stringify';
import './router/index';
... ... @@ -70,7 +69,7 @@ App({
});
},
onShow(options) {
logEvent('YB_ENTER_FOREGROUND', {}, this);
// logEvent('YB_ENTER_FOREGROUND', {}, this);
if (this.reportData.awakeReported === false){
let path = options.path;
... ... @@ -78,12 +77,12 @@ App({
path = `${path}?${stringify(options.query)}`
}
logEvent('YB_AWAKE_MP', {PAGE_PATH: path}, this);
// logEvent('YB_AWAKE_MP', {PAGE_PATH: path}, this);
this.reportData.awakeReported = true
}
},
onHide () {
logEvent('YB_ENTER_BACKGROUND', {});
// logEvent('YB_ENTER_BACKGROUND', {});
},
doLogin: function() {
this.getSessionKey();
... ...
import api from './api';
let logEvent = function(eventId, data,appData) {
let app = appData ? appData : getApp();
let ln;//语言
let os;//系统类型
let dm;//设备型号
let re;//屏幕大小
let osv;//系统版本
let ak = 'yohobuy_mp';//
let net = '0';
let ts = new Date().getTime() + '';
//用户id
let uid = app && app.globalData && app.globalData.userInfo && app.globalData.userInfo.uid ? app.globalData.userInfo.uid : '';
//设备id
let udid = app && app.globalData && app.globalData.udid ? app.globalData.udid : '';
//会话id
let sid = app && app.globalData && app.globalData.sid ? app.globalData.sid : '';
let cid = app && app.globalData && app.globalData.cid ? app.globalData.cid : '';
let open_id = app && app.globalData && app.globalData.openID ? app.globalData.openID : wx.getStorageSync('openID');
let union_id = app && app.globalData && app.globalData.WXUnion_ID ? app.globalData.WXUnion_ID : wx.getStorageSync('unionID');
let ch = app && app.globalData && app.globalData.ch ? app.globalData.ch : '';
let union_type = app && app.globalData && app.globalData.union_type ? app.globalData.union_type : '';
wx.getSystemInfo({
success: function (res) {
//返回设备信息
dm = res.model;
ln = res.language;
os = res.platform;
osv = res.system;
re = res.screenWidth+'*'+res.screenHeight;
},
complete: function () {
wx.getNetworkType({
success: function (res) {
// 返回网络类型, 有效值:
// wifi/2g/3g/4g/unknown(Android下不常见的网络类型)/none(无网络)
var networkType = res.networkType
if (networkType === 'wifi') {
net = '1';
} else if (networkType === '2g') {
net = '2';
} else if (networkType === '3g') {
net = '3';
} else if (networkType === '4g') {
net = '4';
} else {
net = '0';
}
},
complete: function () {
let statusParam = { 'net': net, 'ln': ln };
let deviceParam = { 'res': re, 'osv': osv, 'os': os, 'ak': ak, 'dm': dm, 'udid': udid, 'ch': union_type != '' ? union_type+"" : ch+""};
let userParam = data;
userParam.C_ID = cid;
userParam.UNION_ID = union_id;
let eventParam = [{ 'param': userParam, 'ts': ts, 'op': eventId, 'uid': uid, 'sid': sid}]
let parameters = { 'status': statusParam, 'device': deviceParam, 'events': eventParam }
// console.log(parameters)
//
api.get({
api: 'yasApi',
url: '',
data: parameters
});
}
})
}
})
}
module.exports = {
logEvent
}
... ... @@ -12,7 +12,7 @@ export default class yas {
dm: '', // 设备型号
res: '', // 屏幕大小
osv: '', // 系统版本
ak: 'yohobuy_mp',
ak: 'yhshop_mp',
ch: '',
udid: this.app.globalData.udid
};
... ...