| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115 |
- import JsbSystem from "./JsbSystem";
- /**
- * @description 数据管理类
- * @author 邹勇
- */
- export default class DataSystem {
- constructor() {
- }
- /**
- * 数数注册事件
- */
- public setTAEventRegister() {
- JsbSystem.setTAEventRegister();
- }
- /**
- * 数数打点
- * @param eventId 事件Id
- * @param des 事件内容
- */
- public sendDataEvent(eventId: string, des: string) {
- console.log("===[DataSystem", eventId, des);
- if (eventId && des) {
- JsbSystem.sendEvent(eventId, des);
- this.sendXYTrack(eventId, 'des', des);
- }
- }
- /**
- * 数数打点
- * @param eventId 事件Id
- * @param des 事件内容
- */
- public sendDataEventValue(eventId: string, des: string, value: number) {
- console.log("===[DataSystem", eventId, des, value);
- if (eventId && des) {
- JsbSystem.sendEventValue(eventId, des, value);
- this.sendXYTrack(eventId, des, value);
- }
- }
- /**
- * 设置人物属性
- * @param type 0 set 1 add
- * @param property 属性名
- * @param value 浮点数值
- */
- public setTAEventUser(type: number, property: string, value: number) {
- JsbSystem.setTAEventUser(type, property, value);
- }
- /**
- * 设置人物属性
- * @param type 0 set 1 add
- * @param property 属性名
- * @param value 字符串数值
- */
- public setTAEventUserStr(type: number, property: string, value: string) {
- JsbSystem.setTAEventUserStr(type, property, value);
- }
- /**
- * 设置人物uin
- */
- public setTAUserID(id: string) {
- JsbSystem.setTAUserID(id);
- }
- /**
- * 星云打点
- */
- public sendXYEvent(eventId: string, des: string) {
- if (eventId && des) {
- let data = {
- "uin": gData.loginData.uin,
- "isFirstDay": gData.gameData.playerProp.loginDays == 1 ? 1 : 0,
- "umengChannel": gData.appData.umengChannel,
- "deviceType": gData.appData.deviceType,
- "androidVerison": gData.appData.androidVersion,
- "version": gData.appData.appVersion,
- "point": eventId,
- "description": des,
- "tfChannel": gData.appData.tfChannel
- }
- mk.http.sendData('cp', data);
- }
- }
- /**
- * 星云打点 Track
- */
- public sendXYTrack(eventId: string, des: string, value: number | string) {
- let data = {
- app_id: '30WAK1lNDc0b99LzSOJqv3TXa',
- app_type: 1,
- app_ver: gData.appData.androidVersion,
- app_channel: gData.appData.tfChannel,
- report_time: Date.now(),
- user_id: gData.loginData.uin,
- device_id: gData.appData.deviceType,
- os_type: 1,
- user_agent: gData.appData.UA,
- imei: gData.appData.machineInfo.imei,
- ifda: gData.appData.machineInfo.idfa,
- oaid: gData.appData.machineInfo.oaid,
- event_id: eventId,
- event_value: `{"${des}":${value}}`
- }
- mk.http.sendData('track', data);
- }
- }
|