DataSystem.ts 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. import JsbSystem from "./JsbSystem";
  2. /**
  3. * @description 数据管理类
  4. * @author 邹勇
  5. */
  6. export default class DataSystem {
  7. constructor() {
  8. }
  9. /**
  10. * 数数打点
  11. * @param eventId 事件Id
  12. * @param des 事件内容
  13. */
  14. public sendDataEvent(eventId: string, des: string) {
  15. console.log("===[DataSystem", eventId, des);
  16. if (eventId && des) {
  17. JsbSystem.sendEvent(eventId, des);
  18. }
  19. }
  20. /**
  21. * 设置人物属性
  22. * @param type 0 set 1 add
  23. * @param property 属性名
  24. * @param value 浮点数值
  25. */
  26. public setTAEventUser(type: number, property: string, value: number) {
  27. JsbSystem.setTAEventUser(type, property, value);
  28. }
  29. /**
  30. * 设置人物属性
  31. * @param type 0 set 1 add
  32. * @param property 属性名
  33. * @param value 字符串数值
  34. */
  35. public setTAEventUserStr(type: number, property: string, value: string) {
  36. JsbSystem.setTAEventUserStr(type, property, value);
  37. }
  38. /**
  39. * 星云打点
  40. */
  41. public sendXYEvent(eventId: string, des: string) {
  42. if (eventId && des) {
  43. let data = {
  44. "uin": gData.loginData.uin,
  45. "isFirstDay": gData.gameData.gameData.loginDays == 1 ? 1 : 0,
  46. "umengChannel": gData.appData.umengChannel,
  47. "deviceType": gData.appData.deviceType,
  48. "androidVerison": gData.appData.androidVersion,
  49. "version": gData.appData.appVersion,
  50. "point": eventId,
  51. "description": des,
  52. "tfChannel": gData.appData.tfChannel
  53. }
  54. mk.http.sendData('cp', data);
  55. }
  56. }
  57. }