PeopleShipHomePageDataModel.ets
8.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
import { OtherUserDetailRequestItem } from './OtherUserDetailRequestItem';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { PeopleShipUserDetailData, ArticleCountData, ArticleListData, InfluenceData } from 'wdBean';
import { Logger } from 'wdKit';
import { FollowListStatusRequestItem } from './FollowListStatusRequestItem';
import { QueryListIsFollowedItem } from './QueryListIsFollowedItem';
const TAG = 'PeopleShipHomePageDataModel';
export class PeopleShipHomePageDataModel {
/*获取人民号主页详情*/
static fetchPeopleUserDetailData(item: OtherUserDetailRequestItem) {
let url = HttpUrlUtils.getOtherUserDetailDataUrl()
return WDHttp.post<ResponseDTO<PeopleShipUserDetailData>>(url, item)
}
static async getPeopleShipHomePageDetailInfo(creatorId: string, userType: string, userId: string): Promise<PeopleShipUserDetailData> {
let model = new OtherUserDetailRequestItem(creatorId, userType, userId)
return new Promise<PeopleShipUserDetailData>((success, error) => {
Logger.debug(TAG, `getMorningEveningCompInfo pageInfo start`);
PeopleShipHomePageDataModel.fetchPeopleUserDetailData(model)
.then((resDTO: ResponseDTO<PeopleShipUserDetailData>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'getPeopleShipHomePageDetailInfo then navResDTO is empty');
error('resDTO is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `getPeopleShipHomePageDetailInfo then code:${resDTO.code}, message:${resDTO.message}`);
error('resDTO Response Code is failure');
return
}
Logger.debug(TAG, "getPeopleShipHomePageDetailInfo then,navResDTO.timestamp:" + resDTO.timestamp);
success(resDTO.data);
})
.catch((err: Error) => {
Logger.error(TAG, `getPeopleShipHomePageDetailInfo catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
/*客户端 客态查询发布作品数量*/
static fetchArticleCountHotsData(includeLive: number, creatorId: string) {
let url = HttpUrlUtils.getArticleCountHotsDataUrl() + `?includeLive=${includeLive}&creatorId=${creatorId}`
// let url = 'https://pdapis.pdnews.cn/api/rmrb-content-search/zh/c/article/count' + `?includeLive=${includeLive}&creatorId=${creatorId}`
Logger.debug(TAG, `${url}`);
return WDHttp.get<ResponseDTO<ArticleCountData>>(url)
}
static async getPeopleShipHomePageArticleCountData(includeLive: number, creatorId: string): Promise<ArticleCountData> {
Logger.debug(TAG, `getPeopleShipHomePageArticleCountData start`);
return new Promise<ArticleCountData>((success, error) => {
Logger.debug(TAG, `getPeopleShipHomePageArticleCountData pageInfo start`);
PeopleShipHomePageDataModel.fetchArticleCountHotsData(includeLive, creatorId)
.then((resDTO: ResponseDTO<ArticleCountData>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'getPeopleShipHomePageArticleCountData then ArticleCountData is empty');
error('resDTO is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `getPeopleShipHomePageArticleCountData then code:${resDTO.code}, message:${resDTO.message}`);
error(resDTO.message);
return
}
Logger.debug(TAG, "getPeopleShipHomePageArticleCountData then,ArticleCountData.timestamp:" + resDTO.timestamp);
success(resDTO.data);
})
.catch((err: Error) => {
Logger.error(TAG, `getPeopleShipHomePageArticleCountData catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
/*客户端 客态主页页面-获取作品-从发布库获取该创作者下 稿件列表*/
static fetchArticleListHotsData(creatorId: string, pageNum: number, pageSize: number, type?: number) {
let url = HttpUrlUtils.getArticleListHotsDataUrl() + `?creatorId=${creatorId}&pageNum=${pageNum}&pageSize=${pageSize}`
if (type) {
url += `&type=${type}`
}
Logger.debug(TAG, `${url}`);
return WDHttp.get<ResponseDTO<ArticleListData>>(url)
}
static async getPeopleShipHomePageArticleListData(creatorId: string, pageNum: number, pageSize: number, type?: number): Promise<ArticleListData> {
Logger.debug(TAG, `getPeopleShipHomePageArticleListData start`);
return new Promise<ArticleListData>((success, error) => {
Logger.debug(TAG, `getPeopleShipHomePageArticleListData pageInfo start`);
PeopleShipHomePageDataModel.fetchArticleListHotsData(creatorId, pageNum, pageSize, type)
.then((resDTO: ResponseDTO<ArticleListData>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'getPeopleShipHomePageArticleListData then ArticleCountData is empty');
error('resDTO is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `getPeopleShipHomePageArticleListData then code:${resDTO.code}, message:${resDTO.message}`);
error(resDTO.message);
return
}
Logger.debug(TAG, "getPeopleShipHomePageArticleListData then,ArticleCountData.timestamp:" + resDTO.timestamp);
success(resDTO.data);
})
.catch((err: Error) => {
Logger.error(TAG, `getPeopleShipHomePageArticleListData catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
/*客户端 客态查询影响力*/
static fetchCreatorInfluenceInfoHotsData(creatorId: string) {
let url = HttpUrlUtils.getCreatorInfluenceInfoHotsDataUrl() + `?creatorId=${creatorId}`
Logger.debug(TAG, `${url}`);
return WDHttp.get<ResponseDTO<InfluenceData>>(url)
}
static async getCreatorInfluenceInfoData(creatorId: string): Promise<InfluenceData> {
Logger.debug(TAG, `getCreatorInfluenceInfoData start`);
return new Promise<InfluenceData>((success, error) => {
Logger.debug(TAG, `getCreatorInfluenceInfoData pageInfo start`);
PeopleShipHomePageDataModel.fetchCreatorInfluenceInfoHotsData(creatorId)
.then((resDTO: ResponseDTO<InfluenceData>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'getCreatorInfluenceInfoData then ArticleCountData is empty');
error('resDTO is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `getCreatorInfluenceInfoData then code:${resDTO.code}, message:${resDTO.message}`);
error(resDTO.message);
return
}
Logger.debug(TAG, "getCreatorInfluenceInfoData then,ArticleCountData.timestamp:" + resDTO.timestamp);
success(resDTO.data);
})
.catch((err: Error) => {
Logger.error(TAG, `getCreatorInfluenceInfoData catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
// 获取关注
static fetchHomePageFollowListStatusData(creatorId: string) {
let url = HttpUrlUtils.getFollowListStatusDataUrl()
let model = new QueryListIsFollowedItem(creatorId)
let object = new FollowListStatusRequestItem()
object.creatorIds = [model]
return WDHttp.post<ResponseDTO<QueryListIsFollowedItem[]>>(url,object)
};
static async getHomePageFollowListStatusData(creatorId: string): Promise<QueryListIsFollowedItem[]> {
Logger.debug(TAG, `getCreatorInfluenceInfoData start`);
return new Promise<QueryListIsFollowedItem[]>((success, error) => {
Logger.debug(TAG, `getCreatorInfluenceInfoData pageInfo start`);
PeopleShipHomePageDataModel.fetchHomePageFollowListStatusData(creatorId)
.then((resDTO: ResponseDTO<QueryListIsFollowedItem[]>) => {
if (!resDTO || !resDTO.data) {
Logger.error(TAG, 'getCreatorInfluenceInfoData then ArticleCountData is empty');
error('resDTO is empty');
return
}
if (resDTO.code != 0) {
Logger.error(TAG, `getCreatorInfluenceInfoData then code:${resDTO.code}, message:${resDTO.message}`);
error(resDTO.message);
return
}
Logger.debug(TAG, "getCreatorInfluenceInfoData then,ArticleCountData.timestamp:" + resDTO.timestamp);
success(resDTO.data);
})
.catch((err: Error) => {
Logger.error(TAG, `getCreatorInfluenceInfoData catch, error.name : ${err.name}, error.message:${err.message}`);
error(err);
})
})
}
}