Showing
2 changed files
with
11 additions
and
51 deletions
| @@ -24,7 +24,6 @@ import { | @@ -24,7 +24,6 @@ import { | ||
| 24 | postRecommendListParams | 24 | postRecommendListParams |
| 25 | } from 'wdBean'; | 25 | } from 'wdBean'; |
| 26 | import { PageUIReqBean } from '../components/page/bean/PageUIReqBean'; | 26 | import { PageUIReqBean } from '../components/page/bean/PageUIReqBean'; |
| 27 | -import { LiveReviewDTO } from 'wdBean/src/main/ets/bean/component/LiveReviewDTO'; | ||
| 28 | 27 | ||
| 29 | const TAG = 'HttpRequest'; | 28 | const TAG = 'HttpRequest'; |
| 30 | 29 | ||
| @@ -196,12 +195,6 @@ export class PageRepository { | @@ -196,12 +195,6 @@ export class PageRepository { | ||
| 196 | return url; | 195 | return url; |
| 197 | } | 196 | } |
| 198 | 197 | ||
| 199 | - static getLiveReviewUrl(pageNum: number = 1, pageSize: number = 20) { | ||
| 200 | - let url = HttpUrlUtils.getHost() + HttpUrlUtils.LIVE_REVIEW_PATH + "?pageNum=" + pageNum + "&pageSize=" + pageSize; | ||
| 201 | - Logger.info(TAG, "getLiveReviewUrl url = " + url) | ||
| 202 | - return url; | ||
| 203 | - } | ||
| 204 | - | ||
| 205 | static fetchNavigationDataApi() { | 198 | static fetchNavigationDataApi() { |
| 206 | let url = PageRepository.getBottomNavGroupUrl(); | 199 | let url = PageRepository.getBottomNavGroupUrl(); |
| 207 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); | 200 | let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders(); |
| @@ -7,16 +7,15 @@ import { | @@ -7,16 +7,15 @@ import { | ||
| 7 | MorningEveningPaperDTO, | 7 | MorningEveningPaperDTO, |
| 8 | NavigationBodyDTO, | 8 | NavigationBodyDTO, |
| 9 | PageDTO, | 9 | PageDTO, |
| 10 | - PageInfoBean | 10 | + PageInfoBean, |
| 11 | + PageInfoDTO | ||
| 11 | } from 'wdBean'; | 12 | } from 'wdBean'; |
| 12 | 13 | ||
| 13 | -import { LiveReviewDTO } from 'wdBean/src/main/ets/bean/component/LiveReviewDTO'; | ||
| 14 | import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit'; | 14 | import { CollectionUtils, Logger, ResourcesUtils, StringUtils } from 'wdKit'; |
| 15 | import { ResponseDTO, } from 'wdNetwork'; | 15 | import { ResponseDTO, } from 'wdNetwork'; |
| 16 | import { PageUIReqBean } from '../components/page/bean/PageUIReqBean'; | 16 | import { PageUIReqBean } from '../components/page/bean/PageUIReqBean'; |
| 17 | import { PageRepository } from '../repository/PageRepository'; | 17 | import { PageRepository } from '../repository/PageRepository'; |
| 18 | import { BaseViewModel } from './BaseViewModel'; | 18 | import { BaseViewModel } from './BaseViewModel'; |
| 19 | -import PageModel from './PageModel'; | ||
| 20 | 19 | ||
| 21 | const TAG = 'PageViewModel'; | 20 | const TAG = 'PageViewModel'; |
| 22 | /** | 21 | /** |
| @@ -150,27 +149,6 @@ export class PageViewModel extends BaseViewModel { | @@ -150,27 +149,6 @@ export class PageViewModel extends BaseViewModel { | ||
| 150 | } else { | 149 | } else { |
| 151 | return this.parseComp(PageRepository.fetchCompData(pageModel)) | 150 | return this.parseComp(PageRepository.fetchCompData(pageModel)) |
| 152 | } | 151 | } |
| 153 | - return new Promise<PageDTO>((success, error) => { | ||
| 154 | - PageRepository.fetchLivePageData(pageId, groupId, channelId, groupStrategy, currentPage, pageSize) | ||
| 155 | - .then((resDTO: ResponseDTO<PageDTO>) => { | ||
| 156 | - if (!resDTO || !resDTO.data) { | ||
| 157 | - Logger.error(TAG, 'getNavData then resDTO is empty'); | ||
| 158 | - error('resDTO is empty'); | ||
| 159 | - return | ||
| 160 | - } | ||
| 161 | - if (resDTO.code != 0) { | ||
| 162 | - Logger.error(TAG, `getNavData then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 163 | - error('resDTO Response Code is failure'); | ||
| 164 | - return | ||
| 165 | - } | ||
| 166 | - Logger.info(TAG, "getNavData then,resDTO.timestamp:" + resDTO.timestamp); | ||
| 167 | - success(resDTO.data); | ||
| 168 | - }) | ||
| 169 | - .catch((err: Error) => { | ||
| 170 | - Logger.error(TAG, `getPageData catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 171 | - error(err); | ||
| 172 | - }) | ||
| 173 | - }) | ||
| 174 | } | 152 | } |
| 175 | 153 | ||
| 176 | private parseComp(getData: Promise<ResponseDTO<PageDTO>>): Promise<PageDTO> { | 154 | private parseComp(getData: Promise<ResponseDTO<PageDTO>>): Promise<PageDTO> { |
| @@ -340,28 +318,17 @@ export class PageViewModel extends BaseViewModel { | @@ -340,28 +318,17 @@ export class PageViewModel extends BaseViewModel { | ||
| 340 | return param; | 318 | return param; |
| 341 | } | 319 | } |
| 342 | 320 | ||
| 343 | - async getLiveReviewUrl(pageNum: number, pageSize: number): Promise<LiveReviewDTO> { | ||
| 344 | - return new Promise<LiveReviewDTO>((success, error) => { | ||
| 345 | - Logger.info(TAG, `getLivePreviewUrl pageInfo start`); | ||
| 346 | - PageRepository.fetchLiveReviewUrl(pageNum, pageSize).then((resDTO: ResponseDTO<LiveReviewDTO>) => { | ||
| 347 | - if (!resDTO || !resDTO.data) { | ||
| 348 | - Logger.error(TAG, 'getLivePreviewUrl then navResDTO is empty'); | ||
| 349 | - error('resDTO is empty'); | ||
| 350 | - return | ||
| 351 | - } | ||
| 352 | - if (resDTO.code != 0) { | ||
| 353 | - Logger.error(TAG, `getLivePreviewUrl then code:${resDTO.code}, message:${resDTO.message}`); | ||
| 354 | - error('resDTO Response Code is failure'); | 321 | + async getPageInfo(pageId: string): Promise<PageInfoDTO> { |
| 322 | + return new Promise<PageInfoDTO>((success, error) => { | ||
| 323 | + PageRepository.fetchPageData(pageId).then((resDTO: ResponseDTO<PageInfoDTO>) => { | ||
| 324 | + if (this.isRespondsInvalid(resDTO, 'getPageInfo')) { | ||
| 325 | + error("getPageInfo data invalid"); | ||
| 355 | return | 326 | return |
| 356 | } | 327 | } |
| 357 | - // let navResStr = JSON.stringify(navResDTO); | ||
| 358 | - Logger.info(TAG, "getLivePreviewUrl then,navResDTO.timestamp:" + resDTO.timestamp); | ||
| 359 | - success(resDTO.data); | ||
| 360 | - }).catch((err: Error) => { | ||
| 361 | - Logger.error(TAG, `getLivePreviewUrl catch, error.name : ${err.name}, error.message:${err.message}`); | ||
| 362 | - error(err); | ||
| 363 | - }) | ||
| 364 | - }) | 328 | + Logger.info(TAG, "getPageInfo then,resDTO.timeStamp:" + resDTO.timestamp); |
| 329 | + success(resDTO.data as PageInfoDTO); | ||
| 330 | + }); | ||
| 331 | + }); | ||
| 365 | } | 332 | } |
| 366 | 333 | ||
| 367 | async getLiveReviewUrl(pageNum: number, pageSize: number): Promise<LiveReviewDTO> { | 334 | async getLiveReviewUrl(pageNum: number, pageSize: number): Promise<LiveReviewDTO> { |
-
Please register or login to post a comment