Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
zhangbo1_wd
2024-02-02 10:21:46 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0b9052b563665c9c7f1c438d1135e34dcf32c24e
0b9052b5
1 parent
63a83ee4
新增现网环境,合入4.0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
9 deletions
PeopleDaily_Harmony/wdComponent/src/main/ets/network/HttpUrlUtils.ets
sight_harmony/wdComponent/src/main/ets/repository/PageRepository.ets
sight_harmony/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
PeopleDaily_Harmony/wdComponent/src/main/ets/network/HttpUrlUtils.ets
View file @
0b9052b
...
...
@@ -71,6 +71,10 @@ export class HttpUrlUtils {
return headers;
}
static getHost() {
return this.hostUrl;
}
static getBottomNavGroupUrl() {
// https: //pd-apis-uat.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/bottomNavGroup
return this.hostUrl + this.BOTTOM_NAV_PATH;
...
...
sight_harmony/wdComponent/src/main/ets/repository/PageRepository.ets
View file @
0b9052b
...
...
@@ -6,11 +6,11 @@ import { ContentDetailDTO, NavigationBodyDTO, PageDTO } from 'wdBean';
export class PageRepository {
static getBottomNavGroupUrl() {
// https: //pd-apis-uat.pdnews.cn/api/rmrb-bff-display-zh/display/zh/c/bottomNavGroup
return HttpUrlUtils.
HOST
+ HttpUrlUtils.BOTTOM_NAV_PATH;
return HttpUrlUtils.
getHost()
+ HttpUrlUtils.BOTTOM_NAV_PATH;
}
static getCompInfoUrl(pageId: string, groupId: string, channelId: string, currentPage: number, pageSize: number) {
let url = HttpUrlUtils.
HOST
+ HttpUrlUtils.COMP_PATH;
let url = HttpUrlUtils.
getHost()
+ HttpUrlUtils.COMP_PATH;
// TODO 暂定只请求第一页,后续对接分页加载,参数再调整 first_load?
url = url + "?channelStrategy=2&loadStrategy=first_load"
+ "&districtCode=" + HttpUrlUtils.getDistrictCode()
...
...
@@ -27,7 +27,7 @@ export class PageRepository {
}
static getDetailInfoUrl(relId: string, contentId: string, relType: string) {
let url = HttpUrlUtils.
HOST
+ HttpUrlUtils.DETAIL_PATH;
let url = HttpUrlUtils.
getHost()
+ HttpUrlUtils.DETAIL_PATH;
url = url + "?relId=" + relId
+ "&contentId=" + contentId
+ "&relType=" + relType;
...
...
sight_harmony/wdNetwork/src/main/ets/http/HttpUrlUtils.ets
View file @
0b9052b
...
...
@@ -7,9 +7,21 @@ import { DateTimeUtils, Logger } from 'wdKit'
*/
export class HttpUrlUtils {
/**
*
现网地址
*
uat环境url
*/
static readonly HOST: string = "https://pd-apis-uat.pdnews.cn";
static readonly HOST_UAT: string = "https://pd-apis-uat.pdnews.cn";
/**
* 中文端sit环境
*/
static readonly HOST_SIT: string = "https://pd-apis-sit.pdnews.cn";
/**
* 正式环境url
*/
static readonly HOST_PRODUCT: string = "https://pdapis.pdnews.cn";
/**
* dev环境url
*/
static readonly HOST_DEV: string = "https://pd-apis-dev.pdnews.cn";
/**
* 启动接口(底导接口)
*/
...
...
@@ -23,13 +35,15 @@ export class HttpUrlUtils {
*/
static readonly DETAIL_PATH: string = "/api/rmrb-bff-display-zh/content/zh/c/content/detail";
private static hostUrl: string = HttpUrlUtils.HOST_PRODUCT;
static getCommonHeaders(): HashMap<string, string> {
let headers: HashMap<string, string> = new HashMap<string, string>()
headers.set('User-Agent', 'Dalvik/2.1.0 (Linux; U; Android 13; 22101317C Build/TKQ1.221013.002)')
headers.set('channel', HttpUrlUtils.getChannel())
headers.set('appCode', ConfigConstants.appCode)
//
headers.set('appCode', ConfigConstants.appCode)
headers.set('plat', HttpUrlUtils.getPlat())
headers.set('Authorization', 'APPCODE 83092caa603a421aa0222308b3f6b27a')
//
headers.set('Authorization', 'APPCODE 83092caa603a421aa0222308b3f6b27a')
headers.set('Content-Type', 'application/json; charset=utf-8')
headers.set('timestamp', HttpUrlUtils.getTimestamp())
headers.set('RMRB-X-TOKEN', HttpUrlUtils.getXToken())
...
...
@@ -38,7 +52,7 @@ export class HttpUrlUtils {
headers.set('build_version', HttpUrlUtils.getVersion())
headers.set('adcode', HttpUrlUtils.getAdCode())
headers.set('os_version', HttpUrlUtils.getOsVersion())
headers.set('X-Ca-Stage', 'PRE')
//
headers.set('X-Ca-Stage', 'PRE')
headers.set('versionCode', HttpUrlUtils.getVersionCode())
headers.set('system', HttpUrlUtils.getTerminalId())
headers.set('version_name', 'debug')
...
...
@@ -50,7 +64,7 @@ export class HttpUrlUtils {
// TODO 判断是否登录
headers.set('userId', HttpUrlUtils.getUserId())
headers.set('userType', HttpUrlUtils.getUserType())
HttpUrlUtils.addSpecialHeaders(headers);
// Logger.debug("TAG", '******************* commonHeaders headers start ******************************** ');
// headers.forEach((v,k)=>{
// Logger.debug("TAG", 'getCommonHeaders header: ' + k + ': ' + v);
...
...
@@ -59,6 +73,37 @@ export class HttpUrlUtils {
return headers;
}
static addSpecialHeaders(headers: HashMap<string, string>) {
switch (this.hostUrl) {
case this.HOST_UAT:
// TODO 待优化到常量类里
headers.set('X-Ca-Stage', 'PRE');
headers.set('Authorization', 'APPCODE 83092caa603a421aa0222308b3f6b27a');
headers.set('appCode', '83092caa603a421aa0222308b3f6b27a');
break
case this.HOST_SIT:
headers.set('X-Ca-Stage', 'TEST');
headers.set('Authorization', 'APPCODE 0af1f9085e484c97b2a44704bae72c07');
headers.set('appCode', '0af1f9085e484c97b2a44704bae72c07');
break
case this.HOST_PRODUCT:
headers.set('X-Ca-Stage', 'RELEASE');
headers.set('Authorization', 'APPCODE 3d4181bceeb94d9780e10dbb6c67bbf6');
headers.set('appCode', '3d4181bceeb94d9780e10dbb6c67bbf6');
break
case this.HOST_DEV:
headers.set('X-Ca-Stage', 'TEST');
headers.set('Authorization', 'APPCODE ff33172859e14f9a8299e3bd769e79f9');
headers.set('appCode', 'ff33172859e14f9a8299e3bd769e79f9');
break
default:
break
}
}
static getHost() {
return this.hostUrl;
}
private static getCity() {
// TODO 对接定位
...
...
Please
register
or
login
to post a comment