AppData.ts 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. /** 李杨/悍国服的appId */
  15. // public appId: string = 'wxcf31f0e54f7fefda';
  16. /** 测试服/正式服的appId */
  17. public appId: string = 'wxcf31f0e54f7fefda';
  18. /** 友盟渠道 */
  19. public umengChannel: string = '';
  20. /** 设备型号 */
  21. public deviceType: string = '';
  22. /** 安卓版本号 */
  23. public androidVersion: string = '';
  24. public mac: string = '1e:06:e5:13:b3:23,f6:60:e4:1a:b7:27';
  25. /** 设备信息 */
  26. public machineInfo = {
  27. "android_id": "",
  28. "idfa": "",
  29. "imei": "",
  30. "mac": "",
  31. "oaid": "",
  32. "umid": ""
  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 = this.mac = arr[3];
  45. this.machineInfo.oaid = arr[4];
  46. this.machineInfo.umid = arr[5];
  47. this.tfChannel = arr[6];
  48. this.appVersion = arr[7];
  49. /** 友盟渠道 */
  50. this.umengChannel = arr[8];
  51. /** 设备型号 */
  52. this.deviceType = arr[9];
  53. /** 安卓版本号 */
  54. this.androidVersion = arr[10];
  55. this.getDeviceInfoCompelete = true;
  56. console.log("===[this.tfChannel", this.tfChannel);
  57. console.log("===[this.appVersion", this.appVersion);
  58. }
  59. public init() {
  60. }
  61. /** 更新状态 */
  62. public updateState: UpdateState = UpdateState.None;
  63. //强更信息--------------------------------------------------------
  64. /** 需要强制更新 */
  65. public needForceUpdate;
  66. /** 安装版本 */
  67. public installVersion;
  68. /** 安装路径 */
  69. public installUrl;
  70. /** 更新信息 */
  71. public updateDes;
  72. /** 修复信息 */
  73. public fixDes;
  74. }
  75. /** 更新状态 */
  76. export enum UpdateState {
  77. None = -1,
  78. CheckForce = 0,
  79. ForceUpdateFinish = 1,
  80. CheckHot = 2,
  81. UpdateFinish = 3,
  82. }