zhenghy
@@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
2 "app": { 2 "app": {
3 "bundleName": "com.peopledailychina.hosactivity", 3 "bundleName": "com.peopledailychina.hosactivity",
4 "vendor": "$string:app_vendor", 4 "vendor": "$string:app_vendor",
5 - "versionCode": 1000000, 5 + "versionCode": 10000,
6 "versionName": "1.0.0", 6 "versionName": "1.0.0",
7 "icon": "$media:app_icon", 7 "icon": "$media:app_icon",
8 "label": "$string:app_name" 8 "label": "$string:app_name"
1 -export default class BuildProfile {  
2 - static readonly HAR_VERSION = '1.0.0';  
3 - static readonly BUILD_MODE_NAME = 'debug';  
4 - static readonly DEBUG = true;  
5 -}  
@@ -50,6 +50,30 @@ export class DeviceUtil { @@ -50,6 +50,30 @@ export class DeviceUtil {
50 * @returns 50 * @returns
51 */ 51 */
52 static getDisplayVersion(): string { 52 static getDisplayVersion(): string {
53 - return deviceInfo.productModel; 53 + return deviceInfo.displayVersion;
  54 + }
  55 +
  56 + /**
  57 + * 返回设备sdk版本
  58 + * 12
  59 + * @returns
  60 + */
  61 + static getOsVersion(): string {
  62 + return deviceInfo.sdkApiVersion + '';
  63 + }
  64 +
  65 + /**
  66 + * 获取平台标识,暂手机,后续适配tv、笔记本、pad,再扩展
  67 + */
  68 + static getPlat() {
  69 + return 'Phone';
  70 + }
  71 +
  72 + /**
  73 + * 客户端日志链路追踪traceid生成:在每个请求头加上参数Key:EagleEye-TraceID ,value为32位生成随机值
  74 + */
  75 + static getRandomUUIDForTraceID(): string {
  76 + deviceInfo.productModel
  77 + return util.generateRandomUUID().toUpperCase().replace('-', '')
54 } 78 }
55 -}  
  79 +}
1 import { SpConstants } from 'wdConstant'; 1 import { SpConstants } from 'wdConstant';
2 -import { SPHelper, StringUtils } from 'wdKit'; 2 +import { DateTimeUtils, DeviceUtil, SPHelper, StringUtils } from 'wdKit';
3 import { HostEnum, HostManager } from './HttpHostManager'; 3 import { HostEnum, HostManager } from './HttpHostManager';
4 4
5 /** 5 /**
@@ -13,27 +13,27 @@ export class HttpParams { @@ -13,27 +13,27 @@ export class HttpParams {
13 static buildHeaders(): Record<string, string> { 13 static buildHeaders(): Record<string, string> {
14 let headers: Record<string, string> = {}; 14 let headers: Record<string, string> = {};
15 // 通用请求头 15 // 通用请求头
16 - headers['User-Agent'] = 'Dalvik/2.1.0 (Linux; U; Android 13; 22101317C Build/TKQ1.221013.002)'  
17 - headers['channel'] = HttpParams.getChannel()  
18 - headers['plat'] = HttpParams.getPlat() 16 + headers['User-Agent'] = 'Dalvik/2.1.0 (Linux; U; Android 13; 22101317C Build/TKQ1.221013.002)' // TODO
  17 + headers['channel'] = 'rmrb_china_0000' // 自有渠道
  18 + headers['plat'] = DeviceUtil.getPlat()
19 headers['Content-Type'] = 'application/json; charset=utf-8' 19 headers['Content-Type'] = 'application/json; charset=utf-8'
20 - headers['timestamp'] = HttpParams.getTimestamp()  
21 - headers['RMRB-X-TOKEN'] = HttpParams.getXToken()  
22 - headers['device_id'] = HttpParams.getDeviceId()  
23 - if (HttpParams.getXToken() != '') {  
24 - headers['cookie'] = 'RMRB-X-TOKEN=' + HttpParams.getXToken()  
25 - } 20 + headers['device_id'] = DeviceUtil.clientId()
26 headers['build_version'] = HttpParams.getVersion() 21 headers['build_version'] = HttpParams.getVersion()
27 headers['adcode'] = HttpParams.getAdCode() 22 headers['adcode'] = HttpParams.getAdCode()
28 - headers['os_version'] = HttpParams.getOsVersion() 23 + headers['os_version'] = DeviceUtil.getOsVersion()
  24 + headers['system'] = 'Android' // TODO 后续是否新增鸿蒙标识
29 headers['versionCode'] = HttpParams.getVersionCode() 25 headers['versionCode'] = HttpParams.getVersionCode()
30 - headers['system'] = HttpParams.getTerminalId()  
31 headers['version_name'] = HttpParams.getVersionName() 26 headers['version_name'] = HttpParams.getVersionName()
32 - headers['EagleEye-TraceID'] = 'D539562E48554A60977AF4BECB6D6C7A'  
33 - headers['imei'] = HttpParams.getImei() 27 + headers['EagleEye-TraceID'] = DeviceUtil.getRandomUUIDForTraceID()
  28 + headers['imei'] = DeviceUtil.clientId()
34 headers['Accept-Language'] = 'zh' 29 headers['Accept-Language'] = 'zh'
  30 + headers['timestamp'] = DateTimeUtils.getTimeStamp() + ''
35 HttpParams.setLocationHeader(headers) 31 HttpParams.setLocationHeader(headers)
36 // // TODO 判断是否登录 32 // // TODO 判断是否登录
  33 + headers['RMRB-X-TOKEN'] = HttpParams.getXToken()
  34 + if (HttpParams.getXToken() != '') {
  35 + headers['cookie'] = 'RMRB-X-TOKEN=' + HttpParams.getXToken()
  36 + }
37 headers['userId'] = HttpParams.getUserId() 37 headers['userId'] = HttpParams.getUserId()
38 headers['userType'] = HttpParams.getUserType() 38 headers['userType'] = HttpParams.getUserType()
39 // 39 //
@@ -80,26 +80,6 @@ export class HttpParams { @@ -80,26 +80,6 @@ export class HttpParams {
80 } 80 }
81 } 81 }
82 82
83 - private static getCity() {  
84 - // TODO 对接定位  
85 - return '%E5%90%88%E8%82%A5%E5%B8%82';  
86 - }  
87 -  
88 - private static getChannel() {  
89 - // TODO 对接配置  
90 - return 'rmrb_china_0000';  
91 - }  
92 -  
93 - private static getPlat() {  
94 - return 'Phone';  
95 - }  
96 -  
97 - private static getTimestamp() {  
98 - // return DateTimeUtils.getCurrentTime() + '';  
99 - // TODO 暂时写死,有些page 真实时间戳 返回数据为空  
100 - return '155203523';  
101 - }  
102 -  
103 private static getXToken() { 83 private static getXToken() {
104 if (StringUtils.isNotEmpty(HttpParams.token)) { 84 if (StringUtils.isNotEmpty(HttpParams.token)) {
105 return HttpParams.token 85 return HttpParams.token
@@ -120,11 +100,6 @@ export class HttpParams { @@ -120,11 +100,6 @@ export class HttpParams {
120 return ''; 100 return '';
121 } 101 }
122 102
123 - public static getDeviceId() {  
124 - // TODO  
125 - return '8a81226a-cabd-3e1b-b630-b51db4a720ed';  
126 - }  
127 -  
128 private static getVersion() { 103 private static getVersion() {
129 // TODO 104 // TODO
130 return '202401242103'; 105 return '202401242103';
@@ -132,25 +107,22 @@ export class HttpParams { @@ -132,25 +107,22 @@ export class HttpParams {
132 107
133 private static getVersionCode() { 108 private static getVersionCode() {
134 // TODO 109 // TODO
135 - return '7301'; 110 + return '10000';
136 } 111 }
137 112
138 private static getVersionName() { 113 private static getVersionName() {
139 // TODO 114 // TODO
140 - return '7.3.0.1'; 115 + return '1.0.0';
141 } 116 }
142 117
143 private static getAdCode() { 118 private static getAdCode() {
  119 + // 省份编码
144 return '340000'; 120 return '340000';
145 } 121 }
146 122
147 - private static getOsVersion() {  
148 - // TODO  
149 - return '12';  
150 - }  
151 -  
152 public static getCityCode() { 123 public static getCityCode() {
153 // TODO 124 // TODO
  125 + // 城市编码
154 return '340100'; 126 return '340100';
155 } 127 }
156 128
@@ -167,15 +139,6 @@ export class HttpParams { @@ -167,15 +139,6 @@ export class HttpParams {
167 return '340103'; 139 return '340103';
168 } 140 }
169 141
170 - private static getTerminalId() {  
171 - return 'Android';  
172 - }  
173 -  
174 - public static getImei() {  
175 - // TODO  
176 - return '8a81226a-cabd-3e1b-b630-b51db4a720ed';  
177 - }  
178 -  
179 public static getUserId(): string { 142 public static getUserId(): string {
180 // TODO 对接登录 143 // TODO 对接登录
181 if (StringUtils.isNotEmpty(HttpParams.userId)) { 144 if (StringUtils.isNotEmpty(HttpParams.userId)) {