chenjun3_wd

早晚报数据

  1 +// export interface Group {
  2 +// blockDesc: string;
  3 +// groupStrategy: number;
  4 +// id: number;
  5 +// itemNum?: any;
  6 +// showType: number;
  7 +// sortValue: number;
  8 +// }
  9 +//
  10 +// export interface TopicInfo {
  11 +// axisColor: string;
  12 +// channelId?: any;
  13 +// commentFlag: number;
  14 +// commentPreviewFlag: number;
  15 +// commentShowFlag: number;
  16 +// frontFlag?: any;
  17 +// frontLinkObject?: any;
  18 +// posterFlag: number;
  19 +// posterUrl: string;
  20 +// relId?: any;
  21 +// relObjectId?: any;
  22 +// relType?: any;
  23 +// shareCoverUrl: string;
  24 +// shareOpen: number;
  25 +// sharePosterCoverUrl: string;
  26 +// sharePosterOpen?: any;
  27 +// shareSummary: string;
  28 +// shareTitle: string;
  29 +// shareUrl: string;
  30 +// slideColor: string;
  31 +// summary: string;
  32 +// title: string;
  33 +// titleShow: number;
  34 +// topicDate: string;
  35 +// topicId: string;
  36 +// topicPattern: number;
  37 +// topicTemplate?: any;
  38 +// topicType: number;
  39 +// transluceImgUrl: string;
  40 +// visitorComment: number;
  41 +// voteInfo?: any;
  42 +// }
  43 +//
  44 +// export interface PageInfoBean {
  45 +// backIconUrl: string;
  46 +// backgroundColor: string;
  47 +// backgroundImgUrl: string;
  48 +// baselineColor: string;
  49 +// baselineCopywriting: string;
  50 +// baselineShow: number;
  51 +// description: string;
  52 +// groups: Group[];
  53 +// hasAdInfo: number;
  54 +// hasPopUp: number;
  55 +// id: number;
  56 +// mainLogoImgUrl: string;
  57 +// name: string;
  58 +// pageTopParams?: any;
  59 +// pageTopType: number;
  60 +// pageType: number;
  61 +// popUps: any[];
  62 +// pushupLogoImgUrl: string;
  63 +// shareCoverUrl: string;
  64 +// shareIconUrl: string;
  65 +// shareName: string;
  66 +// shareSummary: string;
  67 +// shareUrl: string;
  68 +// statusBarColor: string;
  69 +// templateType: number;
  70 +// titleColor: string;
  71 +// topicInfo: TopicInfo;
  72 +// }
  73 +//
  74 +// export interface Meta {
  75 +// md5: string;
  76 +// }
  77 +//
  78 +// export interface RootObject {
  79 +// code: string;
  80 +// data: Data;
  81 +// message: string;
  82 +// meta: Meta;
  83 +// requestId: string;
  84 +// success: boolean;
  85 +// timestamp: number;
  86 +// }
  1 +
  2 +
  3 +const TAG = 'MorningEveningViewModel'
  4 +
  5 +export class MorningEveningViewModel {
  6 +
  7 + static async getNewspaperList(date: string, pageSize: string): Promise<NewspaperListBean> {
  8 + return new Promise<NewspaperListBean>((success, error) => {
  9 + Logger.info(TAG, `getNavData start`);
  10 + PageRepository.fetchNewspaperList(date, pageSize).then((resDTO: ResponseDTO<NewspaperListBean>) => {
  11 + if (!resDTO || !resDTO.data) {
  12 + Logger.error(TAG, 'getNewspaperList then navResDTO is empty');
  13 + error('resDTO is empty');
  14 + return
  15 + }
  16 + if (resDTO.code != 0) {
  17 + Logger.error(TAG, `getNewspaperList then code:${resDTO.code}, message:${resDTO.message}`);
  18 + error('resDTO Response Code is failure');
  19 + return
  20 + }
  21 + // let navResStr = JSON.stringify(navResDTO);
  22 + Logger.info(TAG, "getNewspaperList then,navResDTO.timestamp:" + resDTO.timestamp);
  23 + success(resDTO.data);
  24 + }).catch((err: Error) => {
  25 + Logger.error(TAG, `getNewspaperList catch, error.name : ${err.name}, error.message:${err.message}`);
  26 + error(err);
  27 + })
  28 + })
  29 + }
  30 +}