AppData.ts 2.6 KB

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