AppData.ts 2.7 KB

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