Showing
24 changed files
with
181 additions
and
376 deletions
| 1 | import data_preferences from '@ohos.data.preferences'; | 1 | import data_preferences from '@ohos.data.preferences'; |
| 2 | 2 | ||
| 3 | -/* | 3 | +/** |
| 4 | + * sp存储 | ||
| 5 | + * | ||
| 6 | + * 单例模式 | ||
| 7 | + * TODO 新增内存存储,避免频繁sp获取 | ||
| 8 | + */ | ||
| 4 | // SPHelper.default.get("key1", "defValue1").then((value1) => { | 9 | // SPHelper.default.get("key1", "defValue1").then((value1) => { |
| 5 | // this.message = value1.toString(); | 10 | // this.message = value1.toString(); |
| 6 | // }) | 11 | // }) |
| 7 | 12 | ||
| 8 | // let value2: string = await SPHelper.default.get("key2", "defValue2"); | 13 | // let value2: string = await SPHelper.default.get("key2", "defValue2"); |
| 9 | // this.message = result; | 14 | // this.message = result; |
| 10 | -* | ||
| 11 | -* 单例模式 | ||
| 12 | - */ | ||
| 13 | export class SPHelper { | 15 | export class SPHelper { |
| 14 | private static context: Context; | 16 | private static context: Context; |
| 15 | private static spFilename: string = '__SPHelper'; | 17 | private static spFilename: string = '__SPHelper'; |
| @@ -21,7 +23,7 @@ export class SPHelper { | @@ -21,7 +23,7 @@ export class SPHelper { | ||
| 21 | static setSpFilename(spFilename: string) { | 23 | static setSpFilename(spFilename: string) { |
| 22 | SPHelper.spFilename = spFilename; | 24 | SPHelper.spFilename = spFilename; |
| 23 | } | 25 | } |
| 24 | - | 26 | + |
| 25 | // 静态属性 | 27 | // 静态属性 |
| 26 | static default: SPHelper = new SPHelper(); | 28 | static default: SPHelper = new SPHelper(); |
| 27 | 29 | ||
| @@ -102,8 +104,8 @@ export class SPHelper { | @@ -102,8 +104,8 @@ export class SPHelper { | ||
| 102 | // preferences.flush() | 104 | // preferences.flush() |
| 103 | // } | 105 | // } |
| 104 | 106 | ||
| 105 | - public getPreferences(){ | ||
| 106 | - let preferences = data_preferences.getPreferences(SPHelper.context, SPHelper.spFilename); | 107 | + public getPreferences() { |
| 108 | + let preferences = data_preferences.getPreferences(SPHelper.context, SPHelper.spFilename); | ||
| 107 | return preferences; | 109 | return preferences; |
| 108 | } | 110 | } |
| 109 | } | 111 | } |
| @@ -8,5 +8,7 @@ export { HttpUrlUtils } from "./src/main/ets/http/HttpUrlUtils" | @@ -8,5 +8,7 @@ export { HttpUrlUtils } from "./src/main/ets/http/HttpUrlUtils" | ||
| 8 | 8 | ||
| 9 | export { HttpBizUtil } from "./src/main/ets/http/HttpBizUtil" | 9 | export { HttpBizUtil } from "./src/main/ets/http/HttpBizUtil" |
| 10 | 10 | ||
| 11 | +export { HttpUtils } from "./src/main/ets/utils/HttpUtils" | ||
| 12 | + | ||
| 11 | export { HostEnum, HostManager } from "./src/main/ets/http/HttpHostManager" | 13 | export { HostEnum, HostManager } from "./src/main/ets/http/HttpHostManager" |
| 12 | 14 |
| @@ -5,6 +5,7 @@ import { ResponseDTO } from '../bean/ResponseDTO'; | @@ -5,6 +5,7 @@ import { ResponseDTO } from '../bean/ResponseDTO'; | ||
| 5 | import { HttpUrlUtils, WDHttp } from '../../../../Index'; | 5 | import { HttpUrlUtils, WDHttp } from '../../../../Index'; |
| 6 | import { RefreshTokenRes } from '../bean/RefreshTokenRes'; | 6 | import { RefreshTokenRes } from '../bean/RefreshTokenRes'; |
| 7 | import { ResposeError } from '../bean/ResposeError'; | 7 | import { ResposeError } from '../bean/ResposeError'; |
| 8 | +import { HttpUtils } from '../utils/HttpUtils'; | ||
| 8 | 9 | ||
| 9 | const TAG: string = 'HttpBizUtil' | 10 | const TAG: string = 'HttpBizUtil' |
| 10 | 11 | ||
| @@ -93,8 +94,8 @@ export class HttpBizUtil { | @@ -93,8 +94,8 @@ export class HttpBizUtil { | ||
| 93 | static refreshToken(): Promise<string> { | 94 | static refreshToken(): Promise<string> { |
| 94 | let url = HttpUrlUtils.getRefreshTokenUrl(); | 95 | let url = HttpUrlUtils.getRefreshTokenUrl(); |
| 95 | let params: HashMap<string, string> = new HashMap<string, string>() | 96 | let params: HashMap<string, string> = new HashMap<string, string>() |
| 96 | - params.set('refreshToken', HttpUrlUtils.getRefreshToken()) | ||
| 97 | - params.set('deviceId', HttpUrlUtils.getDeviceId()) | 97 | + params.set('refreshToken', HttpUtils.getRefreshToken()) |
| 98 | + params.set('deviceId', HttpUtils.getDeviceId()) | ||
| 98 | // Logger.debug(TAG, 'refreshToken getRefreshToken: ' + HttpUrlUtils.getRefreshToken()) | 99 | // Logger.debug(TAG, 'refreshToken getRefreshToken: ' + HttpUrlUtils.getRefreshToken()) |
| 99 | // 请求刷新token接口 | 100 | // 请求刷新token接口 |
| 100 | return new Promise<string>((success, error) => { | 101 | return new Promise<string>((success, error) => { |
| 1 | import { SpConstants } from 'wdConstant'; | 1 | import { SpConstants } from 'wdConstant'; |
| 2 | import { DateTimeUtils, DeviceUtil, SPHelper, StringUtils } from 'wdKit'; | 2 | import { DateTimeUtils, DeviceUtil, SPHelper, StringUtils } from 'wdKit'; |
| 3 | +import { HttpUtils } from '../utils/HttpUtils'; | ||
| 3 | import { HostEnum, HostManager } from './HttpHostManager'; | 4 | import { HostEnum, HostManager } from './HttpHostManager'; |
| 4 | 5 | ||
| 5 | /** | 6 | /** |
| 6 | - * 网络请求参数工具类 | 7 | + * 网络请求参数工具类,TODO 不对外暴露,收缩权限 |
| 7 | */ | 8 | */ |
| 8 | export class HttpParams { | 9 | export class HttpParams { |
| 9 | - private static userId = '' | ||
| 10 | - private static userType = '' | ||
| 11 | - private static token = '' | ||
| 12 | - | ||
| 13 | static buildHeaders(): Record<string, string> { | 10 | static buildHeaders(): Record<string, string> { |
| 14 | let headers: Record<string, string> = {}; | 11 | let headers: Record<string, string> = {}; |
| 15 | // 通用请求头 | 12 | // 通用请求头 |
| @@ -19,7 +16,7 @@ export class HttpParams { | @@ -19,7 +16,7 @@ export class HttpParams { | ||
| 19 | headers['Content-Type'] = 'application/json; charset=utf-8' | 16 | headers['Content-Type'] = 'application/json; charset=utf-8' |
| 20 | headers['device_id'] = DeviceUtil.clientId() | 17 | headers['device_id'] = DeviceUtil.clientId() |
| 21 | headers['build_version'] = HttpParams.getVersion() | 18 | headers['build_version'] = HttpParams.getVersion() |
| 22 | - headers['adcode'] = HttpParams.getAdCode() | 19 | + headers['adcode'] = HttpUtils.getProvinceCode() |
| 23 | headers['os_version'] = DeviceUtil.getOsVersion() | 20 | headers['os_version'] = DeviceUtil.getOsVersion() |
| 24 | headers['system'] = 'Android' // TODO 后续是否新增鸿蒙标识 | 21 | headers['system'] = 'Android' // TODO 后续是否新增鸿蒙标识 |
| 25 | headers['versionCode'] = HttpParams.getVersionCode() | 22 | headers['versionCode'] = HttpParams.getVersionCode() |
| @@ -30,12 +27,12 @@ export class HttpParams { | @@ -30,12 +27,12 @@ export class HttpParams { | ||
| 30 | headers['timestamp'] = DateTimeUtils.getTimeStamp() + '' | 27 | headers['timestamp'] = DateTimeUtils.getTimeStamp() + '' |
| 31 | HttpParams.setLocationHeader(headers) | 28 | HttpParams.setLocationHeader(headers) |
| 32 | // // TODO 判断是否登录 | 29 | // // TODO 判断是否登录 |
| 33 | - headers['RMRB-X-TOKEN'] = HttpParams.getXToken() | ||
| 34 | - if (HttpParams.getXToken() != '') { | ||
| 35 | - headers['cookie'] = 'RMRB-X-TOKEN=' + HttpParams.getXToken() | 30 | + headers['RMRB-X-TOKEN'] = HttpUtils.getXToken() |
| 31 | + if (HttpUtils.getXToken() != '') { | ||
| 32 | + headers['cookie'] = 'RMRB-X-TOKEN=' + HttpUtils.getXToken() | ||
| 36 | } | 33 | } |
| 37 | - headers['userId'] = HttpParams.getUserId() | ||
| 38 | - headers['userType'] = HttpParams.getUserType() | 34 | + headers['userId'] = HttpUtils.getUserId() |
| 35 | + headers['userType'] = HttpUtils.getUserType() | ||
| 39 | headers['mpassid'] = 'ZbHTMeTsfaYDAHqt8ZHIzcPs' | 36 | headers['mpassid'] = 'ZbHTMeTsfaYDAHqt8ZHIzcPs' |
| 40 | HttpParams.addSpecialHeaders(headers); | 37 | HttpParams.addSpecialHeaders(headers); |
| 41 | return headers; | 38 | return headers; |
| @@ -68,6 +65,11 @@ export class HttpParams { | @@ -68,6 +65,11 @@ export class HttpParams { | ||
| 68 | } | 65 | } |
| 69 | } | 66 | } |
| 70 | 67 | ||
| 68 | + /** | ||
| 69 | + * 设置定位信息header | ||
| 70 | + * | ||
| 71 | + * @param headers | ||
| 72 | + */ | ||
| 71 | static setLocationHeader(headers: Record<string, string>) { | 73 | static setLocationHeader(headers: Record<string, string>) { |
| 72 | let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string | 74 | let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string |
| 73 | if (StringUtils.isNotEmpty(cityName)) { | 75 | if (StringUtils.isNotEmpty(cityName)) { |
| @@ -79,26 +81,6 @@ export class HttpParams { | @@ -79,26 +81,6 @@ export class HttpParams { | ||
| 79 | } | 81 | } |
| 80 | } | 82 | } |
| 81 | 83 | ||
| 82 | - private static getXToken() { | ||
| 83 | - if (StringUtils.isNotEmpty(HttpParams.token)) { | ||
| 84 | - return HttpParams.token | ||
| 85 | - } | ||
| 86 | - HttpParams.token = SPHelper.default.getSync(SpConstants.USER_JWT_TOKEN, "") as string | ||
| 87 | - if (StringUtils.isNotEmpty(HttpParams.token)) { | ||
| 88 | - return HttpParams.token | ||
| 89 | - } | ||
| 90 | - // return 'eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcwMzY0OTYwNiwidXNlcklkIjo0NTk3NzYyOTc0NzQ5NDksInVzZXJWZXJzaW9uIjoiNDU5Nzc2Mjk3NDc0OTQ5XzIiLCJ1c2VyTmFtZSI6IkJ1bGlraWtpMTgxIiwidXNlclR5cGUiOjIsImNyZWF0b3JJZCI6NDI2NTM5MH0.jhQ9kylcm3FxWf0-lBMZuLkdtIQ6XpFnAi0AFZJNwfc'; | ||
| 91 | - return '' | ||
| 92 | - } | ||
| 93 | - | ||
| 94 | - static getRefreshToken(): string { | ||
| 95 | - let refreshToken = SPHelper.default.getSync(SpConstants.USER_REFRESH_TOKEN, "") | ||
| 96 | - if (StringUtils.isNotEmpty(refreshToken)) { | ||
| 97 | - return refreshToken as string; | ||
| 98 | - } | ||
| 99 | - return ''; | ||
| 100 | - } | ||
| 101 | - | ||
| 102 | private static getVersion() { | 84 | private static getVersion() { |
| 103 | // TODO | 85 | // TODO |
| 104 | return '202401242103'; | 86 | return '202401242103'; |
| @@ -110,60 +92,7 @@ export class HttpParams { | @@ -110,60 +92,7 @@ export class HttpParams { | ||
| 110 | } | 92 | } |
| 111 | 93 | ||
| 112 | private static getVersionName() { | 94 | private static getVersionName() { |
| 113 | - // TODO | 95 | + // TODO 读取配置 |
| 114 | return '1.0.0'; | 96 | return '1.0.0'; |
| 115 | } | 97 | } |
| 116 | - | ||
| 117 | - private static getAdCode() { | ||
| 118 | - // 省份编码 | ||
| 119 | - return '340000'; | ||
| 120 | - } | ||
| 121 | - | ||
| 122 | - public static getCityCode() { | ||
| 123 | - // TODO | ||
| 124 | - // 城市编码 | ||
| 125 | - return '340100'; | ||
| 126 | - } | ||
| 127 | - | ||
| 128 | - public static getProvinceCode() { | ||
| 129 | - // TODO | ||
| 130 | - return '340000'; | ||
| 131 | - } | ||
| 132 | - | ||
| 133 | - /** | ||
| 134 | - * 地区code | ||
| 135 | - */ | ||
| 136 | - public static getDistrictCode() { | ||
| 137 | - // TODO | ||
| 138 | - return '340103'; | ||
| 139 | - } | ||
| 140 | - | ||
| 141 | - public static getUserId(): string { | ||
| 142 | - // TODO 对接登录 | ||
| 143 | - if (StringUtils.isNotEmpty(HttpParams.userId)) { | ||
| 144 | - return HttpParams.userId | ||
| 145 | - } | ||
| 146 | - HttpParams.userId = SPHelper.default.getSync(SpConstants.USER_ID, "") as string | ||
| 147 | - return HttpParams.userId; | ||
| 148 | - } | ||
| 149 | - | ||
| 150 | - public static getUserType() { | ||
| 151 | - if (StringUtils.isNotEmpty(HttpParams.userType)) { | ||
| 152 | - return HttpParams.userType | ||
| 153 | - } | ||
| 154 | - HttpParams.userType = SPHelper.default.getSync(SpConstants.USER_Type, "") as string | ||
| 155 | - return HttpParams.userType; | ||
| 156 | - } | ||
| 157 | - | ||
| 158 | - public static setUserId(userId: string) { | ||
| 159 | - HttpParams.userId = userId; | ||
| 160 | - } | ||
| 161 | - | ||
| 162 | - public static setUserType(userType: string) { | ||
| 163 | - HttpParams.userType = userType; | ||
| 164 | - } | ||
| 165 | - | ||
| 166 | - public static setUserToken(token: string) { | ||
| 167 | - HttpParams.token = token; | ||
| 168 | - } | ||
| 169 | } | 98 | } |
| 1 | -import HashMap from '@ohos.util.HashMap'; | ||
| 2 | -import { SpConstants } from 'wdConstant'; | ||
| 3 | -import { SPHelper, StringUtils } from 'wdKit'; | ||
| 4 | -import { HostEnum, HostManager } from './HttpHostManager'; | 1 | +import { HostManager } from './HttpHostManager'; |
| 5 | 2 | ||
| 6 | /** | 3 | /** |
| 7 | - * 网络请求业务侧工具类 | 4 | + * 网络请求业务侧接口url工具类 |
| 8 | */ | 5 | */ |
| 9 | export class HttpUrlUtils { | 6 | export class HttpUrlUtils { |
| 10 | /** | 7 | /** |
| @@ -286,211 +283,11 @@ export class HttpUrlUtils { | @@ -286,211 +283,11 @@ export class HttpUrlUtils { | ||
| 286 | * 搜索推荐 | 283 | * 搜索推荐 |
| 287 | */ | 284 | */ |
| 288 | static readonly SEARCH_SUGGEST_DATA_PATH: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list"; | 285 | static readonly SEARCH_SUGGEST_DATA_PATH: string = "/api/rmrb-bff-display-zh/recommend/zh/c/list"; |
| 289 | - private static userId = '' | ||
| 290 | - private static userType = '' | ||
| 291 | - private static token = '' | ||
| 292 | - | ||
| 293 | - /** | ||
| 294 | - * @deprecated | ||
| 295 | - * @returns | ||
| 296 | - */ | ||
| 297 | - private static getCommonHeaders(): HashMap<string, string> { | ||
| 298 | - let headers: HashMap<string, string> = new HashMap<string, string>() | ||
| 299 | - headers.set('User-Agent', 'Dalvik/2.1.0 (Linux; U; Android 13; 22101317C Build/TKQ1.221013.002)') | ||
| 300 | - headers.set('channel', HttpUrlUtils.getChannel()) | ||
| 301 | - //headers.set('appCode', ConfigConstants.appCode) | ||
| 302 | - headers.set('plat', HttpUrlUtils.getPlat()) | ||
| 303 | - //headers.set('Authorization', 'APPCODE 83092caa603a421aa0222308b3f6b27a') | ||
| 304 | - headers.set('Content-Type', 'application/json; charset=utf-8') | ||
| 305 | - headers.set('timestamp', HttpUrlUtils.getTimestamp()) | ||
| 306 | - headers.set('RMRB-X-TOKEN', HttpUrlUtils.getXToken()) | ||
| 307 | - headers.set('device_id', HttpUrlUtils.getDeviceId()) | ||
| 308 | - if (HttpUrlUtils.getXToken() != '') { | ||
| 309 | - headers.set('cookie', 'RMRB-X-TOKEN=' + HttpUrlUtils.getXToken()) | ||
| 310 | - } | ||
| 311 | - headers.set('build_version', HttpUrlUtils.getVersion()) | ||
| 312 | - headers.set('adcode', HttpUrlUtils.getAdCode()) | ||
| 313 | - headers.set('os_version', HttpUrlUtils.getOsVersion()) | ||
| 314 | - //headers.set('X-Ca-Stage', 'PRE') | ||
| 315 | - headers.set('versionCode', HttpUrlUtils.getVersionCode()) | ||
| 316 | - headers.set('system', HttpUrlUtils.getTerminalId()) | ||
| 317 | - headers.set('version_name', HttpUrlUtils.getVersionName()) | ||
| 318 | - headers.set('EagleEye-TraceID', 'D539562E48554A60977AF4BECB6D6C7A') | ||
| 319 | - headers.set('imei', HttpUrlUtils.getImei()) | ||
| 320 | - headers.set('Accept-Language', 'zh') | ||
| 321 | - // headers.set('city', HttpUrlUtils.getCity()) | ||
| 322 | - // headers.set('city_dode', HttpUrlUtils.getCityCode()) | ||
| 323 | - HttpUrlUtils.setLocationHeader(headers) | ||
| 324 | - // TODO 判断是否登录 | ||
| 325 | - headers.set('userId', HttpUrlUtils.getUserId()) | ||
| 326 | - headers.set('userType', HttpUrlUtils.getUserType()) | ||
| 327 | - | ||
| 328 | - headers.set('mpassid', 'ZbHTMeTsfaYDAHqt8ZHIzcPs') | ||
| 329 | - HttpUrlUtils.addSpecialHeaders(headers); | ||
| 330 | - // Logger.debug("TAG", '******************* commonHeaders headers start ******************************** '); | ||
| 331 | - // headers.forEach((v,k)=>{ | ||
| 332 | - // Logger.debug("TAG", 'getCommonHeaders header: ' + k + ': ' + v); | ||
| 333 | - // }) | ||
| 334 | - // Logger.debug("TAG", '******************* commonHeaders headers end ******************************** '); | ||
| 335 | - return headers; | ||
| 336 | - } | ||
| 337 | - | ||
| 338 | - private static addSpecialHeaders(headers: HashMap<string, string>) { | ||
| 339 | - switch (HostManager.getHost()) { | ||
| 340 | - case HostEnum.HOST_UAT: | ||
| 341 | - // TODO 待优化到常量类里 | ||
| 342 | - headers.set('X-Ca-Stage', 'PRE'); | ||
| 343 | - headers.set('Authorization', 'APPCODE 83092caa603a421aa0222308b3f6b27a'); | ||
| 344 | - headers.set('appCode', '83092caa603a421aa0222308b3f6b27a'); | ||
| 345 | - break | ||
| 346 | - case HostEnum.HOST_SIT: | ||
| 347 | - headers.set('X-Ca-Stage', 'TEST'); | ||
| 348 | - headers.set('Authorization', 'APPCODE 0af1f9085e484c97b2a44704bae72c07'); | ||
| 349 | - headers.set('appCode', '0af1f9085e484c97b2a44704bae72c07'); | ||
| 350 | - break | ||
| 351 | - case HostEnum.HOST_PRODUCT: | ||
| 352 | - headers.set('X-Ca-Stage', 'RELEASE'); | ||
| 353 | - headers.set('Authorization', 'APPCODE 3d4181bceeb94d9780e10dbb6c67bbf6'); | ||
| 354 | - headers.set('appCode', '3d4181bceeb94d9780e10dbb6c67bbf6'); | ||
| 355 | - break | ||
| 356 | - case HostEnum.HOST_DEV: | ||
| 357 | - headers.set('X-Ca-Stage', 'TEST'); | ||
| 358 | - headers.set('Authorization', 'APPCODE ff33172859e14f9a8299e3bd769e79f9'); | ||
| 359 | - headers.set('appCode', 'ff33172859e14f9a8299e3bd769e79f9'); | ||
| 360 | - break | ||
| 361 | - default: | ||
| 362 | - break | ||
| 363 | - } | ||
| 364 | - } | ||
| 365 | - | ||
| 366 | - private static setLocationHeader(headers: HashMap<string, string>) { | ||
| 367 | - let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string | ||
| 368 | - if (StringUtils.isNotEmpty(cityName)) { | ||
| 369 | - headers.set('city', encodeURI(cityName)) | ||
| 370 | - } | ||
| 371 | - let cityCode = SPHelper.default.getSync(SpConstants.LOCATION_CITY_CODE, '') as string | ||
| 372 | - if (StringUtils.isNotEmpty(cityCode)) { | ||
| 373 | - headers.set('city_dode', encodeURI(cityCode)) | ||
| 374 | - } | ||
| 375 | - } | ||
| 376 | 286 | ||
| 377 | static getHost(): string { | 287 | static getHost(): string { |
| 378 | return HostManager.getHost(); | 288 | return HostManager.getHost(); |
| 379 | } | 289 | } |
| 380 | 290 | ||
| 381 | - private static getCity() { | ||
| 382 | - // TODO 对接定位 | ||
| 383 | - return '%E5%90%88%E8%82%A5%E5%B8%82'; | ||
| 384 | - } | ||
| 385 | - | ||
| 386 | - private static getChannel() { | ||
| 387 | - // TODO 对接配置 | ||
| 388 | - return 'rmrb_china_0000'; | ||
| 389 | - } | ||
| 390 | - | ||
| 391 | - private static getPlat() { | ||
| 392 | - return 'Phone'; | ||
| 393 | - } | ||
| 394 | - | ||
| 395 | - private static getTimestamp() { | ||
| 396 | - // return DateTimeUtils.getCurrentTime() + ''; | ||
| 397 | - // TODO 暂时写死,有些page 真实时间戳 返回数据为空 | ||
| 398 | - return '155203523'; | ||
| 399 | - } | ||
| 400 | - | ||
| 401 | - private static getXToken() { | ||
| 402 | - if (StringUtils.isNotEmpty(HttpUrlUtils.token)) { | ||
| 403 | - return HttpUrlUtils.token | ||
| 404 | - } | ||
| 405 | - HttpUrlUtils.token = SPHelper.default.getSync(SpConstants.USER_JWT_TOKEN, "") as string | ||
| 406 | - if (StringUtils.isNotEmpty(HttpUrlUtils.token)) { | ||
| 407 | - return HttpUrlUtils.token | ||
| 408 | - } | ||
| 409 | - // return 'eyJhbGciOiJIUzI1NiIsImtpZCI6ImQ4WkI2QkhxSEZrdjJ2U25BNlRwZEdKRjBHcjItVzBvS2FaYzdLOUUycmcifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcwMzY0OTYwNiwidXNlcklkIjo0NTk3NzYyOTc0NzQ5NDksInVzZXJWZXJzaW9uIjoiNDU5Nzc2Mjk3NDc0OTQ5XzIiLCJ1c2VyTmFtZSI6IkJ1bGlraWtpMTgxIiwidXNlclR5cGUiOjIsImNyZWF0b3JJZCI6NDI2NTM5MH0.jhQ9kylcm3FxWf0-lBMZuLkdtIQ6XpFnAi0AFZJNwfc'; | ||
| 410 | - return '' | ||
| 411 | - } | ||
| 412 | - | ||
| 413 | - static getRefreshToken() { | ||
| 414 | - let refreshToken = SPHelper.default.getSync(SpConstants.USER_REFRESH_TOKEN, "") | ||
| 415 | - if (StringUtils.isNotEmpty(refreshToken)) { | ||
| 416 | - return refreshToken as string; | ||
| 417 | - } | ||
| 418 | - return ''; | ||
| 419 | - } | ||
| 420 | - | ||
| 421 | - public static getDeviceId() { | ||
| 422 | - // TODO | ||
| 423 | - return '8a81226a-cabd-3e1b-b630-b51db4a720ed'; | ||
| 424 | - } | ||
| 425 | - | ||
| 426 | - private static getVersion() { | ||
| 427 | - // TODO | ||
| 428 | - return '202401242103'; | ||
| 429 | - } | ||
| 430 | - | ||
| 431 | - private static getVersionCode() { | ||
| 432 | - // TODO | ||
| 433 | - return '7301'; | ||
| 434 | - } | ||
| 435 | - | ||
| 436 | - private static getVersionName() { | ||
| 437 | - // TODO | ||
| 438 | - return '7.3.0.1'; | ||
| 439 | - } | ||
| 440 | - | ||
| 441 | - private static getAdCode() { | ||
| 442 | - return '340000'; | ||
| 443 | - } | ||
| 444 | - | ||
| 445 | - private static getOsVersion() { | ||
| 446 | - // TODO | ||
| 447 | - return '12'; | ||
| 448 | - } | ||
| 449 | - | ||
| 450 | - public static getCityCode() { | ||
| 451 | - // TODO | ||
| 452 | - return '340100'; | ||
| 453 | - } | ||
| 454 | - | ||
| 455 | - public static getProvinceCode() { | ||
| 456 | - // TODO | ||
| 457 | - return '340000'; | ||
| 458 | - } | ||
| 459 | - | ||
| 460 | - /** | ||
| 461 | - * 地区code | ||
| 462 | - */ | ||
| 463 | - public static getDistrictCode() { | ||
| 464 | - // TODO | ||
| 465 | - return '340103'; | ||
| 466 | - } | ||
| 467 | - | ||
| 468 | - private static getTerminalId() { | ||
| 469 | - return 'Android'; | ||
| 470 | - } | ||
| 471 | - | ||
| 472 | - public static getImei() { | ||
| 473 | - // TODO | ||
| 474 | - return '8a81226a-cabd-3e1b-b630-b51db4a720ed'; | ||
| 475 | - } | ||
| 476 | - | ||
| 477 | - public static getUserId() { | ||
| 478 | - // TODO 对接登录 | ||
| 479 | - if (StringUtils.isNotEmpty(HttpUrlUtils.userId)) { | ||
| 480 | - return HttpUrlUtils.userId | ||
| 481 | - } | ||
| 482 | - HttpUrlUtils.userId = SPHelper.default.getSync(SpConstants.USER_ID, "") as string | ||
| 483 | - return HttpUrlUtils.userId; | ||
| 484 | - } | ||
| 485 | - | ||
| 486 | - public static getUserType() { | ||
| 487 | - if (StringUtils.isNotEmpty(HttpUrlUtils.userType)) { | ||
| 488 | - return HttpUrlUtils.userType | ||
| 489 | - } | ||
| 490 | - HttpUrlUtils.userType = SPHelper.default.getSync(SpConstants.USER_Type, "") as string | ||
| 491 | - return HttpUrlUtils.userType; | ||
| 492 | - } | ||
| 493 | - | ||
| 494 | static getVerifyCodeUrl() { | 291 | static getVerifyCodeUrl() { |
| 495 | let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/auth/zh/c/sendVerifyCode"; | 292 | let url = HttpUrlUtils.getHost() + "/api/rmrb-user-center/auth/zh/c/sendVerifyCode"; |
| 496 | return url; | 293 | return url; |
| @@ -842,7 +639,6 @@ export class HttpUrlUtils { | @@ -842,7 +639,6 @@ export class HttpUrlUtils { | ||
| 842 | return url; | 639 | return url; |
| 843 | } | 640 | } |
| 844 | 641 | ||
| 845 | - | ||
| 846 | //搜索推荐 | 642 | //搜索推荐 |
| 847 | static getSearchSuggestDataUrl() { | 643 | static getSearchSuggestDataUrl() { |
| 848 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.SEARCH_SUGGEST_DATA_PATH | 644 | let url = HttpUrlUtils.getHost() + HttpUrlUtils.SEARCH_SUGGEST_DATA_PATH |
| @@ -854,16 +650,4 @@ export class HttpUrlUtils { | @@ -854,16 +650,4 @@ export class HttpUrlUtils { | ||
| 854 | let url = HttpUrlUtils.getHost() + "/api/rmrb-bff-display-zh/display/zh/c/themeList"; | 650 | let url = HttpUrlUtils.getHost() + "/api/rmrb-bff-display-zh/display/zh/c/themeList"; |
| 855 | return url; | 651 | return url; |
| 856 | } | 652 | } |
| 857 | - | ||
| 858 | - public static setUserId(userId: string) { | ||
| 859 | - HttpUrlUtils.userId = userId; | ||
| 860 | - } | ||
| 861 | - | ||
| 862 | - public static setUserType(userType: string) { | ||
| 863 | - HttpUrlUtils.userType = userType; | ||
| 864 | - } | ||
| 865 | - | ||
| 866 | - public static setUserToken(token: string) { | ||
| 867 | - HttpUrlUtils.token = token; | ||
| 868 | - } | ||
| 869 | } | 653 | } |
| 1 | +import { SpConstants } from 'wdConstant/Index'; | ||
| 2 | +import { DeviceUtil, SPHelper, StringUtils } from 'wdKit/Index'; | ||
| 3 | +import { HttpParams } from '../http/HttpCommonParams'; | ||
| 1 | import { HttpRequest } from '../http/HttpRequest'; | 4 | import { HttpRequest } from '../http/HttpRequest'; |
| 2 | 5 | ||
| 3 | const TAG: string = '[HttpUtils]' | 6 | const TAG: string = '[HttpUtils]' |
| 4 | 7 | ||
| 8 | +/** | ||
| 9 | + * http相关工具类,对外暴露 | ||
| 10 | + */ | ||
| 5 | export class HttpUtils { | 11 | export class HttpUtils { |
| 12 | + private static userId = '' | ||
| 13 | + private static userType = '' | ||
| 14 | + private static token = '' | ||
| 15 | + | ||
| 6 | /** | 16 | /** |
| 7 | * 添加公共参数,如登录后,添加登录信息 | 17 | * 添加公共参数,如登录后,添加登录信息 |
| 8 | */ | 18 | */ |
| @@ -19,4 +29,89 @@ export class HttpUtils { | @@ -19,4 +29,89 @@ export class HttpUtils { | ||
| 19 | static removeCommonHeader() { | 29 | static removeCommonHeader() { |
| 20 | 30 | ||
| 21 | } | 31 | } |
| 32 | + | ||
| 33 | + static getRefreshToken() { | ||
| 34 | + let refreshToken = SPHelper.default.getSync(SpConstants.USER_REFRESH_TOKEN, "") | ||
| 35 | + if (StringUtils.isNotEmpty(refreshToken)) { | ||
| 36 | + return refreshToken as string; | ||
| 37 | + } | ||
| 38 | + return ''; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + /** | ||
| 42 | + * 设备id,uuid | ||
| 43 | + */ | ||
| 44 | + public static getDeviceId(): string { | ||
| 45 | + return DeviceUtil.clientId(); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + /** | ||
| 49 | + * 定位,城市code | ||
| 50 | + */ | ||
| 51 | + public static getCityCode(): string { | ||
| 52 | + // TODO | ||
| 53 | + // 城市编码 | ||
| 54 | + return '340100'; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * 定位,省份code | ||
| 59 | + */ | ||
| 60 | + public static getProvinceCode(): string { | ||
| 61 | + // TODO | ||
| 62 | + return '340000'; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + /** | ||
| 66 | + * 定位,地区code | ||
| 67 | + */ | ||
| 68 | + public static getDistrictCode(): string { | ||
| 69 | + // TODO | ||
| 70 | + return '340103'; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + public static getImei(): string { | ||
| 74 | + return DeviceUtil.clientId(); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + public static getUserId(): string { | ||
| 78 | + // TODO 对接登录 | ||
| 79 | + if (StringUtils.isNotEmpty(HttpUtils.userId)) { | ||
| 80 | + return HttpUtils.userId | ||
| 81 | + } | ||
| 82 | + HttpUtils.userId = SPHelper.default.getSync(SpConstants.USER_ID, "") as string | ||
| 83 | + return HttpUtils.userId; | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + public static getUserType(): string { | ||
| 87 | + if (StringUtils.isNotEmpty(HttpUtils.userType)) { | ||
| 88 | + return HttpUtils.userType | ||
| 89 | + } | ||
| 90 | + HttpUtils.userType = SPHelper.default.getSync(SpConstants.USER_Type, "") as string | ||
| 91 | + return HttpUtils.userType; | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + static getXToken(): string { | ||
| 95 | + if (StringUtils.isNotEmpty(HttpUtils.token)) { | ||
| 96 | + return HttpUtils.token | ||
| 97 | + } | ||
| 98 | + HttpUtils.token = SPHelper.default.getSync(SpConstants.USER_JWT_TOKEN, "") as string | ||
| 99 | + if (StringUtils.isNotEmpty(HttpUtils.token)) { | ||
| 100 | + return HttpUtils.token | ||
| 101 | + } | ||
| 102 | + return '' | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + public static setUserId(userId: string) { | ||
| 106 | + // TODO 优化赋值 | ||
| 107 | + HttpUtils.userId = userId; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + public static setUserType(userType: string) { | ||
| 111 | + HttpUtils.userType = userType; | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | + public static setUserToken(token: string) { | ||
| 115 | + HttpUtils.token = token; | ||
| 116 | + } | ||
| 22 | } | 117 | } |
| @@ -15,7 +15,6 @@ import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; | @@ -15,7 +15,6 @@ import { ImageAndTextWebComponent } from './ImageAndTextWebComponent'; | ||
| 15 | import { OperRowListView } from './view/OperRowListView'; | 15 | import { OperRowListView } from './view/OperRowListView'; |
| 16 | import { RecommendList } from '../components/view/RecommendList' | 16 | import { RecommendList } from '../components/view/RecommendList' |
| 17 | import { CommonConstants } from 'wdConstant'; | 17 | import { CommonConstants } from 'wdConstant'; |
| 18 | -import { HttpUrlUtils } from 'wdNetwork/Index'; | ||
| 19 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 18 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 20 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; | 19 | import { MultiPictureDetailViewModel } from '../viewmodel/MultiPictureDetailViewModel'; |
| 21 | import { PageRepository } from '../repository/PageRepository'; | 20 | import { PageRepository } from '../repository/PageRepository'; |
| @@ -23,6 +22,7 @@ import { detailedSkeleton } from './skeleton/detailSkeleton'; | @@ -23,6 +22,7 @@ import { detailedSkeleton } from './skeleton/detailSkeleton'; | ||
| 23 | import { publishCommentModel } from '../components/comment/model/PublishCommentModel'; | 22 | import { publishCommentModel } from '../components/comment/model/PublishCommentModel'; |
| 24 | 23 | ||
| 25 | import { CommentComponent } from '../components/comment/view/CommentComponent' | 24 | import { CommentComponent } from '../components/comment/view/CommentComponent' |
| 25 | +import { HttpUtils } from 'wdNetwork/Index'; | ||
| 26 | 26 | ||
| 27 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; | 27 | const PATTERN_DATE_CN_RN: string = 'yyyy年MM月dd日 HH:mm'; |
| 28 | 28 | ||
| @@ -197,8 +197,9 @@ export struct ImageAndTextPageComponent { | @@ -197,8 +197,9 @@ export struct ImageAndTextPageComponent { | ||
| 197 | 197 | ||
| 198 | private async getRecommend() { | 198 | private async getRecommend() { |
| 199 | let params: postRecommendListParams = { | 199 | let params: postRecommendListParams = { |
| 200 | + // TODO ? imei: HttpUtils.getImei() | ||
| 200 | imei: "8272c108-4fa2-34ce-80b9-bc425a7c2a7e", | 201 | imei: "8272c108-4fa2-34ce-80b9-bc425a7c2a7e", |
| 201 | - userId: HttpUrlUtils.getUserId(), | 202 | + userId: HttpUtils.getUserId(), |
| 202 | contentId: String(this.contentDetailData[0]?.newsId), | 203 | contentId: String(this.contentDetailData[0]?.newsId), |
| 203 | recType: 1, | 204 | recType: 1, |
| 204 | contentType: this.contentDetailData[0]?.newsType, | 205 | contentType: this.contentDetailData[0]?.newsType, |
| @@ -235,7 +236,7 @@ export struct ImageAndTextPageComponent { | @@ -235,7 +236,7 @@ export struct ImageAndTextPageComponent { | ||
| 235 | */ | 236 | */ |
| 236 | toggleLikeStatus() { | 237 | toggleLikeStatus() { |
| 237 | // 未登录,跳转登录 | 238 | // 未登录,跳转登录 |
| 238 | - if (!HttpUrlUtils.getUserId()) { | 239 | + if (!HttpUtils.getUserId()) { |
| 239 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 240 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 240 | return | 241 | return |
| 241 | } | 242 | } |
| 1 | import { DateTimeUtils, Logger, ToastUtils, UserDataLocal } from 'wdKit/Index'; | 1 | import { DateTimeUtils, Logger, ToastUtils, UserDataLocal } from 'wdKit/Index'; |
| 2 | -import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index'; | 2 | +import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork/Index'; |
| 3 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; | 3 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; |
| 4 | import { | 4 | import { |
| 5 | commentItemModel, | 5 | commentItemModel, |
| @@ -29,7 +29,7 @@ class CommentViewModel { | @@ -29,7 +29,7 @@ class CommentViewModel { | ||
| 29 | /*获取所有评论*/ | 29 | /*获取所有评论*/ |
| 30 | fetchContentCommentList(pageNum: string, contentId: string, contentType: string): Promise<commentListModel> { | 30 | fetchContentCommentList(pageNum: string, contentId: string, contentType: string): Promise<commentListModel> { |
| 31 | 31 | ||
| 32 | - let url = HttpUrlUtils.getContentCommentListDataUrl() + `?&pageSize=${10}&pageNum=${pageNum}&contentId=${contentId}&contentType=${contentType}&deviceId=${HttpUrlUtils.getDeviceId()}&userId=${HttpUrlUtils.getUserId()}&userType=${HttpUrlUtils.getUserType()}&time=${DateTimeUtils.getCurTime(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)}` | 32 | + let url = HttpUrlUtils.getContentCommentListDataUrl() + `?&pageSize=${10}&pageNum=${pageNum}&contentId=${contentId}&contentType=${contentType}&deviceId=${HttpUtils.getDeviceId()}&userId=${HttpUtils.getUserId()}&userType=${HttpUtils.getUserType()}&time=${DateTimeUtils.getCurTime(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)}` |
| 33 | url = url.replace(' ', '%20') | 33 | url = url.replace(' ', '%20') |
| 34 | 34 | ||
| 35 | return new Promise<commentListModel>((success, fail) => { | 35 | return new Promise<commentListModel>((success, fail) => { |
| @@ -59,7 +59,7 @@ class CommentViewModel { | @@ -59,7 +59,7 @@ class CommentViewModel { | ||
| 59 | 59 | ||
| 60 | fetchChildContentCommentList(pageNum: string, contentId: string, contentType: string, commentId: String): Promise<commentListModel> { | 60 | fetchChildContentCommentList(pageNum: string, contentId: string, contentType: string, commentId: String): Promise<commentListModel> { |
| 61 | // https://pd-apis-uat.pdnews.cn/api/rmrb-comment/comment/zh/c/childCommentList?commentId=44846810&contentId=30004266013&contentType=8&deviceId=35C78D13-A84A-47CE-A5D0-E114E4E49939&pageNum=1&pageSize=10&time=2024-04-23%2014%3A44%3A57&userId=&userType=0 | 61 | // https://pd-apis-uat.pdnews.cn/api/rmrb-comment/comment/zh/c/childCommentList?commentId=44846810&contentId=30004266013&contentType=8&deviceId=35C78D13-A84A-47CE-A5D0-E114E4E49939&pageNum=1&pageSize=10&time=2024-04-23%2014%3A44%3A57&userId=&userType=0 |
| 62 | - let url = HttpUrlUtils.getChildContentCommentListDataUrl() + `?&pageSize=${10}&pageNum=${pageNum}&commentId=${commentId}&contentId=${contentId}&contentType=${contentType}&deviceId=${HttpUrlUtils.getDeviceId()}&userId=${HttpUrlUtils.getUserId()}&userType=${HttpUrlUtils.getUserType()}&time=${DateTimeUtils.getCurTime(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)}` | 62 | + let url = HttpUrlUtils.getChildContentCommentListDataUrl() + `?&pageSize=${10}&pageNum=${pageNum}&commentId=${commentId}&contentId=${contentId}&contentType=${contentType}&deviceId=${HttpUtils.getDeviceId()}&userId=${HttpUtils.getUserId()}&userType=${HttpUtils.getUserType()}&time=${DateTimeUtils.getCurTime(DateTimeUtils.PATTERN_DATE_TIME_HYPHEN)}` |
| 63 | url = url.replace(' ', '%20') | 63 | url = url.replace(' ', '%20') |
| 64 | 64 | ||
| 65 | return new Promise<commentListModel>((success, fail) => { | 65 | return new Promise<commentListModel>((success, fail) => { |
| @@ -234,7 +234,7 @@ class CommentViewModel { | @@ -234,7 +234,7 @@ class CommentViewModel { | ||
| 234 | let promiseArray: Promise<commentStatusListModel | void>[] = []; | 234 | let promiseArray: Promise<commentStatusListModel | void>[] = []; |
| 235 | 235 | ||
| 236 | //未登录不用批查 | 236 | //未登录不用批查 |
| 237 | - if (HttpUrlUtils.getUserId()) { | 237 | + if (HttpUtils.getUserId()) { |
| 238 | if (commentIDs.length > 0) { | 238 | if (commentIDs.length > 0) { |
| 239 | let promise1 = new Promise<void>((success) => { | 239 | let promise1 = new Promise<void>((success) => { |
| 240 | // HttpRequest HttpBizUtil | 240 | // HttpRequest HttpBizUtil |
| 1 | import { CompDTO, ContentDTO, Params } from 'wdBean'; | 1 | import { CompDTO, ContentDTO, Params } from 'wdBean'; |
| 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 3 | -import { HttpUrlUtils } from 'wdNetwork/Index'; | ||
| 4 | import { postInteractAccentionOperateParams } from 'wdBean'; | 3 | import { postInteractAccentionOperateParams } from 'wdBean'; |
| 5 | import { PageRepository } from '../../repository/PageRepository'; | 4 | import { PageRepository } from '../../repository/PageRepository'; |
| 6 | import { CommonConstants } from 'wdConstant/Index'; | 5 | import { CommonConstants } from 'wdConstant/Index'; |
| 7 | import { ProcessUtils } from 'wdRouter'; | 6 | import { ProcessUtils } from 'wdRouter'; |
| 7 | +import { HttpUtils } from 'wdNetwork/Index'; | ||
| 8 | 8 | ||
| 9 | /** | 9 | /** |
| 10 | * 小视频横划卡 | 10 | * 小视频横划卡 |
| @@ -145,7 +145,7 @@ struct CreatorItem { | @@ -145,7 +145,7 @@ struct CreatorItem { | ||
| 145 | this.rmhIsAttention = this.rmhIsAttention ? 0 : 1 | 145 | this.rmhIsAttention = this.rmhIsAttention ? 0 : 1 |
| 146 | return | 146 | return |
| 147 | // 未登录,跳转登录 | 147 | // 未登录,跳转登录 |
| 148 | - if (!HttpUrlUtils.getUserId()) { | 148 | + if (!HttpUtils.getUserId()) { |
| 149 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 149 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 150 | return | 150 | return |
| 151 | } | 151 | } |
| 1 | import { CompDTO, ContentDTO, Params } from 'wdBean'; | 1 | import { CompDTO, ContentDTO, Params } from 'wdBean'; |
| 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 3 | -import { HttpUrlUtils } from 'wdNetwork/Index'; | ||
| 4 | import { postInteractAccentionOperateParams } from 'wdBean'; | 3 | import { postInteractAccentionOperateParams } from 'wdBean'; |
| 5 | import { PageRepository } from '../../repository/PageRepository'; | 4 | import { PageRepository } from '../../repository/PageRepository'; |
| 6 | -import { CommonConstants } from 'wdConstant/Index'; | ||
| 7 | import { ProcessUtils } from 'wdRouter'; | 5 | import { ProcessUtils } from 'wdRouter'; |
| 6 | +import { HttpUtils } from 'wdNetwork/Index'; | ||
| 8 | 7 | ||
| 9 | /** | 8 | /** |
| 10 | * 小视频横划卡 | 9 | * 小视频横划卡 |
| @@ -198,7 +197,7 @@ struct CreatorItem { | @@ -198,7 +197,7 @@ struct CreatorItem { | ||
| 198 | this.rmhIsAttention = this.rmhIsAttention ? 0 : 1 | 197 | this.rmhIsAttention = this.rmhIsAttention ? 0 : 1 |
| 199 | return | 198 | return |
| 200 | // 未登录,跳转登录 | 199 | // 未登录,跳转登录 |
| 201 | - if (!HttpUrlUtils.getUserId()) { | 200 | + if (!HttpUtils.getUserId()) { |
| 202 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 201 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 203 | return | 202 | return |
| 204 | } | 203 | } |
| 1 | import { CompDTO, ContentDTO, Params } from 'wdBean'; | 1 | import { CompDTO, ContentDTO, Params } from 'wdBean'; |
| 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 3 | -import { HttpUrlUtils } from 'wdNetwork/Index'; | ||
| 4 | import { postInteractAccentionOperateParams } from 'wdBean'; | 3 | import { postInteractAccentionOperateParams } from 'wdBean'; |
| 5 | import { PageRepository } from '../../repository/PageRepository'; | 4 | import { PageRepository } from '../../repository/PageRepository'; |
| 6 | import { CommonConstants } from 'wdConstant/Index'; | 5 | import { CommonConstants } from 'wdConstant/Index'; |
| 6 | +import { HttpUtils } from 'wdNetwork/Index'; | ||
| 7 | 7 | ||
| 8 | /** | 8 | /** |
| 9 | * 人民号横划卡 | 9 | * 人民号横划卡 |
| @@ -172,7 +172,7 @@ struct CreatorItem { | @@ -172,7 +172,7 @@ struct CreatorItem { | ||
| 172 | this.rmhIsAttention = this.rmhIsAttention ? 0 : 1 | 172 | this.rmhIsAttention = this.rmhIsAttention ? 0 : 1 |
| 173 | return | 173 | return |
| 174 | // 未登录,跳转登录 | 174 | // 未登录,跳转登录 |
| 175 | - if (!HttpUrlUtils.getUserId()) { | 175 | + if (!HttpUtils.getUserId()) { |
| 176 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 176 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 177 | return | 177 | return |
| 178 | } | 178 | } |
| 1 | import { commentInfo, CompDTO, ContentDTO, Params } from 'wdBean'; | 1 | import { commentInfo, CompDTO, ContentDTO, Params } from 'wdBean'; |
| 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; | 2 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index'; |
| 3 | -import { HttpUrlUtils } from 'wdNetwork/Index'; | 3 | +import { HttpUtils } from 'wdNetwork/Index'; |
| 4 | import { postInteractAccentionOperateParams } from 'wdBean'; | 4 | import { postInteractAccentionOperateParams } from 'wdBean'; |
| 5 | import { PageRepository } from '../../repository/PageRepository'; | 5 | import { PageRepository } from '../../repository/PageRepository'; |
| 6 | import { DateTimeUtils } from 'wdKit/Index'; | 6 | import { DateTimeUtils } from 'wdKit/Index'; |
| 7 | -import { CommonConstants } from 'wdConstant/Index'; | ||
| 8 | import { ProcessUtils } from 'wdRouter'; | 7 | import { ProcessUtils } from 'wdRouter'; |
| 9 | 8 | ||
| 10 | /** | 9 | /** |
| @@ -228,7 +227,7 @@ struct CreatorItem { | @@ -228,7 +227,7 @@ struct CreatorItem { | ||
| 228 | this.rmhIsAttention = this.rmhIsAttention ? 0 : 1 | 227 | this.rmhIsAttention = this.rmhIsAttention ? 0 : 1 |
| 229 | return | 228 | return |
| 230 | // 未登录,跳转登录 | 229 | // 未登录,跳转登录 |
| 231 | - if (!HttpUrlUtils.getUserId()) { | 230 | + if (!HttpUtils.getUserId()) { |
| 232 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 231 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 233 | return | 232 | return |
| 234 | } | 233 | } |
| 1 | import { SpConstants } from 'wdConstant/Index' | 1 | import { SpConstants } from 'wdConstant/Index' |
| 2 | import { DateTimeUtils, SPHelper, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index' | 2 | import { DateTimeUtils, SPHelper, StringUtils, ToastUtils, UserDataLocal } from 'wdKit/Index' |
| 3 | -import { HttpUrlUtils } from 'wdNetwork/Index' | 3 | +import { HttpUtils } from 'wdNetwork/Index' |
| 4 | import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' | 4 | import { WDRouterRule, WDRouterPage } from 'wdRouter/Index' |
| 5 | import MinePageDatasModel from '../../../model/MinePageDatasModel' | 5 | import MinePageDatasModel from '../../../model/MinePageDatasModel' |
| 6 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem' | 6 | import { FollowListDetailItem } from '../../../viewmodel/FollowListDetailItem' |
| @@ -250,7 +250,7 @@ export struct FollowChildComponent{ | @@ -250,7 +250,7 @@ export struct FollowChildComponent{ | ||
| 250 | isLogin = false | 250 | isLogin = false |
| 251 | } | 251 | } |
| 252 | if(isLogin){ | 252 | if(isLogin){ |
| 253 | - let item = new FollowOperationRequestItem(this.data.cnUserType,this.data.cnUserId,this.data.creatorId,HttpUrlUtils.getUserType(),HttpUrlUtils.getUserId(),this.data.status==="0" ? 1:0) | 253 | + let item = new FollowOperationRequestItem(this.data.cnUserType,this.data.cnUserId,this.data.creatorId,HttpUtils.getUserType(),HttpUtils.getUserId(),this.data.status==="0" ? 1:0) |
| 254 | MinePageDatasModel.getFollowOperation(item,getContext(this)).then((value)=>{ | 254 | MinePageDatasModel.getFollowOperation(item,getContext(this)).then((value)=>{ |
| 255 | if(value!=null){ | 255 | if(value!=null){ |
| 256 | if (value.code === 0 || value.code.toString() === "0") { | 256 | if (value.code === 0 || value.code.toString() === "0") { |
| @@ -5,7 +5,7 @@ import { Logger } from 'wdKit' | @@ -5,7 +5,7 @@ import { Logger } from 'wdKit' | ||
| 5 | import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel' | 5 | import { PeopleShipHomePageDataModel } from '../../viewmodel/PeopleShipHomePageDataModel' |
| 6 | import { PeopleShipHomeListComponent } from '../peopleShipHomePage/PeopleShipHomeListComponent' | 6 | import { PeopleShipHomeListComponent } from '../peopleShipHomePage/PeopleShipHomeListComponent' |
| 7 | import { QueryListIsFollowedItem } from '../../viewmodel/QueryListIsFollowedItem' | 7 | import { QueryListIsFollowedItem } from '../../viewmodel/QueryListIsFollowedItem' |
| 8 | -import { HttpUrlUtils } from 'wdNetwork/Index' | 8 | +import { HttpUtils } from 'wdNetwork/Index' |
| 9 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | 9 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' |
| 10 | import { PageRepository } from '../../repository/PageRepository' | 10 | import { PageRepository } from '../../repository/PageRepository' |
| 11 | import { | 11 | import { |
| @@ -108,7 +108,7 @@ struct PeopleShipHomePage { | @@ -108,7 +108,7 @@ struct PeopleShipHomePage { | ||
| 108 | 108 | ||
| 109 | // 获取关注 | 109 | // 获取关注 |
| 110 | // 登录后获取,是否关注 | 110 | // 登录后获取,是否关注 |
| 111 | - if (HttpUrlUtils.getUserId()) { | 111 | + if (HttpUtils.getUserId()) { |
| 112 | let followList: QueryListIsFollowedItem[] = await PeopleShipHomePageDataModel.getHomePageFollowListStatusData(this.creatorId) | 112 | let followList: QueryListIsFollowedItem[] = await PeopleShipHomePageDataModel.getHomePageFollowListStatusData(this.creatorId) |
| 113 | Logger.debug('PeopleShipHomePage', '获取关注信息', `${JSON.stringify(followList)}`) | 113 | Logger.debug('PeopleShipHomePage', '获取关注信息', `${JSON.stringify(followList)}`) |
| 114 | this.findFollowStata(followList) | 114 | this.findFollowStata(followList) |
| @@ -135,7 +135,7 @@ struct PeopleShipHomePage { | @@ -135,7 +135,7 @@ struct PeopleShipHomePage { | ||
| 135 | return | 135 | return |
| 136 | } | 136 | } |
| 137 | // 未登录,跳转登录 | 137 | // 未登录,跳转登录 |
| 138 | - if (!HttpUrlUtils.getUserId()) { | 138 | + if (!HttpUtils.getUserId()) { |
| 139 | this.isLoadingAttention = false | 139 | this.isLoadingAttention = false |
| 140 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 140 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 141 | return | 141 | return |
| 1 | -import dataPreferences from '@ohos.data.preferences'; | ||
| 2 | import { PermissionUtil } from 'wdKit' | 1 | import { PermissionUtil } from 'wdKit' |
| 3 | -import { SPHelper } from 'wdKit' | ||
| 4 | -import hilog from '@ohos.hilog'; | ||
| 5 | import { PrivacySettingModel } from '../../model/PrivacySettingModel' | 2 | import { PrivacySettingModel } from '../../model/PrivacySettingModel' |
| 6 | import { Params } from 'wdBean'; | 3 | import { Params } from 'wdBean'; |
| 7 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; | 4 | import { WDRouterPage, WDRouterRule } from 'wdRouter'; |
| 8 | -import { HttpUrlUtils } from 'wdNetwork/Index'; | 5 | +import { HttpUtils } from 'wdNetwork/Index'; |
| 9 | 6 | ||
| 10 | const TAG = 'PrivacySettingPage'; | 7 | const TAG = 'PrivacySettingPage'; |
| 11 | const DiyString = '开启个性化推荐' | 8 | const DiyString = '开启个性化推荐' |
| @@ -24,7 +21,7 @@ export struct PrivacySettingPage { | @@ -24,7 +21,7 @@ export struct PrivacySettingPage { | ||
| 24 | } | 21 | } |
| 25 | 22 | ||
| 26 | aboutToAppear() { | 23 | aboutToAppear() { |
| 27 | - if (!HttpUrlUtils.getUserId()) { | 24 | + if (!HttpUtils.getUserId()) { |
| 28 | this.listData.splice(0, 1); | 25 | this.listData.splice(0, 1); |
| 29 | } | 26 | } |
| 30 | // 获取权限= | 27 | // 获取权限= |
| 1 | import { ContentDTO } from 'wdBean/Index' | 1 | import { ContentDTO } from 'wdBean/Index' |
| 2 | import { LazyDataSource, UserDataLocal } from 'wdKit/Index' | 2 | import { LazyDataSource, UserDataLocal } from 'wdKit/Index' |
| 3 | -import { HttpUrlUtils } from 'wdNetwork/Index' | 3 | +import { HttpUtils } from 'wdNetwork/Index' |
| 4 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' | 4 | import SearcherAboutDataModel from '../../model/SearcherAboutDataModel' |
| 5 | import { SearchSuggestRequestItem } from '../../viewmodel/SearchSuggestRequestItem' | 5 | import { SearchSuggestRequestItem } from '../../viewmodel/SearchSuggestRequestItem' |
| 6 | import { CardParser } from '../CardParser' | 6 | import { CardParser } from '../CardParser' |
| @@ -36,7 +36,7 @@ export struct SearchResultComponent { | @@ -36,7 +36,7 @@ export struct SearchResultComponent { | ||
| 36 | getSuggestData() { | 36 | getSuggestData() { |
| 37 | this.isLoading = true | 37 | this.isLoading = true |
| 38 | 38 | ||
| 39 | - let request: SearchSuggestRequestItem = new SearchSuggestRequestItem(2, "", "", HttpUrlUtils.getImei(), UserDataLocal.getUserId(), 8, "") | 39 | + let request: SearchSuggestRequestItem = new SearchSuggestRequestItem(2, "", "", HttpUtils.getImei(), UserDataLocal.getUserId(), 8, "") |
| 40 | 40 | ||
| 41 | SearcherAboutDataModel.getSearchSuggestData(request, getContext(this)).then((value) => { | 41 | SearcherAboutDataModel.getSearchSuggestData(request, getContext(this)).then((value) => { |
| 42 | value.forEach((item) => { | 42 | value.forEach((item) => { |
| 1 | -import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork'; | 1 | +import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork'; |
| 2 | 2 | ||
| 3 | export class LogoutModel{ | 3 | export class LogoutModel{ |
| 4 | 4 | ||
| 5 | requestLogout(){ | 5 | requestLogout(){ |
| 6 | let bean: Record<string, string> = {}; | 6 | let bean: Record<string, string> = {}; |
| 7 | - bean['refreshToken'] = HttpUrlUtils.getRefreshToken() | 7 | + bean['refreshToken'] = HttpUtils.getRefreshToken() |
| 8 | return new Promise<string>((success, fail) => { | 8 | return new Promise<string>((success, fail) => { |
| 9 | HttpBizUtil.post<ResponseDTO<string>>(HttpUrlUtils.accountLogoutUrl(), bean).then((data: ResponseDTO<string>) => { | 9 | HttpBizUtil.post<ResponseDTO<string>>(HttpUrlUtils.accountLogoutUrl(), bean).then((data: ResponseDTO<string>) => { |
| 10 | if (!data) { | 10 | if (!data) { |
| @@ -2,7 +2,7 @@ | @@ -2,7 +2,7 @@ | ||
| 2 | import MinePagePersonalFunctionsItem from '../viewmodel/MinePagePersonalFunctionsItem' | 2 | import MinePagePersonalFunctionsItem from '../viewmodel/MinePagePersonalFunctionsItem' |
| 3 | import MinePageCreatorFunctionsItem from '../viewmodel/MinePageCreatorFunctionsItem' | 3 | import MinePageCreatorFunctionsItem from '../viewmodel/MinePageCreatorFunctionsItem' |
| 4 | import MinePageMoreFunctionModel from '../viewmodel/MinePageMoreFunctionModel'; | 4 | import MinePageMoreFunctionModel from '../viewmodel/MinePageMoreFunctionModel'; |
| 5 | -import { HttpBizUtil, HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | 5 | +import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork'; |
| 6 | import { MineAppointmentListItem } from '../viewmodel/MineAppointmentListItem'; | 6 | import { MineAppointmentListItem } from '../viewmodel/MineAppointmentListItem'; |
| 7 | import { Logger, StringUtils } from 'wdKit'; | 7 | import { Logger, StringUtils } from 'wdKit'; |
| 8 | import { MineFollowListDetailItem } from '../viewmodel/MineFollowListDetailItem'; | 8 | import { MineFollowListDetailItem } from '../viewmodel/MineFollowListDetailItem'; |
| @@ -470,7 +470,7 @@ class MinePageDatasModel{ | @@ -470,7 +470,7 @@ class MinePageDatasModel{ | ||
| 470 | } | 470 | } |
| 471 | 471 | ||
| 472 | fetchOtherUserFollowListData(object:UserFollowListRequestItem) { | 472 | fetchOtherUserFollowListData(object:UserFollowListRequestItem) { |
| 473 | - let url = HttpUrlUtils.getOtherUserFollowListDataUrl()+`?pageSize=${object.pageSize}&pageNum=${object.pageNum}&queryUserId=${object.queryUserId}&userType=${object.userType}&userId=${HttpUrlUtils.getUserId()}` | 473 | + let url = HttpUrlUtils.getOtherUserFollowListDataUrl()+`?pageSize=${object.pageSize}&pageNum=${object.pageNum}&queryUserId=${object.queryUserId}&userType=${object.userType}&userId=${HttpUtils.getUserId()}` |
| 474 | return WDHttp.get<ResponseDTO<MineFollowListItem>>(url) | 474 | return WDHttp.get<ResponseDTO<MineFollowListItem>>(url) |
| 475 | }; | 475 | }; |
| 476 | 476 |
| 1 | -import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; | 1 | +import { HttpUrlUtils, HttpUtils, ResponseDTO, WDHttp } from 'wdNetwork'; |
| 2 | import { DateTimeUtils, Logger, StringUtils } from 'wdKit'; | 2 | import { DateTimeUtils, Logger, StringUtils } from 'wdKit'; |
| 3 | import { | 3 | import { |
| 4 | batchLikeAndCollectResult, | 4 | batchLikeAndCollectResult, |
| @@ -52,9 +52,9 @@ export class PageRepository { | @@ -52,9 +52,9 @@ export class PageRepository { | ||
| 52 | } | 52 | } |
| 53 | url = url + "?channelStrategy=" + pageBean.groupStrategy | 53 | url = url + "?channelStrategy=" + pageBean.groupStrategy |
| 54 | + "&loadStrategy=" + loadStrategy | 54 | + "&loadStrategy=" + loadStrategy |
| 55 | - + "&districtCode=" + HttpUrlUtils.getDistrictCode() | ||
| 56 | - + "&provinceCode=" + HttpUrlUtils.getProvinceCode() | ||
| 57 | - + "&cityCode=" + HttpUrlUtils.getCityCode() | 55 | + + "&districtCode=" + HttpUtils.getDistrictCode() |
| 56 | + + "&provinceCode=" + HttpUtils.getProvinceCode() | ||
| 57 | + + "&cityCode=" + HttpUtils.getCityCode() | ||
| 58 | + "&refreshTime=" + DateTimeUtils.getTimeStamp() | 58 | + "&refreshTime=" + DateTimeUtils.getTimeStamp() |
| 59 | + "&pageId=" + pageBean.pageId | 59 | + "&pageId=" + pageBean.pageId |
| 60 | + "&groupId=" + pageBean.groupId | 60 | + "&groupId=" + pageBean.groupId |
| @@ -83,9 +83,9 @@ export class PageRepository { | @@ -83,9 +83,9 @@ export class PageRepository { | ||
| 83 | } | 83 | } |
| 84 | url = url + "?channelStrategy=" + pageBean.groupStrategy | 84 | url = url + "?channelStrategy=" + pageBean.groupStrategy |
| 85 | + "&loadStrategy=" + loadStrategy | 85 | + "&loadStrategy=" + loadStrategy |
| 86 | - + "&districtCode=" + HttpUrlUtils.getDistrictCode() | ||
| 87 | - + "&provinceCode=" + HttpUrlUtils.getProvinceCode() | ||
| 88 | - + "&cityCode=" + HttpUrlUtils.getCityCode() | 86 | + + "&districtCode=" + HttpUtils.getDistrictCode() |
| 87 | + + "&provinceCode=" + HttpUtils.getProvinceCode() | ||
| 88 | + + "&cityCode=" + HttpUtils.getCityCode() | ||
| 89 | + "&refreshTime=" + DateTimeUtils.getTimeStamp() | 89 | + "&refreshTime=" + DateTimeUtils.getTimeStamp() |
| 90 | + "&pageId=" + pageBean.pageId | 90 | + "&pageId=" + pageBean.pageId |
| 91 | + "&groupId=" + pageBean.groupId | 91 | + "&groupId=" + pageBean.groupId |
| 1 | import { SpConstants } from 'wdConstant/Index' | 1 | import { SpConstants } from 'wdConstant/Index' |
| 2 | import { SPHelper, UserDataLocal } from 'wdKit/Index' | 2 | import { SPHelper, UserDataLocal } from 'wdKit/Index' |
| 3 | -import { HttpUrlUtils } from 'wdNetwork/Index' | 3 | +import { HttpUtils } from 'wdNetwork/Index' |
| 4 | import { LogoutModel } from '../model/LogoutModel' | 4 | import { LogoutModel } from '../model/LogoutModel' |
| 5 | 5 | ||
| 6 | export class LogoutViewModel{ | 6 | export class LogoutViewModel{ |
| @@ -29,9 +29,9 @@ export class LogoutViewModel{ | @@ -29,9 +29,9 @@ export class LogoutViewModel{ | ||
| 29 | SPHelper.default.saveSync(SpConstants.USER_Type, '') | 29 | SPHelper.default.saveSync(SpConstants.USER_Type, '') |
| 30 | SPHelper.default.saveSync(SpConstants.USER_NAME, '') | 30 | SPHelper.default.saveSync(SpConstants.USER_NAME, '') |
| 31 | SPHelper.default.saveSync(SpConstants.USER_PHONE, '') | 31 | SPHelper.default.saveSync(SpConstants.USER_PHONE, '') |
| 32 | - HttpUrlUtils.setUserId("") | ||
| 33 | - HttpUrlUtils.setUserType("") | ||
| 34 | - HttpUrlUtils.setUserToken('') | 32 | + HttpUtils.setUserId("") |
| 33 | + HttpUtils.setUserType("") | ||
| 34 | + HttpUtils.setUserToken('') | ||
| 35 | UserDataLocal.clearUserData() | 35 | UserDataLocal.clearUserData() |
| 36 | } | 36 | } |
| 37 | } | 37 | } |
| @@ -2,7 +2,7 @@ import font from '@ohos.font' | @@ -2,7 +2,7 @@ import font from '@ohos.font' | ||
| 2 | import { LiveDetailsBean } from 'wdBean/Index' | 2 | import { LiveDetailsBean } from 'wdBean/Index' |
| 3 | import { DateTimeUtils, StringUtils } from 'wdKit/Index' | 3 | import { DateTimeUtils, StringUtils } from 'wdKit/Index' |
| 4 | import { LiveViewModel } from '../../viewModel/LiveViewModel' | 4 | import { LiveViewModel } from '../../viewModel/LiveViewModel' |
| 5 | -import { HttpUrlUtils } from 'wdNetwork/Index' | 5 | +import { HttpUtils } from 'wdNetwork/Index' |
| 6 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' | 6 | import { WDRouterPage, WDRouterRule } from 'wdRouter/Index' |
| 7 | 7 | ||
| 8 | @Component | 8 | @Component |
| @@ -116,7 +116,7 @@ export struct LiveCountdownComponent { | @@ -116,7 +116,7 @@ export struct LiveCountdownComponent { | ||
| 116 | .border({ radius: 4 }) | 116 | .border({ radius: 4 }) |
| 117 | .backgroundColor(this.isAppointmentLive ? '#CCCCCC' : '#ED2800') | 117 | .backgroundColor(this.isAppointmentLive ? '#CCCCCC' : '#ED2800') |
| 118 | .onClick(() => { | 118 | .onClick(() => { |
| 119 | - if (!HttpUrlUtils.getUserId()) { | 119 | + if (!HttpUtils.getUserId()) { |
| 120 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) | 120 | WDRouterRule.jumpWithPage(WDRouterPage.loginPage) |
| 121 | return | 121 | return |
| 122 | } | 122 | } |
| @@ -7,7 +7,7 @@ import { | @@ -7,7 +7,7 @@ import { | ||
| 7 | postBatchAttentionStatusParams, | 7 | postBatchAttentionStatusParams, |
| 8 | postInteractBrowsOperateParams | 8 | postInteractBrowsOperateParams |
| 9 | } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; | 9 | } from 'wdDetailPlayApi/src/main/ets/request/ContentDetailRequest'; |
| 10 | -import { HttpUrlUtils } from 'wdNetwork/Index'; | 10 | +import { HttpUtils } from 'wdNetwork/Index'; |
| 11 | import { DateTimeUtils } from 'wdKit/Index'; | 11 | import { DateTimeUtils } from 'wdKit/Index'; |
| 12 | import { PlayerBottomView } from '../view/PlayerBottomView'; | 12 | import { PlayerBottomView } from '../view/PlayerBottomView'; |
| 13 | import { PlayerRightView } from '../view/PlayerRightView'; | 13 | import { PlayerRightView } from '../view/PlayerRightView'; |
| @@ -85,7 +85,7 @@ export struct DetailPlayShortVideoPage { | @@ -85,7 +85,7 @@ export struct DetailPlayShortVideoPage { | ||
| 85 | * 查询用户点赞、收藏、关注状态、记录浏览历史 | 85 | * 查询用户点赞、收藏、关注状态、记录浏览历史 |
| 86 | */ | 86 | */ |
| 87 | queryNewsInfoOfUser() { | 87 | queryNewsInfoOfUser() { |
| 88 | - if (HttpUrlUtils.getUserId()) { | 88 | + if (HttpUtils.getUserId()) { |
| 89 | const params: batchLikeAndCollectParams = { | 89 | const params: batchLikeAndCollectParams = { |
| 90 | contentList: [ | 90 | contentList: [ |
| 91 | { | 91 | { |
| 1 | import HashMap from '@ohos.util.HashMap'; | 1 | import HashMap from '@ohos.util.HashMap'; |
| 2 | -import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork'; | 2 | +import { HttpBizUtil, HttpUrlUtils, HttpUtils, ResponseDTO } from 'wdNetwork'; |
| 3 | import { Logger } from 'wdKit'; | 3 | import { Logger } from 'wdKit'; |
| 4 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; | 4 | import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; |
| 5 | import { LoginBean } from './LoginBean'; | 5 | import { LoginBean } from './LoginBean'; |
| 6 | import { CheckVerifyBean } from './CheckVerifyBean'; | 6 | import { CheckVerifyBean } from './CheckVerifyBean'; |
| 7 | -import { | ||
| 8 | - SpConstants | ||
| 9 | -} from '../../../../../../../commons/wdNetwork/oh_modules/wdConstant/src/main/ets/constants/SpConstants' | ||
| 10 | import { UserDetail } from 'wdBean/Index'; | 7 | import { UserDetail } from 'wdBean/Index'; |
| 11 | 8 | ||
| 12 | - | ||
| 13 | const TAG = 'LoginModel' | 9 | const TAG = 'LoginModel' |
| 14 | 10 | ||
| 15 | export class LoginModel { | 11 | export class LoginModel { |
| @@ -213,7 +209,7 @@ export class LoginModel { | @@ -213,7 +209,7 @@ export class LoginModel { | ||
| 213 | //退出登录 | 209 | //退出登录 |
| 214 | logOut() { | 210 | logOut() { |
| 215 | let bean: Record<string, string> = {}; | 211 | let bean: Record<string, string> = {}; |
| 216 | - bean['refreshToken'] = HttpUrlUtils.getRefreshToken(); | 212 | + bean['refreshToken'] = HttpUtils.getRefreshToken(); |
| 217 | 213 | ||
| 218 | return new Promise<string>((success, fail) => { | 214 | return new Promise<string>((success, fail) => { |
| 219 | HttpBizUtil.post<ResponseDTO<string>>(HttpUrlUtils.getLogoutUrl(), bean).then((data: ResponseDTO<string>)=>{ | 215 | HttpBizUtil.post<ResponseDTO<string>>(HttpUrlUtils.getLogoutUrl(), bean).then((data: ResponseDTO<string>)=>{ |
| @@ -7,9 +7,9 @@ import cryptoFramework from '@ohos.security.cryptoFramework' | @@ -7,9 +7,9 @@ import cryptoFramework from '@ohos.security.cryptoFramework' | ||
| 7 | import buffer from '@ohos.buffer' | 7 | import buffer from '@ohos.buffer' |
| 8 | import { encryptMessage } from '../../utils/cryptoUtil' | 8 | import { encryptMessage } from '../../utils/cryptoUtil' |
| 9 | 9 | ||
| 10 | -import { HttpUrlUtils } from 'wdNetwork/src/main/ets/http/HttpUrlUtils' | ||
| 11 | import { SpConstants } from 'wdConstant/Index' | 10 | import { SpConstants } from 'wdConstant/Index' |
| 12 | import { UserDetail } from 'wdBean/Index'; | 11 | import { UserDetail } from 'wdBean/Index'; |
| 12 | +import { HttpUtils } from 'wdNetwork/Index' | ||
| 13 | 13 | ||
| 14 | const TAG = "LoginViewModel" | 14 | const TAG = "LoginViewModel" |
| 15 | 15 | ||
| @@ -55,9 +55,9 @@ export class LoginViewModel { | @@ -55,9 +55,9 @@ export class LoginViewModel { | ||
| 55 | SPHelper.default.saveSync(SpConstants.USER_STATUS, data.status) | 55 | SPHelper.default.saveSync(SpConstants.USER_STATUS, data.status) |
| 56 | SPHelper.default.saveSync(SpConstants.USER_Type, data.userType) | 56 | SPHelper.default.saveSync(SpConstants.USER_Type, data.userType) |
| 57 | SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName) | 57 | SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName) |
| 58 | - HttpUrlUtils.setUserId(data.id+"") | ||
| 59 | - HttpUrlUtils.setUserType(data.userType+"") | ||
| 60 | - HttpUrlUtils.setUserToken(data.jwtToken) | 58 | + HttpUtils.setUserId(data.id+"") |
| 59 | + HttpUtils.setUserType(data.userType+"") | ||
| 60 | + HttpUtils.setUserToken(data.jwtToken) | ||
| 61 | success(data) | 61 | success(data) |
| 62 | }).catch((error:string) => { | 62 | }).catch((error:string) => { |
| 63 | fail(error) | 63 | fail(error) |
| @@ -79,9 +79,9 @@ export class LoginViewModel { | @@ -79,9 +79,9 @@ export class LoginViewModel { | ||
| 79 | SPHelper.default.saveSync(SpConstants.USER_STATUS, data.status) | 79 | SPHelper.default.saveSync(SpConstants.USER_STATUS, data.status) |
| 80 | SPHelper.default.saveSync(SpConstants.USER_Type, data.userType) | 80 | SPHelper.default.saveSync(SpConstants.USER_Type, data.userType) |
| 81 | SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName) | 81 | SPHelper.default.saveSync(SpConstants.USER_NAME, data.userName) |
| 82 | - HttpUrlUtils.setUserId(data.id+"") | ||
| 83 | - HttpUrlUtils.setUserType(data.userType+"") | ||
| 84 | - HttpUrlUtils.setUserToken(data.jwtToken) | 82 | + HttpUtils.setUserId(data.id+"") |
| 83 | + HttpUtils.setUserType(data.userType+"") | ||
| 84 | + HttpUtils.setUserToken(data.jwtToken) | ||
| 85 | success(data) | 85 | success(data) |
| 86 | }).catch((value: string) => { | 86 | }).catch((value: string) => { |
| 87 | fail(value) | 87 | fail(value) |
| @@ -157,9 +157,9 @@ export class LoginViewModel { | @@ -157,9 +157,9 @@ export class LoginViewModel { | ||
| 157 | SPHelper.default.saveSync(SpConstants.USER_STATUS, '') | 157 | SPHelper.default.saveSync(SpConstants.USER_STATUS, '') |
| 158 | SPHelper.default.saveSync(SpConstants.USER_Type, '') | 158 | SPHelper.default.saveSync(SpConstants.USER_Type, '') |
| 159 | SPHelper.default.saveSync(SpConstants.USER_NAME, '') | 159 | SPHelper.default.saveSync(SpConstants.USER_NAME, '') |
| 160 | - HttpUrlUtils.setUserId("") | ||
| 161 | - HttpUrlUtils.setUserType("") | ||
| 162 | - HttpUrlUtils.setUserToken('') | 160 | + HttpUtils.setUserId("") |
| 161 | + HttpUtils.setUserType("") | ||
| 162 | + HttpUtils.setUserToken('') | ||
| 163 | success(data) | 163 | success(data) |
| 164 | }).catch((message: string) => { | 164 | }).catch((message: string) => { |
| 165 | fail(message) | 165 | fail(message) |
-
Please register or login to post a comment