DataSystem.ts 2.3 KB

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