DataSystem.ts 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. * 星云打点
  57. */
  58. public sendXYEvent(eventId: string, des: string) {
  59. if (eventId && des) {
  60. let data = {
  61. "uin": gData.loginData.uin,
  62. "isFirstDay": gData.gameData.gameData.loginDays == 1 ? 1 : 0,
  63. "umengChannel": gData.appData.umengChannel,
  64. "deviceType": gData.appData.deviceType,
  65. "androidVerison": gData.appData.androidVersion,
  66. "version": gData.appData.appVersion,
  67. "point": eventId,
  68. "description": des,
  69. "tfChannel": gData.appData.tfChannel
  70. }
  71. mk.http.sendData('cp', data);
  72. }
  73. }
  74. }