wangliang_wd

feat:优化请求头mpaasid获取

@@ -14,6 +14,7 @@ export class SpConstants{ @@ -14,6 +14,7 @@ export class SpConstants{
14 static USER_HEAD_PHOTO_URL = "headPhotoUrl" 14 static USER_HEAD_PHOTO_URL = "headPhotoUrl"
15 static USER_SEX = "sex" 15 static USER_SEX = "sex"
16 static USER_BIRTHDAY = "birthday" 16 static USER_BIRTHDAY = "birthday"
  17 + static USER_MPAASUTDID = "mpaasUtdid"
17 //协议相关 18 //协议相关
18 static NET_SERVICE_PROTOCOL = "user_protocol" //人民日报客户端网络服务使用协议 19 static NET_SERVICE_PROTOCOL = "user_protocol" //人民日报客户端网络服务使用协议
19 static PRIVATE_PROTOCOL = "private_protocol" //人民日报客户端用户隐私协议 20 static PRIVATE_PROTOCOL = "private_protocol" //人民日报客户端用户隐私协议
@@ -26,7 +26,7 @@ export class HttpParams { @@ -26,7 +26,7 @@ export class HttpParams {
26 headers['imei'] = DeviceUtil.clientId() 26 headers['imei'] = DeviceUtil.clientId()
27 headers['Accept-Language'] = 'zh' 27 headers['Accept-Language'] = 'zh'
28 headers['timestamp'] = DateTimeUtils.getTimeStamp() + '' 28 headers['timestamp'] = DateTimeUtils.getTimeStamp() + ''
29 - headers['mpassid'] = 'ZbHTMeTsfaYDAHqt8ZHIzcPs' 29 + headers['mpaasid'] = HttpUtils.getMpaasUtdid()??'ZbHTMeTsfaYDAHqt8ZHIzcPs'
30 HttpParams.setLocationHeader(headers) 30 HttpParams.setLocationHeader(headers)
31 if (HttpUtils.isLogin()) { 31 if (HttpUtils.isLogin()) {
32 headers['RMRB-X-TOKEN'] = HttpUtils.getUserToken() 32 headers['RMRB-X-TOKEN'] = HttpUtils.getUserToken()
@@ -66,6 +66,10 @@ export class HttpUtils { @@ -66,6 +66,10 @@ export class HttpUtils {
66 return SPHelper.default.getSync(SpConstants.USER_JWT_TOKEN, "") as string 66 return SPHelper.default.getSync(SpConstants.USER_JWT_TOKEN, "") as string
67 } 67 }
68 68
  69 + static getMpaasUtdid(): string {
  70 + return SPHelper.default.getSync(SpConstants.USER_MPAASUTDID, "") as string
  71 + }
  72 +
69 public static isLogin(): boolean { 73 public static isLogin(): boolean {
70 let token = HttpUtils.getUserToken() 74 let token = HttpUtils.getUserToken()
71 if (token == null || token == undefined || token.length <= 0) { 75 if (token == null || token == undefined || token.length <= 0) {
@@ -23,6 +23,7 @@ import { NewspaperWidgetCommon } from '../dailynewspaperwidget/common/NewspaperW @@ -23,6 +23,7 @@ import { NewspaperWidgetCommon } from '../dailynewspaperwidget/common/NewspaperW
23 import { LiveRoomManager } from 'wdDetailPlayLive/Index' 23 import { LiveRoomManager } from 'wdDetailPlayLive/Index'
24 import { initGlobalPlayerSettings } from 'wdPlayer/src/main/ets/utils/GlobalSetting' 24 import { initGlobalPlayerSettings } from 'wdPlayer/src/main/ets/utils/GlobalSetting'
25 import { BackgroundAudioController } from 'wdPlayer/Index' 25 import { BackgroundAudioController } from 'wdPlayer/Index'
  26 +import { SpConstants } from 'wdConstant'
26 27
27 const TAG = "[StartupManager]" 28 const TAG = "[StartupManager]"
28 29
@@ -158,9 +159,12 @@ export class StartupManager { @@ -158,9 +159,12 @@ export class StartupManager {
158 } 159 }
159 160
160 // mPaaS 初始化,检测升级用 161 // mPaaS 初始化,检测升级用
161 - private initMpaas() { 162 + private async initMpaas() {
162 Logger.debug(TAG, "App mPaaS初始化") 163 Logger.debug(TAG, "App mPaaS初始化")
163 MpaasUtils.initApp(this.context!) 164 MpaasUtils.initApp(this.context!)
  165 +
  166 + let utdid = await MpaasUtils.mpaasUtdid()
  167 + SPHelper.default.saveSync(SpConstants.USER_MPAASUTDID, utdid)
164 } 168 }
165 169
166 private initTingyun() { 170 private initTingyun() {