chenjun3_wd

直播预约状态查询TODO

@@ -225,6 +225,10 @@ export class HttpUrlUtils { @@ -225,6 +225,10 @@ export class HttpUrlUtils {
225 */ 225 */
226 static readonly LIVE_APPOINTMENT_PATH: string = "/api/live-center-message/zh/c/live/subscribe"; 226 static readonly LIVE_APPOINTMENT_PATH: string = "/api/live-center-message/zh/c/live/subscribe";
227 /** 227 /**
  228 + * 预约状态
  229 + */
  230 + static readonly LIVE_APPOINTMENT_BATCH_PATH: string = "api/live-center-message/zh/c/live/subscribe/user/batch";
  231 + /**
228 232
229 * 搜索结果 显示tab 数 233 * 搜索结果 显示tab 数
230 */ 234 */
@@ -285,7 +289,6 @@ export class HttpUrlUtils { @@ -285,7 +289,6 @@ export class HttpUrlUtils {
285 * 获取启动页相关数据 289 * 获取启动页相关数据
286 */ 290 */
287 static readonly LAUNCH_PAGE_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/launchPage"; 291 static readonly LAUNCH_PAGE_PATH: string = "/api/rmrb-bff-display-zh/display/zh/c/launchPage";
288 -  
289 private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT; 292 private static _hostUrl: string = HttpUrlUtils.HOST_PRODUCT;
290 /** 293 /**
291 * 推荐列表 294 * 推荐列表
@@ -772,6 +775,11 @@ export class HttpUrlUtils { @@ -772,6 +775,11 @@ export class HttpUrlUtils {
772 return url 775 return url
773 } 776 }
774 777
  778 + static getAppointmentStatusUrl() {
  779 + let url = HttpUrlUtils._hostUrl + HttpUrlUtils.LIVE_APPOINTMENT_BATCH_PATH
  780 + return url
  781 + }
  782 +
775 static getSearchResultCountDataUrl() { 783 static getSearchResultCountDataUrl() {
776 let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_RESULT_COUNT_DATA_PATH 784 let url = HttpUrlUtils._hostUrl + HttpUrlUtils.SEARCH_RESULT_COUNT_DATA_PATH
777 return url 785 return url
@@ -119,10 +119,12 @@ export { ArticleListDTO } from './src/main/ets/bean/component/ArticleListDTO'; @@ -119,10 +119,12 @@ export { ArticleListDTO } from './src/main/ets/bean/component/ArticleListDTO';
119 119
120 export { appStyleImagesDTO } from './src/main/ets/bean/content/appStyleImagesDTO'; 120 export { appStyleImagesDTO } from './src/main/ets/bean/content/appStyleImagesDTO';
121 121
122 -export { LiveRoomBean,LiveRoomItemBean } from './src/main/ets/bean/live/LiveRoomBean'; 122 +export { LiveRoomBean, LiveRoomItemBean } from './src/main/ets/bean/live/LiveRoomBean';
123 123
124 export { LiveRoomDataBean } from './src/main/ets/bean/live/LiveRoomDataBean'; 124 export { LiveRoomDataBean } from './src/main/ets/bean/live/LiveRoomDataBean';
125 125
  126 +export { ReserveBean } from './src/main/ets/bean/live/ReserveBean';
  127 +
126 export { LiveInfoDTO } from './src/main/ets/bean/detail/LiveInfoDTO'; 128 export { LiveInfoDTO } from './src/main/ets/bean/detail/LiveInfoDTO';
127 129
128 export { LiveDTO } from './src/main/ets/bean/peoples/LiveDTO'; 130 export { LiveDTO } from './src/main/ets/bean/peoples/LiveDTO';
  1 +export interface ReserveBean {
  2 + relationId: string,
  3 + liveId: string
  4 +}
1 -import { ContentDTO } from 'wdBean'; 1 +import { ContentDTO, ReserveBean } from 'wdBean';
2 import { ProcessUtils } from 'wdRouter'; 2 import { ProcessUtils } from 'wdRouter';
3 import { CommonConstants } from 'wdConstant/Index'; 3 import { CommonConstants } from 'wdConstant/Index';
4 import PageViewModel from '../../viewmodel/PageViewModel'; 4 import PageViewModel from '../../viewmodel/PageViewModel';
@@ -24,6 +24,7 @@ const TAG: string = 'ReserveMorePage'; @@ -24,6 +24,7 @@ const TAG: string = 'ReserveMorePage';
24 struct ReserveMorePage { 24 struct ReserveMorePage {
25 @State private pageModel: PageModel = new PageModel(); 25 @State private pageModel: PageModel = new PageModel();
26 @State data: LazyDataSource<ContentDTO> = new LazyDataSource(); 26 @State data: LazyDataSource<ContentDTO> = new LazyDataSource();
  27 + reserveBean: ReserveBean[] = []
27 topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number; 28 topSafeHeight: number = AppStorage.get<number>('topSafeHeight') as number;
28 type: number = 2; 29 type: number = 2;
29 currentPage: number = 1; 30 currentPage: number = 1;
@@ -72,12 +73,32 @@ struct ReserveMorePage { @@ -72,12 +73,32 @@ struct ReserveMorePage {
72 // } 73 // }
73 } as ContentDTO; 74 } as ContentDTO;
74 75
75 - aboutToAppear(): void {  
76 - PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then((liveReviewDTO) => { 76 + async aboutToAppear(): Promise<void> {
  77 + // PageViewModel.get
  78 +
  79 + PageViewModel.getLiveMoreUrl(this.type, this.currentPage, this.pageSize).then(async (liveReviewDTO) => {
77 // this.operDataList = [] 80 // this.operDataList = []
78 // this.operDataList.push(...liveReviewDTO.list) 81 // this.operDataList.push(...liveReviewDTO.list)
79 this.data.push(...liveReviewDTO.list) 82 this.data.push(...liveReviewDTO.list)
  83 + this.reserveBean = this.transformToLiveDetailsBeans(liveReviewDTO.list)
  84 +
  85 + const apointMentStatus = await LiveModel.getAppointmentStatus(this.reserveBean)
  86 + console.info(`cj2024 ${apointMentStatus.code}`)
80 }) 87 })
  88 +
  89 +
  90 + }
  91 +
  92 + // 这个函数遍历liveReviewDTO.list并转换为LiveDetailsBean数组
  93 + transformToLiveDetailsBeans(list: ContentDTO[]): ReserveBean[] {
  94 + const liveDetailsBeans: ReserveBean[] = [];
  95 + list.forEach(item => {
  96 + liveDetailsBeans.push({
  97 + relationId: item.relId,
  98 + liveId: item.objectId,
  99 + });
  100 + });
  101 + return liveDetailsBeans
81 } 102 }
82 103
83 build() { 104 build() {
@@ -274,6 +295,7 @@ struct ReserveMorePage { @@ -274,6 +295,7 @@ struct ReserveMorePage {
274 // 295 //
275 // }) 296 // })
276 const liveDetail = await LiveModel.liveAppointment(item?.relId || '', item?.objectId || '', this.isAppointmentLive || false) 297 const liveDetail = await LiveModel.liveAppointment(item?.relId || '', item?.objectId || '', this.isAppointmentLive || false)
  298 + // const liveDetail = await LiveModel.getAppointmentStatus(item?.relId || '', item?.objectId || '', this.isAppointmentLive || false)
277 } 299 }
278 300
279 /*导航栏*/ 301 /*导航栏*/
@@ -2,7 +2,7 @@ import HashMap from '@ohos.util.HashMap'; @@ -2,7 +2,7 @@ import HashMap from '@ohos.util.HashMap';
2 import { HttpUrlUtils, ResponseDTO } from 'wdNetwork'; 2 import { HttpUrlUtils, ResponseDTO } from 'wdNetwork';
3 import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; 3 import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
4 import { Logger, ToastUtils } from 'wdKit'; 4 import { Logger, ToastUtils } from 'wdKit';
5 -import { LiveDetailsBean } from 'wdBean/Index'; 5 +import { LiveDetailsBean, ReserveBean } from 'wdBean/Index';
6 6
7 const TAG = 'LiveModel' 7 const TAG = 'LiveModel'
8 8
@@ -66,5 +66,34 @@ export class LiveModel { @@ -66,5 +66,34 @@ export class LiveModel {
66 }) 66 })
67 }) 67 })
68 } 68 }
  69 +
  70 + /**
  71 + * 查询预约状态
  72 + *
  73 + [{"relationId":"500002824823","liveId":"20000120522"},{"relationId":"500002845517","liveId":"20000120782"}]
  74 + * @returns
  75 + * @returns
  76 + */
  77 + static getAppointmentStatus(reserveBean: ReserveBean[]) {
  78 + // let params: Record<string, ArrayList<ReserveBean>> = {};
  79 + // params = reserveBean
  80 + let headers: HashMap<string, string> = HttpUrlUtils.getCommonHeaders();
  81 + return new Promise<ResponseDTO<string>>((success, fail) => {
  82 + HttpRequest.post<ResponseDTO<string>>(
  83 + HttpUrlUtils.getAppointmentStatusUrl(),
  84 + reserveBean,
  85 + headers).then((data: ResponseDTO<string>) => {
  86 + if (data.code != 0) {
  87 + fail(data.message)
  88 + ToastUtils.shortToast(data.message)
  89 + return
  90 + }
  91 + success(data)
  92 + }, (error: Error) => {
  93 + fail(error.message)
  94 + Logger.debug(TAG + ":error ", error.toString())
  95 + })
  96 + })
  97 + }
69 } 98 }
70 99