zhangbo1_wd

接口请求,拆出公共header

Showing 22 changed files with 130 additions and 306 deletions
... ... @@ -95,11 +95,10 @@ export class HttpBizUtil {
let params: HashMap<string, string> = new HashMap<string, string>()
params.set('refreshToken', HttpUrlUtils.getRefreshToken())
params.set('deviceId', HttpUrlUtils.getDeviceId())
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
// Logger.debug(TAG, 'refreshToken getRefreshToken: ' + HttpUrlUtils.getRefreshToken())
// 请求刷新token接口
return new Promise<string>((success, error) => {
WDHttp.post<ResponseDTO<RefreshTokenRes>>(url, params, headers).then((resDTO: ResponseDTO<RefreshTokenRes>) => {
WDHttp.post<ResponseDTO<RefreshTokenRes>>(url, params).then((resDTO: ResponseDTO<RefreshTokenRes>) => {
let newToken = ''
if (resDTO) {
Logger.debug(TAG, 'refreshToken getRefreshToken: ' + resDTO.message)
... ...
... ... @@ -36,7 +36,6 @@ export class HttpParams {
}
headers['userId'] = HttpParams.getUserId()
headers['userType'] = HttpParams.getUserType()
//
headers['mpassid'] = 'ZbHTMeTsfaYDAHqt8ZHIzcPs'
HttpParams.addSpecialHeaders(headers);
return headers;
... ...
... ... @@ -36,8 +36,8 @@ export class HttpRequest {
let commonHeader: AxiosHeaders = new AxiosHeaders()
HttpRequest.globalHeaderProviders.forEach((func) => {
let headers = func();
for (const obj of Object.entries(headers)) {
let getHeaders = func();
for (const obj of Object.entries(getHeaders)) {
commonHeader.set(obj[0], obj[1]);
}
})
... ...
... ... @@ -290,7 +290,11 @@ export class HttpUrlUtils {
private static userType = ''
private static token = ''
static getCommonHeaders(): HashMap<string, string> {
/**
* @deprecated
* @returns
*/
private 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())
... ... @@ -331,7 +335,7 @@ export class HttpUrlUtils {
return headers;
}
static addSpecialHeaders(headers: HashMap<string, string>) {
private static addSpecialHeaders(headers: HashMap<string, string>) {
switch (HostManager.getHost()) {
case HostEnum.HOST_UAT:
// TODO 待优化到常量类里
... ... @@ -359,7 +363,7 @@ export class HttpUrlUtils {
}
}
static setLocationHeader(headers: HashMap<string, string>) {
private static setLocationHeader(headers: HashMap<string, string>) {
let cityName = SPHelper.default.getSync(SpConstants.LOCATION_CITY_NAME, '') as string
if (StringUtils.isNotEmpty(cityName)) {
headers.set('city', encodeURI(cityName))
... ... @@ -851,44 +855,6 @@ export class HttpUrlUtils {
return url;
}
// static getYcgCommonHeaders(): HashMap<string, string> {
// let headers: HashMap<string, string> = new HashMap<string, string>()
//
// headers.set('mpassid', 'XGt6jfGUx8ADAKruTyAMdhHj')
// headers.set('city', "%E5%90%88%E8%82%A5%E5%B8%82")
// headers.set('User-Agent', 'Dalvik/2.1.0 (Linux; U; Android 10; PCT-AL10 Build/HUAWEIPCT-AL10)')
// headers.set('channel', "rmrb_china_0000")
// headers.set('appCode', "0af1f9085e484c97b2a44704bae72c07")
// headers.set('Authorization', "APPCODE 0af1f9085e484c97b2a44704bae72c07")
// headers.set('X-Ca-Stage', "TEST")
// headers.set('plat', "Phone")
// headers.set('Content-Type', 'application/json; charset=utf-8')
// headers.set('timestamp', "740977741")
// headers.set('RMRB-X-TOKEN', "eyJhbGciOiJIUzI1NiIsImtpZCI6IklFazBGclhfV2RYMEx1ZktDU01iYTVYd0VmUHZ6a043T0F5UTRFLWIwWU0ifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcxMDc1NjM3NywidXNlcklkIjo1NjczODc0NzcwNjM2MjEsInVzZXJWZXJzaW9uIjoiNTY3Mzg3NDc3MDYzNjIxXzAiLCJ1c2VyTmFtZSI6IiVFNCVCQSVCQSVFNiVCMCU5MSVFNiU5NyVBNSVFNiU4QSVBNSVFNyVCRCU5MSVFNSU4RiU4QmFQcnRxNSIsInVzZXJUeXBlIjoxLCJjcmVhdG9ySWQiOm51bGwsInVzZXJJZFpoIjpudWxsfQ.KBkF0Yki-JWlq0ZIOCzgKwQc1ycBnFHa6CF-rMPRgHU")
// headers.set('device_id', "5156098c-6c44-3514-af70-04a0139a9327")
// // headers.set('cookie', 'RMRB-X-TOKEN=eyJhbGciOiJIUzI1NiIsImtpZCI6IklFazBGclhfV2RYMEx1ZktDU01iYTVYd0VmUHZ6a043T0F5UTRFLWIwWU0ifQ.eyJpc3MiOiJwZW9wbGVzLWRhaWx5LWZvdXJhIiwic3ViIjoicGVvcGxlcy1kYWlseS1mb3VyYSIsImV4cCI6MTcxMDU4Mzk0MywidXNlcklkIjo1NjczODc0NzcwNjM2MjEsInVzZXJWZXJzaW9uIjoiNTY3Mzg3NDc3MDYzNjIxXzAiLCJ1c2VyTmFtZSI6IiVFNCVCQSVCQSVFNiVCMCU5MSVFNiU5NyVBNSVFNiU4QSVBNSVFNyVCRCU5MSVFNSU4RiU4QmFQcnRxNSIsInVzZXJUeXBlIjoxLCJjcmVhdG9ySWQiOm51bGwsInVzZXJJZFpoIjpudWxsfQ._LTKrUxQozpCj1XMhx1TWOIxn5gjDveoPuMFGpI0g_8')
// headers.set('build_version', "202403112023")
// headers.set('adcode', "340000")
// headers.set('os_version', "10")
// headers.set('city_dode', "340100")
// headers.set('userId', "567387477063621")
// headers.set('versionCode', "7302")
// headers.set('system', "Android")
// headers.set('version_name', "7.3.0.2")
// headers.set('EagleEye-TraceID', '101118E4D006453DA549A82AA8CAFBFE')
// headers.set('imei', "5156098c-6c44-3514-af70-04a0139a9327")
// headers.set('userType', "1")
// headers.set('Accept-Language', 'zh')
//
// // HttpUrlUtils.addSpecialHeaders(headers);
// // Logger.debug("TAG", '******************* commonHeaders headers start ******************************** ');
// // headers.forEach((v,k)=>{
// // Logger.debug("TAG", 'getCommonHeaders header: ' + k + ': ' + v);
// // })
// // Logger.debug("TAG", '******************* commonHeaders headers end ******************************** ');
// return headers;
// }
public static setUserId(userId: string) {
HttpUrlUtils.userId = userId;
}
... ...
import HashMap from '@ohos.util.HashMap';
import { Message } from 'wdJsBridge/src/main/ets/bean/Message';
import { H5ReceiveDataJsonBean, postBatchAttentionStatusResult } from 'wdBean';
import { ResponseDTO, WDHttp, HttpUrlUtils } from 'wdNetwork';
... ... @@ -7,7 +6,6 @@ const TAG = 'JsCallAppService'
export function handleJsCallAppService(data: Message, callback: (res: string) => void) {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
let url: string = HttpUrlUtils.getHost() + data?.data?.url
let responseMap: ResponseDTO<postBatchAttentionStatusResult> = {} as ResponseDTO<postBatchAttentionStatusResult>
... ... @@ -23,7 +21,7 @@ export function handleJsCallAppService(data: Message, callback: (res: string) =>
// })
// }
if (data?.data?.method === 'post' && data?.data?.url === '/api/rmrb-interact/interact/zh/c/batchAttention/status') {
WDHttp.post<ResponseDTO<postBatchAttentionStatusResult>>(url, data?.data?.parameters, headers).then((res: ResponseDTO<postBatchAttentionStatusResult>) => {
WDHttp.post<ResponseDTO<postBatchAttentionStatusResult>>(url, data?.data?.parameters).then((res: ResponseDTO<postBatchAttentionStatusResult>) => {
h5ReceiveDataJson.responseMap = res
callback(JSON.stringify(h5ReceiveDataJson))
})
... ...
import { DateTimeUtils, Logger, ResourcesUtils, ToastUtils, UserDataLocal } from 'wdKit/Index';
import { DateTimeUtils, Logger, ToastUtils, UserDataLocal } from 'wdKit/Index';
import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import {
... ... @@ -8,8 +8,6 @@ import {
commentStatusModel,
WDPublicUserType
} from '../model/CommentModel';
import HashMap from '@ohos.util.HashMap';
import { ifaa } from '@kit.OnlineAuthenticationKit';
import { publishCommentModel } from '../model/PublishCommentModel';
const TAG = "CommentViewModel"
... ... @@ -34,9 +32,8 @@ class CommentViewModel {
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)}`
url = url.replace(' ', '%20')
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<commentListModel>((success, fail) => {
HttpRequest.get<ResponseDTO<commentListModel>>(url, headers).then((data: ResponseDTO<commentListModel>) => {
HttpRequest.get<ResponseDTO<commentListModel>>(url).then((data: ResponseDTO<commentListModel>) => {
if (!data || !data.data) {
fail("数据为空")
return
... ... @@ -65,9 +62,8 @@ class CommentViewModel {
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)}`
url = url.replace(' ', '%20')
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<commentListModel>((success, fail) => {
HttpRequest.get<ResponseDTO<commentListModel>>(url, headers).then((data: ResponseDTO<commentListModel>) => {
HttpRequest.get<ResponseDTO<commentListModel>>(url).then((data: ResponseDTO<commentListModel>) => {
if (!data || !data.data) {
fail("数据为空")
return
... ... @@ -95,9 +91,8 @@ class CommentViewModel {
/*获取热门评论*/
fetchQualityCommentList(pageNum: string): Promise<commentListModel> {
let url = HttpUrlUtils.getQualityCommentUrl() + `?&pageSize=${10}&pageNum=${pageNum}`
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<commentListModel>((success, fail) => {
HttpRequest.get<ResponseDTO<commentListModel>>(url, headers).then((data: ResponseDTO<commentListModel>) => {
HttpRequest.get<ResponseDTO<commentListModel>>(url).then((data: ResponseDTO<commentListModel>) => {
if (!data || !data.data) {
fail("数据为空")
return
... ... @@ -125,7 +120,6 @@ class CommentViewModel {
return new Promise<void>((success, fail) => {
let url = HttpUrlUtils.getCommentLikeUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
let bean: Record<string, string> = {};
// commentId number
... ... @@ -148,7 +142,7 @@ class CommentViewModel {
bean['userName'] = UserDataLocal.getUserId();
bean['userHeaderUrl'] = UserDataLocal.getUserHeaderUrl();
HttpBizUtil.post<ResponseDTO<commentStatusModel[]>>(url, bean, headers).then((data: ResponseDTO<commentStatusModel[]>) => {
HttpBizUtil.post<ResponseDTO<commentStatusModel[]>>(url, bean).then((data: ResponseDTO<commentStatusModel[]>) => {
if (data.code != 0) {
fail()
return
... ... @@ -166,7 +160,6 @@ class CommentViewModel {
return new Promise<commentItemModel>((success, fail) => {
let url = HttpUrlUtils.getPublishCommentUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
let bean: Record<string, string> = {};
bean['targetId'] = model.targetId;
... ... @@ -182,7 +175,7 @@ class CommentViewModel {
bean['targetType'] = model.targetType
bean['parentId'] = model.parentId
HttpRequest.post<ResponseDTO<commentItemModel>>(url, bean, headers).then((data: ResponseDTO<commentItemModel>) => {
HttpRequest.post<ResponseDTO<commentItemModel>>(url, bean).then((data: ResponseDTO<commentItemModel>) => {
if (data.code != 0) {
ToastUtils.showToast(data.message, 1000);
fail()
... ... @@ -246,10 +239,9 @@ class CommentViewModel {
let promise1 = new Promise<void>((success) => {
// HttpRequest HttpBizUtil
let url = HttpUrlUtils.getBatchCommentStatusUrl();
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
let bean: Record<string, string[]> = {};
bean['commentIdList'] = commentIDs;
HttpRequest.post<ResponseDTO<commentStatusModel[]>>(url, bean, headers).then((data: ResponseDTO<commentStatusModel[]>) => {
HttpRequest.post<ResponseDTO<commentStatusModel[]>>(url, bean).then((data: ResponseDTO<commentStatusModel[]>) => {
if (!data || !data.data) {
success()
return
... ... @@ -290,9 +282,8 @@ class CommentViewModel {
if (fromUserIDs.length > 0) {
let promise2 = new Promise<void>((success) => {
let url = HttpUrlUtils.getBatchUserUrl();
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
// HttpRequest HttpBizUtil
HttpRequest.post<ResponseDTO<commentStatusModel[]>>(url, fromUserIDs, headers).then((data: ResponseDTO<commentStatusModel[]>) => {
HttpRequest.post<ResponseDTO<commentStatusModel[]>>(url, fromUserIDs).then((data: ResponseDTO<commentStatusModel[]>) => {
if (!data || !data.data) {
success()
return
... ... @@ -334,11 +325,10 @@ class CommentViewModel {
if (creatorIDs.length > 0) {
let promise3 = new Promise<void>((success) => {
let url = HttpUrlUtils.getDetailListUrl();
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
let bean: Record<string, string[]> = {};
bean['creatorIdList'] = creatorIDs;
// HttpRequest HttpBizUtil
HttpRequest.post<ResponseDTO<commentStatusModel[]>>(url, bean, headers).then((data: ResponseDTO<commentStatusModel[]>) => {
HttpRequest.post<ResponseDTO<commentStatusModel[]>>(url, bean).then((data: ResponseDTO<commentStatusModel[]>) => {
if (!data || !data.data) {
success()
return
... ...
import { HashMap } from '@kit.ArkTS';
import { Logger } from 'wdKit/Index';
import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
export class LikeModel {
executeLike(data: Record<string, string>) {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<object>((success, fail) => {
HttpBizUtil.post<ResponseDTO<object>>(HttpUrlUtils.executeLike(), data, headers).then((data: ResponseDTO<object>) => {
HttpBizUtil.post<ResponseDTO<object>>(HttpUrlUtils.executeLike(), data).then((data: ResponseDTO<object>) => {
if (data.code != 0) {
fail(data.message)
return
... ... @@ -23,12 +19,11 @@ export class LikeModel {
getLikeStatus(data: Record<string, string>) {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
let model : Record<string,Record<string,string>[]> = {}
model['contentList'] = [data]
return new Promise<object>((success, fail) => {
HttpBizUtil.post<ResponseDTO<object>>(HttpUrlUtils.getLikeStatus(), model, headers).then((data: ResponseDTO<object>) => {
HttpBizUtil.post<ResponseDTO<object>>(HttpUrlUtils.getLikeStatus(), model).then((data: ResponseDTO<object>) => {
if (data.code != 0) {
fail(data.message)
return
... ... @@ -44,14 +39,13 @@ export class LikeModel {
getLikeCount(data: Record<string, string>) {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
let channelId : string = data['channelId']
let contentId : string = data['contentId']
let contentType : string = data['contentType']
let detail : string = '1'
let url = HttpUrlUtils.getLikeCount() + `?channelId=${channelId}&contentId=${contentId}&contentType=${contentType}&detail=${detail}`
return new Promise<object>((success, fail) => {
HttpBizUtil.get<ResponseDTO<object>>(url, headers).then((data: ResponseDTO<object>) => {
HttpBizUtil.get<ResponseDTO<object>>(url).then((data: ResponseDTO<object>) => {
if (data.code != 0) {
fail(data.message)
return
... ...
import HashMap from '@ohos.util.HashMap';
import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork';
export class LogoutModel{
... ... @@ -6,9 +5,8 @@ export class LogoutModel{
requestLogout(){
let bean: Record<string, string> = {};
bean['refreshToken'] = HttpUrlUtils.getRefreshToken()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<string>((success, fail) => {
HttpBizUtil.post<ResponseDTO<string>>(HttpUrlUtils.accountLogoutUrl(), bean, headers).then((data: ResponseDTO<string>) => {
HttpBizUtil.post<ResponseDTO<string>>(HttpUrlUtils.accountLogoutUrl(), bean).then((data: ResponseDTO<string>) => {
if (!data) {
fail("数据为空")
return
... ...
... ... @@ -2,10 +2,9 @@
import MinePagePersonalFunctionsItem from '../viewmodel/MinePagePersonalFunctionsItem'
import MinePageCreatorFunctionsItem from '../viewmodel/MinePageCreatorFunctionsItem'
import MinePageMoreFunctionModel from '../viewmodel/MinePageMoreFunctionModel';
import HashMap from '@ohos.util.HashMap';
import { HttpBizUtil, HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { MineAppointmentListItem } from '../viewmodel/MineAppointmentListItem';
import { Logger, ResourcesUtils, StringUtils } from 'wdKit';
import { Logger, StringUtils } from 'wdKit';
import { MineFollowListDetailItem } from '../viewmodel/MineFollowListDetailItem';
import { FollowListDetailRequestItem } from '../viewmodel/FollowListDetailRequestItem';
import { FollowListItem } from '../viewmodel/FollowListItem';
... ... @@ -109,8 +108,7 @@ class MinePageDatasModel{
*/
fetchAppointmentListData(pageSize:string,pageNum:string) {
let url = HttpUrlUtils.getAppointmentListDataUrl()+ `?pageSize=${pageSize}&pageNum=${pageNum}`
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<MineAppointmentListItem>>(url, headers)
return WDHttp.get<ResponseDTO<MineAppointmentListItem>>(url)
};
getAppointmentListData(pageSize:string,pageNum:string,context: Context): Promise<MineAppointmentListItem> {
... ... @@ -158,8 +156,7 @@ class MinePageDatasModel{
fetchFollowListDetailData(object:FollowListDetailRequestItem) {
let url = HttpUrlUtils.getFollowListDetailDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO<MineFollowListDetailItem>>(url, object,headers)
return WDHttp.post<ResponseDTO<MineFollowListDetailItem>>(url, object)
};
/**
... ... @@ -168,8 +165,7 @@ class MinePageDatasModel{
*/
fetchFollowListData() {
let url = HttpUrlUtils.getFollowListDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<FollowListItem[]>>(url, headers)
return WDHttp.get<ResponseDTO<FollowListItem[]>>(url)
};
getFollowListData(context: Context): Promise<FollowListItem[]> {
... ... @@ -217,8 +213,7 @@ class MinePageDatasModel{
fetchMineDetailFollowListData(object:FollowListDetailRequestItem) {
let url = HttpUrlUtils.getMineFollowListDataUrl()+`?pageSize=${object.pageSize}&pageNum=${object.pageNum}`
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<MineFollowListItem>>(url, headers)
return WDHttp.get<ResponseDTO<MineFollowListItem>>(url)
};
/**
... ... @@ -247,8 +242,7 @@ class MinePageDatasModel{
fetchFollowListStatusData(object:FollowListStatusRequestItem) {
let url = HttpUrlUtils.getFollowListStatusDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO<QueryListIsFollowedItem[]>>(url,object, headers)
return WDHttp.post<ResponseDTO<QueryListIsFollowedItem[]>>(url,object)
};
/**
... ... @@ -277,8 +271,7 @@ class MinePageDatasModel{
fetchMineCommentListData(time:string,object:FollowListDetailRequestItem) {
let url = HttpUrlUtils.getMineCommentListDataUrl()+`?pageSize=${object.pageSize}&pageNum=${object.pageNum}&time=${time}`
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<MineCommentListDetailItem>>(url, headers)
return WDHttp.get<ResponseDTO<MineCommentListDetailItem>>(url)
};
... ... @@ -305,9 +298,8 @@ class MinePageDatasModel{
fetchMineUserLevelData() {
let url = HttpUrlUtils.getMineUserLevelDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
// return WDHttp.get<ResponseDTO<MineUserLevelItem>>(url, headers)
return HttpBizUtil.get<ResponseDTO<MineUserLevelItem>>(url, headers)
return HttpBizUtil.get<ResponseDTO<MineUserLevelItem>>(url)
};
/**
... ... @@ -333,9 +325,8 @@ class MinePageDatasModel{
fetchMineUserDetailData() {
let url = HttpUrlUtils.getMineUserDetailDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
// return WDHttp.get<ResponseDTO<MineUserDetailItem>>(url, headers)
return HttpBizUtil.get<ResponseDTO<MineUserDetailItem>>(url, headers)
return HttpBizUtil.get<ResponseDTO<MineUserDetailItem>>(url)
};
... ... @@ -362,8 +353,7 @@ class MinePageDatasModel{
fetchOtherUserDetailData(item:OtherUserDetailRequestItem) {
let url = HttpUrlUtils.getOtherUserDetailDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO<MineUserDetailItem>>(url, item,headers)
return WDHttp.post<ResponseDTO<MineUserDetailItem>>(url, item)
};
/**
... ... @@ -393,8 +383,7 @@ class MinePageDatasModel{
fetchOtherUserLevelData(item:string[]) {
let url = HttpUrlUtils.getOtherUserLevelDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO<MineUserLevelItem[]>>(url,item, headers)
return WDHttp.post<ResponseDTO<MineUserLevelItem[]>>(url,item)
};
/**
... ... @@ -423,8 +412,7 @@ class MinePageDatasModel{
fetchOtherCommentListData(object:OtherUserCommentListRequestItem) {
let url = HttpUrlUtils.getOtherCommentListDataUrl()+`?pageSize=${object.pageSize}&pageNum=${object.pageNum}&creatorId=${object.creatorId}&time=${object.time}&userType=${object.userType}&userId=${object.userId}`
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<MineCommentListDetailItem>>(url, headers)
return WDHttp.get<ResponseDTO<MineCommentListDetailItem>>(url)
};
... ... @@ -454,8 +442,7 @@ class MinePageDatasModel{
fetchOtherUserCommentLikeStatusData(object:OtherUserCommentLikeStatusRequestItem) {
let url = HttpUrlUtils.getCommentListStatusDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO<QueryCommentListIsLikedItem[]>>(url,object, headers)
return WDHttp.post<ResponseDTO<QueryCommentListIsLikedItem[]>>(url,object)
};
/**
... ... @@ -484,8 +471,7 @@ class MinePageDatasModel{
fetchOtherUserFollowListData(object:UserFollowListRequestItem) {
let url = HttpUrlUtils.getOtherUserFollowListDataUrl()+`?pageSize=${object.pageSize}&pageNum=${object.pageNum}&queryUserId=${object.queryUserId}&userType=${object.userType}&userId=${HttpUrlUtils.getUserId()}`
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<MineFollowListItem>>(url, headers)
return WDHttp.get<ResponseDTO<MineFollowListItem>>(url)
};
/**
... ... @@ -513,8 +499,7 @@ class MinePageDatasModel{
fetchAppointmentOperation(object:AppointmentOperationRequestItem) {
let url = HttpUrlUtils.getAppointmentOperationUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO>(url,object, headers)
return WDHttp.post<ResponseDTO>(url,object)
};
/**
... ... @@ -542,8 +527,7 @@ class MinePageDatasModel{
fetchCommentLikeOperation(object:CommentLikeOperationRequestItem) {
let url = HttpUrlUtils.getCommentLikeOperationUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO>(url,object, headers)
return WDHttp.post<ResponseDTO>(url,object)
};
/**
... ... @@ -571,8 +555,7 @@ class MinePageDatasModel{
fetchFollowOperation(object:FollowOperationRequestItem) {
let url = HttpUrlUtils.getFollowOperationUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO>(url,object, headers)
return WDHttp.post<ResponseDTO>(url,object)
};
... ...
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
import HashMap from '@ohos.util.HashMap';
import { Permissions } from '@ohos.abilityAccessCtrl';
import { HttpUrlUtils, ResponseDTO } from 'wdNetwork';
import { Logger } from 'wdKit';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import EditInfoViewModel from '../viewmodel/EditInfoViewModel';
import { editModel } from './EditInfoModel';
... ... @@ -25,9 +23,8 @@ export class PrivacySettingModel{
// EditInfoViewModel
let bean: Record<string, string> = {};
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<editModel>((success, fail) => {
HttpRequest.get<ResponseDTO<editModel>>(HttpUrlUtils.queryUserDetail(), headers).then((data: ResponseDTO<editModel>) => {
HttpRequest.get<ResponseDTO<editModel>>(HttpUrlUtils.queryUserDetail()).then((data: ResponseDTO<editModel>) => {
if (!data || !data.data) {
fail("数据为空")
return
... ... @@ -50,9 +47,8 @@ export class PrivacySettingModel{
editUserDetail(airec:string) {
let bean: Record<string, string> = {};
bean['airec'] = airec;
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<string>((success, fail) => {
HttpRequest.post<ResponseDTO<string>>(HttpUrlUtils.editUserDetail(), bean, headers).then((data: ResponseDTO<string>) => {
HttpRequest.post<ResponseDTO<string>>(HttpUrlUtils.editUserDetail(), bean).then((data: ResponseDTO<string>) => {
if (!data || !data.data) {
fail("数据为空")
return
... ...
import { Logger, ResourcesUtils, SPHelper, UserDataLocal } from 'wdKit';
import { Logger, SPHelper, UserDataLocal } from 'wdKit';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import HashMap from '@ohos.util.HashMap';
import { SearchHistoryItem } from '../viewmodel/SearchHistoryItem';
import { SearchHotContentItem } from '../viewmodel/SearchHotContentItem';
import { SearchResultCountItem } from '../viewmodel/SearchResultCountItem';
... ... @@ -115,8 +114,7 @@ class SearcherAboutDataModel{
fetchSearchHintData() {
let url = HttpUrlUtils.getSearchHintDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<string[]>>(url, headers)
return WDHttp.get<ResponseDTO<string[]>>(url)
};
... ... @@ -143,8 +141,7 @@ class SearcherAboutDataModel{
fetchSearchHotsData() {
let url = HttpUrlUtils.getSearchHotsDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<SearchHotContentItem[]>>(url, headers)
return WDHttp.get<ResponseDTO<SearchHotContentItem[]>>(url)
};
/**
... ... @@ -170,8 +167,7 @@ class SearcherAboutDataModel{
fetchRelatedSearchContentData(keyword:string) {
let url = HttpUrlUtils.getRelatedSearchContentDataUrl()+ keyword
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<string[]>>(url, headers)
return WDHttp.get<ResponseDTO<string[]>>(url)
};
/**
... ... @@ -197,8 +193,7 @@ class SearcherAboutDataModel{
fetchSearchResultCountData(keyword:string) {
let url = HttpUrlUtils.getSearchResultCountDataUrl() + keyword
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<SearchResultCountItem>>(url, headers)
return WDHttp.get<ResponseDTO<SearchResultCountItem>>(url)
};
/**
... ... @@ -224,8 +219,7 @@ class SearcherAboutDataModel{
fetchSearchResultListData(pageSize:string,pageNum:string,searchType:string,keyword:string) {
let url = HttpUrlUtils.getSearchResultListDataUrl() + `?pageSize=${pageSize}&pageNum=${pageNum}&searchType=${searchType}&keyword=${keyword}`
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<SearchResultContentData>>(url, headers)
return WDHttp.get<ResponseDTO<SearchResultContentData>>(url)
};
/**
... ... @@ -251,8 +245,7 @@ class SearcherAboutDataModel{
fetchInteractListData(data : contentListParams) {
let url = HttpUrlUtils.getInteractListDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO<InteractDataDTO[]>>(url,data, headers)
return WDHttp.post<ResponseDTO<InteractDataDTO[]>>(url,data)
};
/**
... ... @@ -278,8 +271,7 @@ class SearcherAboutDataModel{
fetchCreatorDetailListData(object:CreatorDetailRequestItem) {
let url = HttpUrlUtils.getCreatorDetailListDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO<CreatorDetailResponseItem[]>>(url,object, headers)
return WDHttp.post<ResponseDTO<CreatorDetailResponseItem[]>>(url,object)
};
/**
... ... @@ -305,8 +297,7 @@ class SearcherAboutDataModel{
fetchSearchSuggestData(object:SearchSuggestRequestItem) {
let url = HttpUrlUtils.getSearchSuggestDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO<ContentDTO[]>>(url,object, headers)
return WDHttp.post<ResponseDTO<ContentDTO[]>>(url,object)
};
}
... ...
import HashMap from '@ohos.util.HashMap';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { DateTimeUtils, Logger, StringUtils } from 'wdKit';
import {
... ... @@ -209,8 +208,7 @@ export class PageRepository {
static fetchNavigationDataApi() {
let url = PageRepository.getBottomNavGroupUrl();
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<NavigationBodyDTO>>(url, headers)
return WDHttp.get<ResponseDTO<NavigationBodyDTO>>(url)
};
/**
... ... @@ -224,57 +222,48 @@ export class PageRepository {
*/
static fetchMorningEveningPaperData(pageId: string) {
let url = PageRepository.getPageInfoUrl(pageId)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<MorningEveningPaperDTO>>(url, headers)
return WDHttp.get<ResponseDTO<MorningEveningPaperDTO>>(url)
};
static fetchPageUrlData(pageId: string) {
let url = PageRepository.getPageUrl(pageId)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<PageInfoBean>>(url, headers)
return WDHttp.get<ResponseDTO<PageInfoBean>>(url)
}
static fetchPageData(pageId: string) {
let url = PageRepository.getPageInfoUrl(pageId)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<PageInfoDTO>>(url, headers)
return WDHttp.get<ResponseDTO<PageInfoDTO>>(url)
};
static fetchCompData(pageBean: PageUIReqBean) {
let url = PageRepository.getCompInfoUrl(pageBean)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<PageDTO>>(url, headers)
return WDHttp.get<ResponseDTO<PageDTO>>(url)
};
static fetchRecCompData(pageBean: PageUIReqBean) {
let url = PageRepository.getRecCompInfoUrl(pageBean)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<PageDTO>>(url, headers)
return WDHttp.get<ResponseDTO<PageDTO>>(url)
};
static fetchDetailData(relId: string, contentId: string, relType: string) {
let url = PageRepository.getDetailInfoUrl(relId, contentId, relType)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<ContentDetailDTO[]>>(url, headers)
return WDHttp.get<ResponseDTO<ContentDetailDTO[]>>(url)
};
static fetchInteractDataV2(contentId: string, contentType: string, contentRelId: string,rmhPlatform:number) {
let url = PageRepository.getInteractDataV2Url(contentId, contentType, contentRelId,rmhPlatform)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<InteractDataDTO>>(url, headers)
return WDHttp.get<ResponseDTO<InteractDataDTO>>(url)
};
static fetchInteractData(param: object) {
let url = PageRepository.getInteractDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO<InteractDataDTO[]>>(url, param, headers)
return WDHttp.post<ResponseDTO<InteractDataDTO[]>>(url, param)
};
// 批量查询内容当前用户点赞、收藏状态
static fetchInteractDataStatus(param: object) {
let url = PageRepository.getInteractDataStatusUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO<batchLikeAndCollectResult[]>>(url, param, headers)
return WDHttp.post<ResponseDTO<batchLikeAndCollectResult[]>>(url, param)
};
/**
... ... @@ -284,8 +273,7 @@ export class PageRepository {
*/
static postExecuteLike(params: postExecuteLikeParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_EXECUTELIKE
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post(url, params, headers)
return WDHttp.post(url, params)
}
/**
... ... @@ -295,8 +283,7 @@ export class PageRepository {
*/
static postExecuteCollectRecord(params: postExecuteCollectRecordParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_EXECUTECOLLECTRECORD
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post(url, params, headers)
return WDHttp.post(url, params)
}
/**
... ... @@ -305,15 +292,13 @@ export class PageRepository {
*/
static getContentInteract(params: contentListParams): Promise<ResponseDTO<InteractDataDTO[]>> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_PATH
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post(url, params, headers)
return WDHttp.post(url, params)
}
// 浏览历史新增、删除接口
static fetchInteractBrowsOperate(param: object) {
let url = PageRepository.getInteractBrowsOperateUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO<null>>(url, param, headers)
return WDHttp.post<ResponseDTO<null>>(url, param)
};
/**
... ... @@ -322,8 +307,7 @@ export class PageRepository {
*/
static fetchBatchAttentionStatus(params: postBatchAttentionStatusParams): Promise<ResponseDTO<postBatchAttentionStatusResult[]>> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.FOLLOW_LIST_STATUS_DATA_PATH
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post(url, params, headers)
return WDHttp.post(url, params)
}
/**
... ... @@ -331,20 +315,17 @@ export class PageRepository {
*/
static postInteractAccentionOperate(params: postInteractAccentionOperateParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post(url, params, headers)
return WDHttp.post(url, params)
}
static fetchNewspaperInfo(date: string) {
let url = PageRepository.getNewspaperInfoUrl(date)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<NewspaperTimeInfoBean[]>>(url, headers)
return WDHttp.get<ResponseDTO<NewspaperTimeInfoBean[]>>(url)
};
static fetchNewspaperList(date: string, pageSize: string) {
let url = PageRepository.getNewspaperListUrl(date, pageSize)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<NewspaperListBean>>(url, headers)
return WDHttp.get<ResponseDTO<NewspaperListBean>>(url)
};
/**
... ... @@ -352,8 +333,7 @@ export class PageRepository {
* */
static fetchMorningEveningPageInfo(pageId: string) {
let url = PageRepository.getMorningEveningPageInfoUrl(pageId)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<PageInfoBean>>(url, headers)
return WDHttp.get<ResponseDTO<PageInfoBean>>(url)
};
/**
... ... @@ -361,8 +341,7 @@ export class PageRepository {
* */
static fetchMorningEveningCompInfo(pageId: number, groupId: number, refreshTime: string, topicId: string, pageNum: number, pageSize: number) {
let url = PageRepository.getMorningEveningCompInfoUrl(pageId, groupId, refreshTime, topicId, pageNum, pageSize)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<CompInfoBean>>(url, headers)
return WDHttp.get<ResponseDTO<CompInfoBean>>(url)
};
/**
... ... @@ -370,8 +349,7 @@ export class PageRepository {
* */
static fetchDailyPaperTopic() {
let url = PageRepository.getDailyPaperTopic()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<PageInfoBean>>(url, headers)
return WDHttp.get<ResponseDTO<PageInfoBean>>(url)
};
/**
... ... @@ -379,8 +357,7 @@ export class PageRepository {
* */
static fetchBroadcastPageInfo(pageId: string) {
let url = PageRepository.getMorningEveningPageInfoUrl(pageId)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<PageInfoBean>>(url, headers)
return WDHttp.get<ResponseDTO<PageInfoBean>>(url)
};
/**
... ... @@ -394,8 +371,7 @@ export class PageRepository {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.MORNING_EVENING_COMP_INFO_PATH;
url = `${url}?topicId=${topicId}&channelStrategy=2&groupId=${groupId}&refreshTime=${refreshTime}&pageSize=50&recommend=0&pageId=${pageId}&loadStrategy=first_load&pageNum=1&channelId=${channelId}`
Logger.info(TAG, "getMorningEveningCompInfoUrl url = " + url)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<CompInfoBean>>(url, headers)
return WDHttp.get<ResponseDTO<CompInfoBean>>(url)
};
/**
... ... @@ -403,8 +379,7 @@ export class PageRepository {
* */
static fetchLiveReviewUrl(pageNum: number, pageSize: number) {
let url = PageRepository.getLiveReviewUrl(pageNum, pageSize)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<LiveReviewDTO>>(url, headers)
return WDHttp.get<ResponseDTO<LiveReviewDTO>>(url)
};
/**
... ... @@ -412,8 +387,7 @@ export class PageRepository {
* */
static fetchLiveMoreUrl(type: number,pageNum: number, pageSize: number) {
let url = PageRepository.getLiveMoreUrl(type,pageNum, pageSize)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<LiveReviewDTO>>(url, headers)
return WDHttp.get<ResponseDTO<LiveReviewDTO>>(url)
};
/**
... ... @@ -424,9 +398,8 @@ export class PageRepository {
* */
static postRecommendList(params: postRecommendListParams) {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.RECOMMEND_LIST
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
Logger.info(TAG, "postRecommendList url = " + url + JSON.stringify(params))
return WDHttp.post<ResponseDTO<ContentDTO[]>>(url, params, headers)
return WDHttp.post<ResponseDTO<ContentDTO[]>>(url, params)
};
static getPageUrl(pageId: string) {
... ... @@ -443,8 +416,7 @@ export class PageRepository {
* */
static postThemeList(params: postThemeListParams) {
let url = HttpUrlUtils.getThemeListUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
Logger.info(TAG, "postThemeList url = " + url + JSON.stringify(params))
return WDHttp.post<ResponseDTO<LiveReviewDTO>>(url, params, headers)
return WDHttp.post<ResponseDTO<LiveReviewDTO>>(url, params)
};
}
... ...
... ... @@ -2,7 +2,6 @@
import {
editItem,
EditListInfo, editModel, editModelParams, WDEditDataModelType } from '../model/EditInfoModel';
import HashMap from '@ohos.util.HashMap';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { Logger, ResourcesUtils } from 'wdKit';
import { AreaListManageModel, AreaListModel } from '../model/AreaListModel';
... ... @@ -26,15 +25,13 @@ class EditInfoViewModel {
}
BaseGetRequest(requestUrl:string){
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders()
requestUrl = HttpUrlUtils.getHost() + requestUrl
return WDHttp.get<editItem>(requestUrl,headers)
return WDHttp.get<editItem>(requestUrl)
}
BasePostRequest(requestUrl:string,params: object){
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders()
requestUrl = HttpUrlUtils.getHost() + requestUrl
return WDHttp.post<ResponseDTO>(requestUrl,params,headers)
return WDHttp.post<ResponseDTO>(requestUrl,params)
}
... ...
import HashMap from '@ohos.util.HashMap';
import { HttpUrlUtils, ResponseDTO } from 'wdNetwork';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import { Logger, ToastUtils } from 'wdKit';
... ... @@ -15,11 +14,10 @@ export class LiveModel {
* @returns
*/
static getLiveDetails(contentId: string, relId: string, relType: string) {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<Array<LiveDetailsBean>>((success, fail) => {
HttpRequest.get<ResponseDTO<Array<LiveDetailsBean>>>(
HttpUrlUtils.getLiveDetailsUrl() + `?relId=${relId}&relType=${relType}&contentId=${contentId}`,
headers).then((data: ResponseDTO<Array<LiveDetailsBean>>) => {
).then((data: ResponseDTO<Array<LiveDetailsBean>>) => {
if (!data || !data.data) {
fail("数据为空")
return
... ... @@ -48,12 +46,11 @@ export class LiveModel {
params['relationId'] = relationId
params['liveId'] = liveId
params['isSubscribe'] = `${isSubscribe}`
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<ResponseDTO<string>>((success, fail) => {
HttpRequest.post<ResponseDTO<string>>(
HttpUrlUtils.getLiveAppointmentUrl(),
params,
headers).then((data: ResponseDTO<string>) => {
).then((data: ResponseDTO<string>) => {
if (data.code != 0) {
fail(data.message)
ToastUtils.shortToast(data.message)
... ... @@ -77,12 +74,11 @@ export class LiveModel {
static getAppointmentStatus(reserveBean: ReserveBean[]) {
// let params: Record<string, ArrayList<ReserveBean>> = {};
// params = reserveBean
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<ResponseDTO<string>>((success, fail) => {
HttpRequest.post<ResponseDTO<string>>(
HttpUrlUtils.getAppointmentStatusUrl(),
reserveBean,
headers).then((data: ResponseDTO<string>) => {
).then((data: ResponseDTO<string>) => {
if (data.code != 0) {
fail(data.message)
ToastUtils.shortToast(data.message)
... ...
import { collcetRecordParams, MyCollectionItem, MyCollectionListModel } from '../model/MyCollectionModel';
import HashMap from '@ohos.util.HashMap';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { Logger, ResourcesUtils } from 'wdKit';
import { PageDTO } from 'wdBean';
import { Logger } from 'wdKit';
import promptAction from '@ohos.promptAction';
const TAG = "MyCollectionViewModel"
... ... @@ -27,8 +25,7 @@ class MyCollectionViewModel {
// if (tagId.length > 0) {
// url = url + `&tagId=${tagId}`
// }
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders()
return WDHttp.get<MyCollectionListModel>(url, headers)
return WDHttp.get<MyCollectionListModel>(url)
}
... ... @@ -50,8 +47,7 @@ class MyCollectionViewModel {
//收藏/取消收藏 status :收藏状态 1添加收藏 0取消收藏
executeCollcet(params: collcetRecordParams):Promise<ResponseDTO>{
return new Promise(() => {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders()
WDHttp.post<ResponseDTO>(HttpUrlUtils.getExecuteCollcetUrl(),params,headers).then((navResDTO: ResponseDTO) => {
WDHttp.post<ResponseDTO>(HttpUrlUtils.getExecuteCollcetUrl(),params).then((navResDTO: ResponseDTO) => {
if (navResDTO.code == 0) {
if(params.status === 1){
promptAction.showToast({ message: '收藏成功' })
... ...
import { OtherUserDetailRequestItem } from './OtherUserDetailRequestItem';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { PeopleShipUserDetailData, ArticleCountData, ArticleListData, InfluenceData } from 'wdBean';
import HashMap from '@ohos.util.HashMap';
import { Logger } from 'wdKit';
import { FollowListStatusRequestItem } from './FollowListStatusRequestItem';
import { QueryListIsFollowedItem } from './QueryListIsFollowedItem';
... ... @@ -12,8 +11,7 @@ export class PeopleShipHomePageDataModel {
/*获取人民号主页详情*/
static fetchPeopleUserDetailData(item: OtherUserDetailRequestItem) {
let url = HttpUrlUtils.getOtherUserDetailDataUrl()
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO<PeopleShipUserDetailData>>(url, item, headers)
return WDHttp.post<ResponseDTO<PeopleShipUserDetailData>>(url, item)
}
static async getPeopleShipHomePageDetailInfo(creatorId: string, userType: string, userId: string): Promise<PeopleShipUserDetailData> {
... ... @@ -48,8 +46,7 @@ export class PeopleShipHomePageDataModel {
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}`);
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<ArticleCountData>>(url, headers)
return WDHttp.get<ResponseDTO<ArticleCountData>>(url)
}
static async getPeopleShipHomePageArticleCountData(includeLive: number, creatorId: string): Promise<ArticleCountData> {
... ... @@ -85,8 +82,7 @@ export class PeopleShipHomePageDataModel {
url += `&type=${type}`
}
Logger.debug(TAG, `${url}`);
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<ArticleListData>>(url, headers)
return WDHttp.get<ResponseDTO<ArticleListData>>(url)
}
static async getPeopleShipHomePageArticleListData(creatorId: string, pageNum: number, pageSize: number, type?: number): Promise<ArticleListData> {
... ... @@ -119,8 +115,7 @@ export class PeopleShipHomePageDataModel {
static fetchCreatorInfluenceInfoHotsData(creatorId: string) {
let url = HttpUrlUtils.getCreatorInfluenceInfoHotsDataUrl() + `?creatorId=${creatorId}`
Logger.debug(TAG, `${url}`);
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<InfluenceData>>(url, headers)
return WDHttp.get<ResponseDTO<InfluenceData>>(url)
}
static async getCreatorInfluenceInfoData(creatorId: string): Promise<InfluenceData> {
... ... @@ -155,8 +150,7 @@ export class PeopleShipHomePageDataModel {
let model = new QueryListIsFollowedItem(creatorId)
let object = new FollowListStatusRequestItem()
object.creatorIds = [model]
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post<ResponseDTO<QueryListIsFollowedItem[]>>(url,object, headers)
return WDHttp.post<ResponseDTO<QueryListIsFollowedItem[]>>(url,object)
};
static async getHomePageFollowListStatusData(creatorId: string): Promise<QueryListIsFollowedItem[]> {
... ...
import { Logger, ResourcesUtils } from 'wdKit';
import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
import { ContentDetailDTO, InteractDataDTO } from 'wdBean';
import HashMap from '@ohos.util.HashMap';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
const TAG = 'ContentDetailRequest';
... ... @@ -208,8 +207,7 @@ export class ContentDetailRequest {
return ContentDetailRequest.getContentDetailDataMock(getContext());
}
let url = ContentDetailRequest.getContentDetailUrl(params.contentId, params.relId, params.relType)
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.get<ResponseDTO<ContentDetailDTO[]>>(url, headers)
return WDHttp.get<ResponseDTO<ContentDetailDTO[]>>(url)
}
/**
... ... @@ -218,8 +216,7 @@ export class ContentDetailRequest {
*/
static getRecCompInfo(params: getRecCompInfoParams): Promise<ResponseDTO<getRecCompInfoResult>> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.DISPLAY_REC_COMPINFO
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.request({ url, method: 'GET', params, headers: HttpRequest.buildHeaderWithGlobalHeader(headers) })
return WDHttp.request({ url, method: 'GET', params, headers: HttpRequest.buildHeaderWithGlobalHeader() })
}
/**
... ... @@ -228,12 +225,11 @@ export class ContentDetailRequest {
*/
static batchContentDetail(params: batchContentDetailParams): Promise<ResponseDTO<ContentDetailDTO[]>> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.DETAIL_PATH
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.request({
url,
method: 'POST',
data: params,
headers: HttpRequest.buildHeaderWithGlobalHeader(headers)
headers: HttpRequest.buildHeaderWithGlobalHeader()
})
}
... ... @@ -244,8 +240,7 @@ export class ContentDetailRequest {
*/
static getContentInteract(params: contentListParams): Promise<ResponseDTO<InteractDataDTO[]>> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_PATH
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post(url, params, headers)
return WDHttp.post(url, params)
}
/**
... ... @@ -254,8 +249,7 @@ export class ContentDetailRequest {
*/
static postBatchLikeAndCollectStatus(params: batchLikeAndCollectParams): Promise<ResponseDTO<batchLikeAndCollectResult[]>> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_DATA_STATUS
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post(url, params, headers)
return WDHttp.post(url, params)
}
/**
... ... @@ -264,8 +258,7 @@ export class ContentDetailRequest {
*/
static postBatchAttentionStatus(params: postBatchAttentionStatusParams): Promise<ResponseDTO<postBatchAttentionStatusResult[]>> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.FOLLOW_LIST_STATUS_DATA_PATH
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post(url, params, headers)
return WDHttp.post(url, params)
}
... ... @@ -276,8 +269,7 @@ export class ContentDetailRequest {
static postRecommendVideoList(params: recommentVideoListParams): Promise<ResponseDTO<ContentDetailDTO[]>> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.RECOMMEND_VIDEOLIST
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post(url, params, headers)
return WDHttp.post(url, params)
}
/**
... ... @@ -287,8 +279,7 @@ export class ContentDetailRequest {
*/
static postExecuteLike(params: postExecuteLikeParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_EXECUTELIKE
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post(url, params, headers)
return WDHttp.post(url, params)
}
/**
... ... @@ -298,8 +289,7 @@ export class ContentDetailRequest {
*/
static postExecuteCollectRecord(params: postExecuteCollectRecordParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_EXECUTECOLLECTRECORD
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post(url, params, headers)
return WDHttp.post(url, params)
}
/**
... ... @@ -308,8 +298,7 @@ export class ContentDetailRequest {
*/
static postPointLevelOperate(params: postPointLevelOperateParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.USERPOINT_OPERATE
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post(url, params, headers)
return WDHttp.post(url, params)
}
/**
... ... @@ -317,8 +306,7 @@ export class ContentDetailRequest {
*/
static postCommentPublish(params: postCommentPublishParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.COMMENT_PUBLISH
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post(url, params, headers)
return WDHttp.post(url, params)
}
... ... @@ -327,8 +315,7 @@ export class ContentDetailRequest {
*/
static postInteractBrowsOperate(params: postInteractBrowsOperateParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_BROWS_OPERATE
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post(url, params, headers)
return WDHttp.post(url, params)
}
/**
... ... @@ -336,7 +323,6 @@ export class ContentDetailRequest {
*/
static postInteractAccentionOperate(params: postInteractAccentionOperateParams): Promise<ResponseDTO> {
let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_ACCENTION_OPERATION
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return WDHttp.post(url, params, headers)
return WDHttp.post(url, params)
}
}
\ No newline at end of file
... ...
import HashMap from '@ohos.util.HashMap';
import { HttpUrlUtils, ResponseDTO } from 'wdNetwork';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import { Logger, ToastUtils } from 'wdKit';
... ... @@ -15,11 +14,10 @@ export class LiveModel {
* @returns
*/
getLiveDetails(contentId: string, relId: string, relType: string) {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<Array<LiveDetailsBean>>((success, fail) => {
HttpRequest.get<ResponseDTO<Array<LiveDetailsBean>>>(
HttpUrlUtils.getLiveDetailsUrl() + `?relId=${relId}&relType=${relType}&contentId=${contentId}`,
headers).then((data: ResponseDTO<Array<LiveDetailsBean>>) => {
).then((data: ResponseDTO<Array<LiveDetailsBean>>) => {
if (!data || !data.data) {
fail("数据为空")
return
... ... @@ -50,12 +48,11 @@ export class LiveModel {
params['mLiveId'] = mLiveId
params['liveId'] = liveId
params['pageSize'] = pageSize + ''
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<LiveRoomBean>((success, fail) => {
HttpRequest.post<ResponseDTO<LiveRoomBean>>(
HttpUrlUtils.getLiveListUrl(),
params,
headers).then((data: ResponseDTO<LiveRoomBean>) => {
).then((data: ResponseDTO<LiveRoomBean>) => {
if (!data || !data.data) {
fail("数据为空")
return
... ... @@ -86,12 +83,11 @@ export class LiveModel {
params['mLiveId'] = mLiveId
params['liveId'] = liveId
params['pageSize'] = pageSize + ''
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<LiveRoomBean>((success, fail) => {
HttpRequest.post<ResponseDTO<LiveRoomBean>>(
HttpUrlUtils.getLiveChatListUrl(),
params,
headers).then((data: ResponseDTO<LiveRoomBean>) => {
).then((data: ResponseDTO<LiveRoomBean>) => {
if (!data || !data.data) {
fail("数据为空")
return
... ... @@ -114,11 +110,10 @@ export class LiveModel {
* @returns
*/
getLiveRoomData(liveId: string) {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<LiveRoomDataBean>((success, fail) => {
HttpRequest.get<ResponseDTO<LiveRoomDataBean>>(
HttpUrlUtils.getLiveRoomDataUrl() + `?liveId=${liveId}`,
headers).then((data: ResponseDTO<LiveRoomDataBean>) => {
).then((data: ResponseDTO<LiveRoomDataBean>) => {
if (!data || !data.data) {
fail("数据为空")
return
... ... @@ -142,11 +137,10 @@ export class LiveModel {
* @returns
*/
getLiveAppointmentStatus(relationId: string, liveId: string) {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<boolean>((success, fail) => {
HttpRequest.get<ResponseDTO<boolean>>(
HttpUrlUtils.getLiveAppointmentStatusUrl() + `?relationId=${relationId}&liveId=${liveId}`,
headers).then((data: ResponseDTO<boolean>) => {
).then((data: ResponseDTO<boolean>) => {
if (!data || !data.data) {
fail("数据为空")
return
... ... @@ -175,12 +169,11 @@ export class LiveModel {
params['relationId'] = relationId
params['liveId'] = liveId
params['isSubscribe'] = `${isSubscribe}`
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<ResponseDTO<string>>((success, fail) => {
HttpRequest.post<ResponseDTO<string>>(
HttpUrlUtils.getLiveAppointmentUrl(),
params,
headers).then((data: ResponseDTO<string>) => {
).then((data: ResponseDTO<string>) => {
if (data.code != 0) {
fail(data.message)
ToastUtils.shortToast(data.message)
... ...
import HashMap from '@ohos.util.HashMap';
import { HttpBizUtil, HttpUrlUtils, ResponseDTO } from 'wdNetwork';
import { Logger, SPHelper, StringUtils } from 'wdKit';
import { Logger } from 'wdKit';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import { LoginBean } from './LoginBean';
import { CheckVerifyBean } from './CheckVerifyBean';
... ... @@ -17,9 +17,8 @@ export class LoginModel {
sendVerifyCode(number: string) {
let bean: Record<string, string> = {};
bean['phoneNum'] = number
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<string>((success, fail) => {
HttpRequest.post<ResponseDTO<string>>(HttpUrlUtils.getVerifyCodeUrl(), bean, headers).then((data: ResponseDTO<string>) => {
HttpRequest.post<ResponseDTO<string>>(HttpUrlUtils.getVerifyCodeUrl(), bean).then((data: ResponseDTO<string>) => {
if (!data || !data.data) {
fail("数据为空")
return
... ... @@ -40,9 +39,8 @@ export class LoginModel {
sendVerifyCodeByToken() {
let bean: Record<string, string> = {};
// bean['phoneNum'] = number
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<object>((success, fail) => {
HttpBizUtil.post<ResponseDTO<object>>(HttpUrlUtils.getVerifyCodeByTokenUrl(),bean, headers).then((data: ResponseDTO<object>) => {
HttpBizUtil.post<ResponseDTO<object>>(HttpUrlUtils.getVerifyCodeByTokenUrl(),bean).then((data: ResponseDTO<object>) => {
if (!data) {
fail("数据为空")
return
... ... @@ -63,14 +61,13 @@ export class LoginModel {
//{"phone":"13625644528","loginType":2,"deviceId":"60da5af6-9c59-3566-8622-8c6c00710994","verificationCode":"644528"}
appLogin(phone: string, loginType: number, verificationCode: string) {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
let bean: Record<string, Object> = {};
bean['phone'] = phone
bean['loginType'] = loginType
bean['deviceId'] = '60da5af6-9c59-3566-8622-8c6c00710994'
bean['verificationCode'] = verificationCode
return new Promise<LoginBean>((success, fail) => {
HttpRequest.post<ResponseDTO<LoginBean>>(HttpUrlUtils.getAppLoginUrl(), bean, headers).then((data: ResponseDTO<LoginBean>) => {
HttpRequest.post<ResponseDTO<LoginBean>>(HttpUrlUtils.getAppLoginUrl(), bean).then((data: ResponseDTO<LoginBean>) => {
Logger.debug("LoginViewModel:success2 ", data.message)
if (!data) {
fail("数据为空")
... ... @@ -90,7 +87,6 @@ export class LoginModel {
// {"password":"523acd319228efde34e8a30268ee8ca5e4fc421d72affa531676e1765940d22c","phone":"13625644528","loginType":0,"oldPassword":"BA5FD74F827AF9B271FE17CADC489C36","deviceId":"60da5af6-9c59-3566-8622-8c6c00710994"}
appLoginByPassword(phone: string, loginType: number, password: string, oldPassword: string) {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
let bean: Record<string, string | number> = {};
bean['phone'] = phone
bean['loginType'] = loginType
... ... @@ -98,7 +94,7 @@ export class LoginModel {
bean['password'] = password
bean['oldPassword'] = oldPassword
return new Promise<LoginBean>((success, fail) => {
HttpRequest.post<ResponseDTO<LoginBean>>(HttpUrlUtils.getAppLoginUrl(), bean, headers).then((data: ResponseDTO<LoginBean>) => {
HttpRequest.post<ResponseDTO<LoginBean>>(HttpUrlUtils.getAppLoginUrl(), bean).then((data: ResponseDTO<LoginBean>) => {
Logger.debug("LoginViewModel:success2 ", data.message)
if (!data) {
fail("数据为空")
... ... @@ -121,10 +117,10 @@ export class LoginModel {
let bean: Record<string, Object> = {};
bean['verifyCode'] = verifyCode
bean['phone'] = phone
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
let headers: HashMap<string, string> = new HashMap<string, string>();
headers.set('cookie', '');
return new Promise<CheckVerifyBean>((success, fail) => {
HttpRequest.post<ResponseDTO<CheckVerifyBean>>(HttpUrlUtils.getCheckVerifyCodeUrl(), bean, headers).then((data: ResponseDTO<CheckVerifyBean>) => {
HttpRequest.post<ResponseDTO<CheckVerifyBean>>(HttpUrlUtils.getCheckVerifyCodeUrl(), bean).then((data: ResponseDTO<CheckVerifyBean>) => {
Logger.debug("LoginViewModel:success2 ", data.message)
if (!data || !data.data) {
fail("数据为空")
... ... @@ -146,9 +142,8 @@ export class LoginModel {
let bean: Record<string, Object> = {};
bean['verifyCode'] = verifyCode
// bean['phone'] = phone
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<CheckVerifyBean>((success, fail) => {
HttpRequest.post<ResponseDTO<CheckVerifyBean>>(HttpUrlUtils.getCheckVerifyCodeByToken(), bean, headers).then((data: ResponseDTO<CheckVerifyBean>) => {
HttpRequest.post<ResponseDTO<CheckVerifyBean>>(HttpUrlUtils.getCheckVerifyCodeByToken(), bean).then((data: ResponseDTO<CheckVerifyBean>) => {
Logger.debug("LoginViewModel:success2 ", data.message)
if (!data) {
fail("数据为空")
... ... @@ -174,10 +169,8 @@ export class LoginModel {
// bean['password'] = password;
// bean['tempToken'] = tempToken;
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<string>((success, fail) => {
HttpRequest.post<ResponseDTO<string>>(HttpUrlUtils.getForgetPasswordUrl(), bean, headers).then((data: ResponseDTO<string>) => {
HttpRequest.post<ResponseDTO<string>>(HttpUrlUtils.getForgetPasswordUrl(), bean).then((data: ResponseDTO<string>) => {
if (!data || !data.data) {
fail("数据为空")
return
... ... @@ -202,10 +195,8 @@ export class LoginModel {
bean['password'] = password;
bean['tempToken'] = tempToken;
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<object>((success, fail) => {
HttpRequest.post<ResponseDTO<object>>(HttpUrlUtils.getForgetPasswordUrl(), bean, headers).then((data: ResponseDTO<object>) => {
HttpRequest.post<ResponseDTO<object>>(HttpUrlUtils.getForgetPasswordUrl(), bean).then((data: ResponseDTO<object>) => {
if (data.code != 0) {
fail(data.message)
... ... @@ -224,10 +215,8 @@ export class LoginModel {
let bean: Record<string, string> = {};
bean['refreshToken'] = HttpUrlUtils.getRefreshToken();
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<string>((success, fail) => {
HttpBizUtil.post<ResponseDTO<string>>(HttpUrlUtils.getLogoutUrl(), bean, headers).then((data: ResponseDTO<string>)=>{
HttpBizUtil.post<ResponseDTO<string>>(HttpUrlUtils.getLogoutUrl(), bean).then((data: ResponseDTO<string>)=>{
if (!data) {
fail("数据为空")
return
... ... @@ -260,12 +249,11 @@ export class LoginModel {
//更换绑定手机号
changeBindPhone(phone: string, verificationCode: string){
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
let bean: Record<string, Object> = {};
bean['phone'] = phone
bean['verifyCode'] = verificationCode
return new Promise<object>((success, fail) => {
HttpRequest.post<ResponseDTO<object>>(HttpUrlUtils.changeBindPhone(), bean, headers).then((data: ResponseDTO<object>) => {
HttpRequest.post<ResponseDTO<object>>(HttpUrlUtils.changeBindPhone(), bean).then((data: ResponseDTO<object>) => {
Logger.debug("LoginViewModel:success2 ", data.message)
if (!data) {
fail("数据为空")
... ... @@ -285,9 +273,8 @@ export class LoginModel {
/**获取用户安全页信息*/
querySecurity(){
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<object>((success, fail) => {
HttpRequest.get<ResponseDTO<object>>(HttpUrlUtils.querySecurity(), headers).then((data: ResponseDTO<object>) => {
HttpRequest.get<ResponseDTO<object>>(HttpUrlUtils.querySecurity()).then((data: ResponseDTO<object>) => {
Logger.debug("LoginViewModel:success2 ", data.message)
if (!data) {
fail("数据为空")
... ... @@ -307,9 +294,8 @@ export class LoginModel {
queryUserDetail() {
let bean: Record<string, string> = {};
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<UserDetail>((success, fail) => {
HttpBizUtil.get<ResponseDTO<UserDetail>>(HttpUrlUtils.queryUserDetail(), headers).then((data: ResponseDTO<UserDetail>) => {
HttpBizUtil.get<ResponseDTO<UserDetail>>(HttpUrlUtils.queryUserDetail()).then((data: ResponseDTO<UserDetail>) => {
if (!data || !data.data) {
fail("数据为空")
return
... ...
import HashMap from '@ohos.util.HashMap';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import { HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index';
import { Logger, SPHelper } from 'wdKit/Index';
import data from '@ohos.telephony.data';
import { SpConstants } from 'wdConstant/Index';
... ... @@ -32,9 +30,8 @@ export class InterestsHobbiesModel {
getInterestsHobbiesData() {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<InterestsList[]>((success, fail) => {
HttpRequest.get<ResponseDTO<InterestsList[]>>(HttpUrlUtils.getInterestsUrl(), headers).then((data: ResponseDTO<InterestsList[]>) => {
HttpRequest.get<ResponseDTO<InterestsList[]>>(HttpUrlUtils.getInterestsUrl()).then((data: ResponseDTO<InterestsList[]>) => {
if (!data || !data.data) {
fail("数据为空")
return
... ... @@ -58,9 +55,8 @@ export class InterestsHobbiesModel {
if (tags.length === 0) return
let bean: Record<string, string> = {};
bean['tagIds'] = tags
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<ResponseDTO>((success, fail) => {
HttpRequest.post<ResponseDTO>(HttpUrlUtils.getUpdateInterestsUrl(),bean,headers).then((data: ResponseDTO) => {
HttpRequest.post<ResponseDTO>(HttpUrlUtils.getUpdateInterestsUrl(),bean).then((data: ResponseDTO) => {
if (data.code == 0) {
Logger.info('InterestsHobbiesModel','updateInterests','更新兴趣成功')
SPHelper.default.deleteSync(SpConstants.PUBLICVISUTORMODE_INTERESTTAGS)
... ...
import { HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index';
// import { HashMap } from '@kit.ArkTS';
import HashMap from '@ohos.util.HashMap';
import { AgreementBean } from '../launchPage/AgreementBean';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import { Logger, SPHelper } from 'wdKit/Index';
... ... @@ -8,9 +6,8 @@ import { SpConstants } from 'wdConstant/Index';
export class LaunchModel {
getAgreement() {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<AgreementBean>((success, fail) => {
HttpRequest.get<ResponseDTO<Array<AgreementBean>>>(HttpUrlUtils.getAgreement(), headers).then((data: ResponseDTO<Array<AgreementBean>>) => {
HttpRequest.get<ResponseDTO<Array<AgreementBean>>>(HttpUrlUtils.getAgreement()).then((data: ResponseDTO<Array<AgreementBean>>) => {
if (!data || !data.data) {
fail("数据为空")
return
... ...
import LaunchDataModel from '../viewModel/LaunchDataModel'
import HashMap from '@ohos.util.HashMap';
import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
import { HttpUrlUtils, ResponseDTO } from 'wdNetwork/Index';
import { Logger, SPHelper } from 'wdKit/Index';
import data from '@ohos.telephony.data';
import { SpConstants } from 'wdConstant/Index';
export class LaunchPageModel {
getLaunchPageData(): Promise<LaunchDataModel> {
let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
return new Promise<LaunchDataModel>((success, fail) => {
HttpRequest.get<ResponseDTO<LaunchDataModel>>(HttpUrlUtils.getLaunchPageDataUrl(), headers).then((data: ResponseDTO<LaunchDataModel>) => {
HttpRequest.get<ResponseDTO<LaunchDataModel>>(HttpUrlUtils.getLaunchPageDataUrl()).then((data: ResponseDTO<LaunchDataModel>) => {
if (!data || !data.data) {
fail("数据为空")
return
... ...