wangliang_wd

feat:优化强制下线,点赞,收藏无响应问题

@@ -5,6 +5,7 @@ import { @@ -5,6 +5,7 @@ import {
5 EmitterUtils, 5 EmitterUtils,
6 EmitterEventId, 6 EmitterEventId,
7 NetworkUtil, 7 NetworkUtil,
  8 + ToastUtils,
8 } from 'wdKit'; 9 } from 'wdKit';
9 import { 10 import {
10 Action, 11 Action,
@@ -242,7 +243,7 @@ export struct H5NewsWebPageComponent { @@ -242,7 +243,7 @@ export struct H5NewsWebPageComponent {
242 PageRepository.postExecuteLike(params).then(res => { 243 PageRepository.postExecuteLike(params).then(res => {
243 // console.log(TAG, '点赞、res', JSON.stringify(res)) 244 // console.log(TAG, '点赞、res', JSON.stringify(res))
244 console.log(TAG, '点赞、取消点赞 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser)) 245 console.log(TAG, '点赞、取消点赞 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser))
245 - if (this.newsStatusOfUser) { 246 + if (this.newsStatusOfUser && res.code == 0) {
246 //内容点赞、取消点赞Tracking 1点赞 0取消点赞 247 //内容点赞、取消点赞Tracking 1点赞 0取消点赞
247 this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1' 248 this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1'
248 if (this.newsStatusOfUser.likeStatus === '1') { 249 if (this.newsStatusOfUser.likeStatus === '1') {
@@ -257,7 +258,6 @@ export struct H5NewsWebPageComponent { @@ -257,7 +258,6 @@ export struct H5NewsWebPageComponent {
257 // 初次进入详情页偶现获取失败,重新获取newsStatusOfUser对象 258 // 初次进入详情页偶现获取失败,重新获取newsStatusOfUser对象
258 this.getInteractDataStatus() 259 this.getInteractDataStatus()
259 } 260 }
260 -  
261 }) 261 })
262 } 262 }
263 263
@@ -450,24 +450,20 @@ export struct ImageAndTextPageComponent { @@ -450,24 +450,20 @@ export struct ImageAndTextPageComponent {
450 PageRepository.postExecuteLike(params).then(res => { 450 PageRepository.postExecuteLike(params).then(res => {
451 // console.log(TAG, '点赞、res', JSON.stringify(res)) 451 // console.log(TAG, '点赞、res', JSON.stringify(res))
452 // console.log(TAG, '点赞、取消点赞 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser)) 452 // console.log(TAG, '点赞、取消点赞 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser))
453 - if (res.code != 0){  
454 - ToastUtils.showToast(res.message, 1000);  
455 - }else {  
456 - if (this.newsStatusOfUser) {  
457 - //内容点赞、取消点赞Tracking 1点赞 0取消点赞  
458 - this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1'  
459 - if (this.newsStatusOfUser.likeStatus === '1') {  
460 - this.likeNum = Number(this.likeNum) + 1  
461 - } else {  
462 - this.likeNum = Number(this.likeNum) - 1  
463 - }  
464 - // console.log(TAG, '点赞newsStatusOfUser.likeStatus ', this.newsStatusOfUser.likeStatus)  
465 - // this.queryContentInteractCount()  
466 - TrackingContent.like(this.newsStatusOfUser?.likeStatus == '1', TrackConstants.PageName.My, TrackConstants.PageName.My) 453 + if (this.newsStatusOfUser && res.code == 0) {
  454 + //内容点赞、取消点赞Tracking 1点赞 0取消点赞
  455 + this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1'
  456 + if (this.newsStatusOfUser.likeStatus === '1') {
  457 + this.likeNum = Number(this.likeNum) + 1
467 } else { 458 } else {
468 - // 初次进入详情页偶现获取失败,重新获取newsStatusOfUser对象  
469 - this.getInteractDataStatus() 459 + this.likeNum = Number(this.likeNum) - 1
470 } 460 }
  461 + // console.log(TAG, '点赞newsStatusOfUser.likeStatus ', this.newsStatusOfUser.likeStatus)
  462 + // this.queryContentInteractCount()
  463 + TrackingContent.like(this.newsStatusOfUser?.likeStatus == '1', TrackConstants.PageName.My, TrackConstants.PageName.My)
  464 + } else {
  465 + // 初次进入详情页偶现获取失败,重新获取newsStatusOfUser对象
  466 + this.getInteractDataStatus()
471 } 467 }
472 }) 468 })
473 } 469 }
@@ -432,7 +432,7 @@ export struct LiveOperRowListView { @@ -432,7 +432,7 @@ export struct LiveOperRowListView {
432 } 432 }
433 console.log(TAG, '收藏点击', JSON.stringify(params)) 433 console.log(TAG, '收藏点击', JSON.stringify(params))
434 PageRepository.postExecuteCollectRecord(params).then(res => { 434 PageRepository.postExecuteCollectRecord(params).then(res => {
435 - if (this.newsStatusOfUser) { 435 + if (this.newsStatusOfUser && res.code == 0) {
436 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 436 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
437 if (this.newsStatusOfUser.collectStatus === 1) { 437 if (this.newsStatusOfUser.collectStatus === 1) {
438 promptAction.showToast({ message: '收藏成功' }) 438 promptAction.showToast({ message: '收藏成功' })
@@ -526,23 +526,18 @@ export struct OperRowListView { @@ -526,23 +526,18 @@ export struct OperRowListView {
526 526
527 console.log(TAG, '收藏点击', JSON.stringify(params)) 527 console.log(TAG, '收藏点击', JSON.stringify(params))
528 PageRepository.postExecuteCollectRecord(params).then(res => { 528 PageRepository.postExecuteCollectRecord(params).then(res => {
529 - if (res.code != 0){  
530 - ToastUtils.showToast(res.message, 1000);  
531 - }else {  
532 - if (this.newsStatusOfUser) {  
533 - this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1  
534 - if (this.newsStatusOfUser.collectStatus === 1) {  
535 - promptAction.showToast({ message: '收藏成功' })  
536 - TrackingContent.collect(true,this.pageId,this.pageName,this.pageParam)  
537 - } else {  
538 - TrackingContent.collect(false,this.pageId,this.pageName,this.pageParam)  
539 - }  
540 - this.queryContentInteractCount() 529 + if (this.newsStatusOfUser && res.code == 0) {
  530 + this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
  531 + if (this.newsStatusOfUser.collectStatus === 1) {
  532 + promptAction.showToast({ message: '收藏成功' })
  533 + TrackingContent.collect(true,this.pageId,this.pageName,this.pageParam)
  534 + } else {
  535 + TrackingContent.collect(false,this.pageId,this.pageName,this.pageParam)
541 } 536 }
  537 + this.queryContentInteractCount()
542 } 538 }
543 console.log(TAG, '收藏点击 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser)) 539 console.log(TAG, '收藏点击 this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser))
544 }) 540 })
545 -  
546 } 541 }
547 542
548 /** 543 /**
1 import { Logger, ResourcesUtils, EmitterUtils, EmitterEventId } from 'wdKit'; 1 import { Logger, ResourcesUtils, EmitterUtils, EmitterEventId } from 'wdKit';
2 -import { HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork'; 2 +import { HttpBizUtil, HttpUrlUtils, ResponseDTO, WDHttp } from 'wdNetwork';
3 import { ContentDetailDTO, GetPullAddressBean, InteractDataDTO, PeopleShipNextListDTO } from 'wdBean'; 3 import { ContentDetailDTO, GetPullAddressBean, InteractDataDTO, PeopleShipNextListDTO } from 'wdBean';
4 import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest'; 4 import { HttpRequest } from 'wdNetwork/src/main/ets/http/HttpRequest';
5 5
@@ -338,7 +338,7 @@ export class ContentDetailRequest { @@ -338,7 +338,7 @@ export class ContentDetailRequest {
338 */ 338 */
339 static postExecuteLike(params: postExecuteLikeParams): Promise<ResponseDTO> { 339 static postExecuteLike(params: postExecuteLikeParams): Promise<ResponseDTO> {
340 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_EXECUTELIKE 340 let url = HttpUrlUtils.getHost() + HttpUrlUtils.INTERACT_EXECUTELIKE
341 - return WDHttp.post(url, params) 341 + return HttpBizUtil.post(url, params)
342 } 342 }
343 343
344 /** 344 /**
@@ -348,7 +348,7 @@ export class ContentDetailRequest { @@ -348,7 +348,7 @@ export class ContentDetailRequest {
348 */ 348 */
349 static postExecuteCollectRecord(params: postExecuteCollectRecordParams): Promise<ResponseDTO> { 349 static postExecuteCollectRecord(params: postExecuteCollectRecordParams): Promise<ResponseDTO> {
350 let url = HttpUrlUtils.getExecuteCollcetUrl() 350 let url = HttpUrlUtils.getExecuteCollcetUrl()
351 - return WDHttp.post(url, params) 351 + return HttpBizUtil.post(url, params)
352 } 352 }
353 353
354 /** 354 /**
@@ -80,8 +80,7 @@ export struct OperationListView { @@ -80,8 +80,7 @@ export struct OperationListView {
80 contentType: this.contentDetailData?.newsType + '', 80 contentType: this.contentDetailData?.newsType + '',
81 } 81 }
82 ContentDetailRequest.postExecuteLike(params).then(res => { 82 ContentDetailRequest.postExecuteLike(params).then(res => {
83 -  
84 - if (this.newsStatusOfUser) { 83 + if (this.newsStatusOfUser && res.code == 0) {
85 this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1' 84 this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus === '1' ? '0' : '1'
86 if (this.newsStatusOfUser.likeStatus === '1') { 85 if (this.newsStatusOfUser.likeStatus === '1') {
87 this.interactData.likeNum = Number(this.interactData.likeNum) + 1 86 this.interactData.likeNum = Number(this.interactData.likeNum) + 1
@@ -91,7 +90,6 @@ export struct OperationListView { @@ -91,7 +90,6 @@ export struct OperationListView {
91 // console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactData?.likeNum) 90 // console.log('点赞、取消点赞==', this.newsStatusOfUser?.likeStatus, this.interactData?.likeNum)
92 // this.queryContentInteractCount() 91 // this.queryContentInteractCount()
93 } 92 }
94 -  
95 }) 93 })
96 } 94 }
97 95
@@ -116,7 +114,7 @@ export struct OperationListView { @@ -116,7 +114,7 @@ export struct OperationListView {
116 114
117 } 115 }
118 ContentDetailRequest.postExecuteCollectRecord(params).then(res => { 116 ContentDetailRequest.postExecuteCollectRecord(params).then(res => {
119 - if (this.newsStatusOfUser) { 117 + if (this.newsStatusOfUser && res.code == 0) {
120 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 118 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
121 // this.queryContentInteractCount() 119 // this.queryContentInteractCount()
122 if (this.newsStatusOfUser.collectStatus === 1) { 120 if (this.newsStatusOfUser.collectStatus === 1) {
@@ -99,7 +99,7 @@ export struct PlayerRightView { @@ -99,7 +99,7 @@ export struct PlayerRightView {
99 // console.log(TAG, '点赞params', JSON.stringify(params)) 99 // console.log(TAG, '点赞params', JSON.stringify(params))
100 ContentDetailRequest.postExecuteLike(params).then(res => { 100 ContentDetailRequest.postExecuteLike(params).then(res => {
101 // console.log(TAG, '点赞this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser)) 101 // console.log(TAG, '点赞this.newsStatusOfUser', JSON.stringify(this.newsStatusOfUser))
102 - if (this.newsStatusOfUser) { 102 + if (this.newsStatusOfUser && res.code == 0) {
103 this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1' 103 this.newsStatusOfUser.likeStatus = this.newsStatusOfUser?.likeStatus == '1' ? '0' : '1'
104 if (this.newsStatusOfUser.likeStatus == '1') { 104 if (this.newsStatusOfUser.likeStatus == '1') {
105 this.interactData.likeNum = Number(this.interactData.likeNum || 0) + 1 105 this.interactData.likeNum = Number(this.interactData.likeNum || 0) + 1
@@ -138,7 +138,7 @@ export struct PlayerRightView { @@ -138,7 +138,7 @@ export struct PlayerRightView {
138 138
139 } 139 }
140 ContentDetailRequest.postExecuteCollectRecord(params).then(res => { 140 ContentDetailRequest.postExecuteCollectRecord(params).then(res => {
141 - if (this.newsStatusOfUser) { 141 + if (this.newsStatusOfUser && res.code == 0) {
142 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1 142 this.newsStatusOfUser.collectStatus = this.newsStatusOfUser?.collectStatus === 1 ? 0 : 1
143 // this.queryContentInteractCount() 143 // this.queryContentInteractCount()
144 if (this.newsStatusOfUser.collectStatus === 1) { 144 if (this.newsStatusOfUser.collectStatus === 1) {