AppData.ts 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /**
  2. * @description 应用数据
  3. * @author 邹勇
  4. */
  5. export class AppData {
  6. public getDeviceInfoCompelete: boolean = false;
  7. /** 错误日志游戏名标志,尽量短 */
  8. public appNameBugly: string = '3xiao';
  9. public appVersion: string = '';
  10. /** 投放渠道号 */
  11. public tfChannel: string = '';
  12. /** api版本 */
  13. public version: string = '';
  14. /** UserAgent */
  15. UA = '';
  16. IP = '';
  17. /** 测试服/正式服的appId */
  18. public appId: string = '';
  19. /** 友盟渠道 */
  20. public umengChannel: string = '';
  21. /** 设备型号 */
  22. public deviceType: string = '';
  23. /** 安卓版本号 */
  24. public androidVersion: string = '';
  25. public mac: string = '';
  26. /** 设备信息 */
  27. public machineInfo = {
  28. "android_id": "",
  29. "idfa": "",
  30. "imei": "",
  31. "mac": "",
  32. "oaid": "",
  33. "umid": "",
  34. "UA": ""
  35. };
  36. /**
  37. * 更新设备信息
  38. * @description 自定义功能 JavaToCocos
  39. * @param info info(Java返回)
  40. */
  41. public updateDeviceInfo(info) {
  42. let arr = info.split('#')
  43. this.machineInfo.android_id = arr[0];
  44. this.machineInfo.idfa = arr[1];
  45. this.machineInfo.imei = arr[2];
  46. this.machineInfo.mac = this.mac = arr[3];
  47. this.machineInfo.oaid = arr[4];
  48. this.machineInfo.umid = arr[5];
  49. this.machineInfo.UA = arr[11];
  50. this.tfChannel = arr[6];
  51. this.appVersion = arr[7];
  52. /** 友盟渠道 */
  53. this.umengChannel = arr[8];
  54. /** 设备型号 */
  55. this.deviceType = arr[9];
  56. /** 安卓版本号 */
  57. this.androidVersion = arr[10];
  58. this.IP = arr[12]
  59. this.getDeviceInfoCompelete = true;
  60. console.log("===[this.tfChannel", this.tfChannel);
  61. console.log("===[this.appVersion", this.appVersion);
  62. console.log("===[this.mac", this.mac);
  63. }
  64. public init() {
  65. }
  66. /** 更新状态 */
  67. public updateState: UpdateState = UpdateState.None;
  68. /** 更新进度 */
  69. public updatePercent = 0;
  70. //强更信息--------------------------------------------------------
  71. /** 需要强制更新 */
  72. public needForceUpdate;
  73. /** 安装版本 */
  74. public installVersion;
  75. /** 安装路径 */
  76. public installUrl;
  77. /** 更新信息 */
  78. public updateDes;
  79. /** 修复信息 */
  80. public fixDes;
  81. }
  82. /** 更新状态 */
  83. export enum UpdateState {
  84. None = -1,
  85. CheckForce = 0,
  86. ForceUpdateFinish = 1,
  87. CheckHot = 2,
  88. IsUpdate = 3,
  89. UpdateFinish = 4,
  90. }