yangchenggong1_wd

desc:同步4.0

  1 +{
  2 + "code": "0",
  3 + "data": null,
  4 + "message": "Success",
  5 + "meta": null,
  6 + "requestId": "",
  7 + "success": true,
  8 + "timestamp": 1711609914928
  9 +}
  1 +{
  2 + "code": "0",
  3 + "data": null,
  4 + "message": "Success",
  5 + "meta": null,
  6 + "requestId": "",
  7 + "success": true,
  8 + "timestamp": 1711609966231
  9 +}
1 import { LazyDataSource, StringUtils } from 'wdKit'; 1 import { LazyDataSource, StringUtils } from 'wdKit';
2 import MinePageDatasModel from '../../../../model/MinePageDatasModel'; 2 import MinePageDatasModel from '../../../../model/MinePageDatasModel';
  3 +import { HttpUrlUtils } from '../../../../network/HttpUrlUtils';
3 import { Params } from '../../../../repository/bean/Params'; 4 import { Params } from '../../../../repository/bean/Params';
4 import RouteManager from '../../../../utils/RouteManager'; 5 import RouteManager from '../../../../utils/RouteManager';
5 import { FollowListDetailItem } from '../../../../viewmodel/FollowListDetailItem' 6 import { FollowListDetailItem } from '../../../../viewmodel/FollowListDetailItem'
6 import { FollowListDetailRequestItem } from '../../../../viewmodel/FollowListDetailRequestItem'; 7 import { FollowListDetailRequestItem } from '../../../../viewmodel/FollowListDetailRequestItem';
7 import { FollowListStatusRequestItem } from '../../../../viewmodel/FollowListStatusRequestItem'; 8 import { FollowListStatusRequestItem } from '../../../../viewmodel/FollowListStatusRequestItem';
  9 +import { FollowOperationRequestItem } from '../../../../viewmodel/FollowOperationRequestItem';
8 import { MineFollowListDetailItem } from '../../../../viewmodel/MineFollowListDetailItem'; 10 import { MineFollowListDetailItem } from '../../../../viewmodel/MineFollowListDetailItem';
9 import { QueryListIsFollowedItem } from '../../../../viewmodel/QueryListIsFollowedItem'; 11 import { QueryListIsFollowedItem } from '../../../../viewmodel/QueryListIsFollowedItem';
10 import { RouterObject } from '../../../../viewmodel/RouterObject'; 12 import { RouterObject } from '../../../../viewmodel/RouterObject';
@@ -75,7 +77,7 @@ export struct FollowListDetailUI{ @@ -75,7 +77,7 @@ export struct FollowListDetailUI{
75 this.hasMore = false 77 this.hasMore = false
76 }else{ 78 }else{
77 value.list.forEach((value)=>{ 79 value.list.forEach((value)=>{
78 - this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum,value.introduction,value.attentionCreatorId,"1",value.attentionUserId)) 80 + this.data.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum,value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId))
79 }) 81 })
80 this.data.notifyDataReload() 82 this.data.notifyDataReload()
81 this.count = this.data.totalCount() 83 this.count = this.data.totalCount()
@@ -115,7 +117,7 @@ export struct FollowListDetailUI{ @@ -115,7 +117,7 @@ export struct FollowListDetailUI{
115 let data : FollowListDetailItem[] = [] 117 let data : FollowListDetailItem[] = []
116 value.list.forEach((item)=>{ 118 value.list.forEach((item)=>{
117 status.creatorIds.push(new QueryListIsFollowedItem(item.creatorId)) 119 status.creatorIds.push(new QueryListIsFollowedItem(item.creatorId))
118 - data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,"0",item.attentionUserId)) 120 + data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,"0",item.attentionUserId,item.cnUserType,item.cnUserId))
119 }) 121 })
120 122
121 MinePageDatasModel.getFollowListStatusData(status,getContext(this)).then((newValue)=>{ 123 MinePageDatasModel.getFollowListStatusData(status,getContext(this)).then((newValue)=>{
@@ -128,7 +130,7 @@ export struct FollowListDetailUI{ @@ -128,7 +130,7 @@ export struct FollowListDetailUI{
128 }) 130 })
129 131
130 data.forEach((item)=>{ 132 data.forEach((item)=>{
131 - this.data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,item.status,item.attentionUserId)) 133 + this.data.push(new FollowListDetailItem(item.headPhotoUrl,item.cnUserName,item.cnFansNum,item.introduction,item.creatorId,item.status,item.attentionUserId,item.cnUserType,item.cnUserId))
132 }) 134 })
133 135
134 this.data.notifyDataReload() 136 this.data.notifyDataReload()
@@ -198,7 +200,8 @@ struct ChildComponent { @@ -198,7 +200,8 @@ struct ChildComponent {
198 .height('46lpx') 200 .height('46lpx')
199 .margin({left:'4lpx',top:'23lpx'}) 201 .margin({left:'4lpx',top:'23lpx'})
200 .onClick(()=>{ 202 .onClick(()=>{
201 - this.data.status = "0" 203 + this.followOperation()
  204 + // this.data.status = "0"
202 }) 205 })
203 }else{ 206 }else{
204 Row(){ 207 Row(){
@@ -219,7 +222,8 @@ struct ChildComponent { @@ -219,7 +222,8 @@ struct ChildComponent {
219 .height('46lpx') 222 .height('46lpx')
220 .margin({left:'4lpx',top:'23lpx'}) 223 .margin({left:'4lpx',top:'23lpx'})
221 .onClick(()=>{ 224 .onClick(()=>{
222 - this.data.status = "1" 225 + this.followOperation()
  226 + // this.data.status = "1"
223 }) 227 })
224 } 228 }
225 }.alignItems(VerticalAlign.Top) 229 }.alignItems(VerticalAlign.Top)
@@ -238,4 +242,14 @@ struct ChildComponent { @@ -238,4 +242,14 @@ struct ChildComponent {
238 // RouteManager.jumpNewPage("pages/OtherNormalUserHomePage",new RouterObject(this.data.attentionUserId,0)) 242 // RouteManager.jumpNewPage("pages/OtherNormalUserHomePage",new RouterObject(this.data.attentionUserId,0))
239 }) 243 })
240 } 244 }
  245 + followOperation(){
  246 + let item = new FollowOperationRequestItem(this.data.cnUserType,this.data.cnUserId,this.data.creatorId,HttpUrlUtils.getYcgUserType(),HttpUrlUtils.getYcgUserId(),this.data.status==="0" ? 1:0)
  247 + MinePageDatasModel.getFollowOperation(item,getContext(this)).then((value)=>{
  248 + if(value!=null){
  249 + if (value.code === 0 || value.code.toString() === "0") {
  250 + this.data.status = this.data.status ==="0"?"1":"0"
  251 + }
  252 + }
  253 + })
  254 + }
241 } 255 }
1 import { LazyDataSource, StringUtils } from 'wdKit'; 1 import { LazyDataSource, StringUtils } from 'wdKit';
2 import MinePageDatasModel from '../../../../model/MinePageDatasModel'; 2 import MinePageDatasModel from '../../../../model/MinePageDatasModel';
  3 +import { HttpUrlUtils } from '../../../../network/HttpUrlUtils';
3 import RouteManager from '../../../../utils/RouteManager'; 4 import RouteManager from '../../../../utils/RouteManager';
4 import { CommentListItem } from '../../../../viewmodel/CommentListItem'; 5 import { CommentListItem } from '../../../../viewmodel/CommentListItem';
5 import { FollowListDetailItem } from '../../../../viewmodel/FollowListDetailItem'; 6 import { FollowListDetailItem } from '../../../../viewmodel/FollowListDetailItem';
6 import { FollowListDetailRequestItem } from '../../../../viewmodel/FollowListDetailRequestItem'; 7 import { FollowListDetailRequestItem } from '../../../../viewmodel/FollowListDetailRequestItem';
  8 +import { FollowOperationRequestItem } from '../../../../viewmodel/FollowOperationRequestItem';
7 import { RouterObject } from '../../../../viewmodel/RouterObject'; 9 import { RouterObject } from '../../../../viewmodel/RouterObject';
8 import { ListHasNoMoreDataUI } from '../../../reusable/ListHasNoMoreDataUI'; 10 import { ListHasNoMoreDataUI } from '../../../reusable/ListHasNoMoreDataUI';
9 11
@@ -150,7 +152,7 @@ export struct HomePageBottomComponent{ @@ -150,7 +152,7 @@ export struct HomePageBottomComponent{
150 this.hasMore = false 152 this.hasMore = false
151 }else{ 153 }else{
152 value.list.forEach((value)=>{ 154 value.list.forEach((value)=>{
153 - this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum,value.introduction,value.attentionCreatorId,"1",value.attentionUserId)) 155 + this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum,value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.attentionUserType,value.attentionUserId))
154 }) 156 })
155 this.data_follow.notifyDataReload() 157 this.data_follow.notifyDataReload()
156 this.count = this.data_follow.totalCount() 158 this.count = this.data_follow.totalCount()
@@ -175,7 +177,7 @@ export struct HomePageBottomComponent{ @@ -175,7 +177,7 @@ export struct HomePageBottomComponent{
175 this.hasMore = false 177 this.hasMore = false
176 }else{ 178 }else{
177 value.list.forEach((value)=>{ 179 value.list.forEach((value)=>{
178 - this.data_comment.push(new CommentListItem(value.fromUserHeader,value.fromUserName,value.targetTitle,value.createTime,value.commentContent,value.likeNum,0,value.id)) 180 + this.data_comment.push(new CommentListItem(value.fromUserHeader,value.fromUserName,value.targetTitle,value.createTime,value.commentContent,value.likeNum,0,value.id,value.targetId,value.targetType))
179 }) 181 })
180 this.data_comment.notifyDataReload() 182 this.data_comment.notifyDataReload()
181 this.count = this.data_comment.totalCount() 183 this.count = this.data_comment.totalCount()
@@ -244,7 +246,8 @@ struct ChildFollowComponent { @@ -244,7 +246,8 @@ struct ChildFollowComponent {
244 .height('46lpx') 246 .height('46lpx')
245 .margin({left:'4lpx',top:'23lpx'}) 247 .margin({left:'4lpx',top:'23lpx'})
246 .onClick(()=>{ 248 .onClick(()=>{
247 - this.data.status = "0" 249 + // this.data.status = "0"
  250 + this.followOperation()
248 }) 251 })
249 }else{ 252 }else{
250 Row(){ 253 Row(){
@@ -265,7 +268,8 @@ struct ChildFollowComponent { @@ -265,7 +268,8 @@ struct ChildFollowComponent {
265 .height('46lpx') 268 .height('46lpx')
266 .margin({left:'4lpx',top:'23lpx'}) 269 .margin({left:'4lpx',top:'23lpx'})
267 .onClick(()=>{ 270 .onClick(()=>{
268 - this.data.status = "1" 271 + // this.data.status = "1"
  272 + this.followOperation()
269 }) 273 })
270 } 274 }
271 }.alignItems(VerticalAlign.Top) 275 }.alignItems(VerticalAlign.Top)
@@ -280,6 +284,17 @@ struct ChildFollowComponent { @@ -280,6 +284,17 @@ struct ChildFollowComponent {
280 }.height('146lpx') 284 }.height('146lpx')
281 .justifyContent(FlexAlign.Center) 285 .justifyContent(FlexAlign.Center)
282 } 286 }
  287 +
  288 + followOperation(){
  289 + let item = new FollowOperationRequestItem(this.data.cnUserType,this.data.cnUserId,this.data.creatorId,HttpUrlUtils.getYcgUserType(),HttpUrlUtils.getYcgUserId(),this.data.status==="0" ? 1:0)
  290 + MinePageDatasModel.getFollowOperation(item,getContext(this)).then((value)=>{
  291 + if(value!=null){
  292 + if (value.code === 0 || value.code.toString() === "0") {
  293 + this.data.status = this.data.status ==="0"?"1":"0"
  294 + }
  295 + }
  296 + })
  297 + }
283 } 298 }
284 299
285 @Component 300 @Component
@@ -296,14 +311,13 @@ struct ChildCommentComponent { @@ -296,14 +311,13 @@ struct ChildCommentComponent {
296 .objectFit(ImageFit.Auto) 311 .objectFit(ImageFit.Auto)
297 .width('69lpx') 312 .width('69lpx')
298 .height('69lpx') 313 .height('69lpx')
299 - .margin({right:'15lpx'})  
300 .borderRadius(50) 314 .borderRadius(50)
301 Image(this.levelHead) 315 Image(this.levelHead)
302 .width('89lpx') 316 .width('89lpx')
303 .height('89lpx') 317 .height('89lpx')
304 .objectFit(ImageFit.Cover) 318 .objectFit(ImageFit.Cover)
305 .borderRadius(50) 319 .borderRadius(50)
306 - } 320 + }.margin({right:'15lpx'})
307 321
308 Column(){ 322 Column(){
309 Text(this.data.fromUserName) 323 Text(this.data.fromUserName)
@@ -367,4 +381,7 @@ struct ChildCommentComponent { @@ -367,4 +381,7 @@ struct ChildCommentComponent {
367 } 381 }
368 .justifyContent(FlexAlign.Center) 382 .justifyContent(FlexAlign.Center)
369 } 383 }
  384 +
  385 +
  386 +
370 } 387 }
@@ -5,6 +5,7 @@ import { OtherUserCommentListRequestItem } from '../../../../viewmodel/OtherUser @@ -5,6 +5,7 @@ import { OtherUserCommentListRequestItem } from '../../../../viewmodel/OtherUser
5 import MinePageDatasModel from '../../../../model/MinePageDatasModel'; 5 import MinePageDatasModel from '../../../../model/MinePageDatasModel';
6 import { MineCommentListDetailItem } from '../../../../viewmodel/MineCommentListDetailItem'; 6 import { MineCommentListDetailItem } from '../../../../viewmodel/MineCommentListDetailItem';
7 import { OtherUserCommentLikeStatusRequestItem } from '../../../../viewmodel/OtherUserCommentLikeStatusRequestItem'; 7 import { OtherUserCommentLikeStatusRequestItem } from '../../../../viewmodel/OtherUserCommentLikeStatusRequestItem';
  8 +import { CommentLikeOperationRequestItem } from '../../../../viewmodel/CommentLikeOperationRequestItem';
8 9
9 const TAG = "HomePageBottomComponent" 10 const TAG = "HomePageBottomComponent"
10 @Component 11 @Component
@@ -87,7 +88,7 @@ export struct OtherHomePageBottomCommentComponent{ @@ -87,7 +88,7 @@ export struct OtherHomePageBottomCommentComponent{
87 if (!this.data_comment || value.list.length == 0){ 88 if (!this.data_comment || value.list.length == 0){
88 this.hasMore = false 89 this.hasMore = false
89 }else{ 90 }else{
90 - this.getFollowListStatus(value) 91 + this.getCommentListStatus(value)
91 } 92 }
92 }).catch((err:Error)=>{ 93 }).catch((err:Error)=>{
93 console.log(TAG,"请求失败") 94 console.log(TAG,"请求失败")
@@ -96,13 +97,13 @@ export struct OtherHomePageBottomCommentComponent{ @@ -96,13 +97,13 @@ export struct OtherHomePageBottomCommentComponent{
96 } 97 }
97 } 98 }
98 99
99 - getFollowListStatus(value:MineCommentListDetailItem){ 100 + getCommentListStatus(value:MineCommentListDetailItem){
100 101
101 let status = new OtherUserCommentLikeStatusRequestItem() 102 let status = new OtherUserCommentLikeStatusRequestItem()
102 let data : CommentListItem[] = [] 103 let data : CommentListItem[] = []
103 value.list.forEach((item)=>{ 104 value.list.forEach((item)=>{
104 status.commentIdList.push(item.id) 105 status.commentIdList.push(item.id)
105 - data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,item.commentContent,item.likeNum,0,item.id)) 106 + data.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,item.commentContent,item.likeNum,0,item.id,item.targetId,item.targetType))
106 }) 107 })
107 108
108 MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{ 109 MinePageDatasModel.getOtherUserCommentLikeStatusData(status,getContext(this)).then((newValue)=>{
@@ -115,7 +116,7 @@ export struct OtherHomePageBottomCommentComponent{ @@ -115,7 +116,7 @@ export struct OtherHomePageBottomCommentComponent{
115 }) 116 })
116 117
117 data.forEach((item)=>{ 118 data.forEach((item)=>{
118 - this.data_comment.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,item.commentContent,item.likeNum,item.like_status,item.id)) 119 + this.data_comment.push(new CommentListItem(item.fromUserHeader,item.fromUserName,item.targetTitle,item.createTime,item.commentContent,item.likeNum,item.like_status,item.id,item.targetId,item.targetType))
119 }) 120 })
120 121
121 this.data_comment.notifyDataReload() 122 this.data_comment.notifyDataReload()
@@ -150,14 +151,14 @@ struct ChildCommentComponent { @@ -150,14 +151,14 @@ struct ChildCommentComponent {
150 .objectFit(ImageFit.Auto) 151 .objectFit(ImageFit.Auto)
151 .width('69lpx') 152 .width('69lpx')
152 .height('69lpx') 153 .height('69lpx')
153 - .margin({right:'15lpx'}) 154 +
154 .borderRadius(50) 155 .borderRadius(50)
155 Image(this.levelHead) 156 Image(this.levelHead)
156 .width('89lpx') 157 .width('89lpx')
157 .height('89lpx') 158 .height('89lpx')
158 .objectFit(ImageFit.Cover) 159 .objectFit(ImageFit.Cover)
159 .borderRadius(50) 160 .borderRadius(50)
160 - } 161 + }.margin({right:'15lpx'})
161 162
162 Column(){ 163 Column(){
163 Text(this.data.fromUserName) 164 Text(this.data.fromUserName)
@@ -189,7 +190,9 @@ struct ChildCommentComponent { @@ -189,7 +190,9 @@ struct ChildCommentComponent {
189 .objectFit(ImageFit.Auto) 190 .objectFit(ImageFit.Auto)
190 .interpolation(ImageInterpolation.Medium) 191 .interpolation(ImageInterpolation.Medium)
191 .borderRadius(50) 192 .borderRadius(50)
192 - } 193 + }.onClick(()=>{
  194 + this.commentLikeOperation()
  195 + })
193 196
194 } 197 }
195 .margin({bottom:'10lpx'}) 198 .margin({bottom:'10lpx'})
@@ -237,4 +240,16 @@ struct ChildCommentComponent { @@ -237,4 +240,16 @@ struct ChildCommentComponent {
237 } 240 }
238 .justifyContent(FlexAlign.Center) 241 .justifyContent(FlexAlign.Center)
239 } 242 }
  243 +
  244 + commentLikeOperation(){
  245 + let item = new CommentLikeOperationRequestItem(this.data.targetId,this.data.id+"",this.data.targetType+"",this.data.fromUserName,this.data.fromUserHeader,this.data.like_status===0?1:0)
  246 + MinePageDatasModel.getCommentLikeOperation(item,getContext(this)).then((value)=>{
  247 + if(value!=null){
  248 + if (value.code === 0 || value.code.toString() === "0") {
  249 + this.data.like_status = this.data.like_status===0?1:0
  250 + this.data.likeNum = this.data.like_status===0?this.data.likeNum-1:this.data.likeNum+1
  251 + }
  252 + }
  253 + })
  254 + }
240 } 255 }
@@ -113,7 +113,7 @@ export struct OtherHomePageBottomFollowComponent{ @@ -113,7 +113,7 @@ export struct OtherHomePageBottomFollowComponent{
113 this.hasMore = false 113 this.hasMore = false
114 }else{ 114 }else{
115 value.list.forEach((value)=>{ 115 value.list.forEach((value)=>{
116 - this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum,value.introduction,value.attentionCreatorId,"1",value.attentionUserId)) 116 + this.data_follow.push(new FollowListDetailItem(value.attentionHeadPhotoUrl,value.attentionUserName,value.fansNum,value.introduction,value.attentionCreatorId,"1",value.attentionUserId,value.cnUserType,value.cnUserId))
117 }) 117 })
118 this.data_follow.notifyDataReload() 118 this.data_follow.notifyDataReload()
119 this.count = this.data_follow.totalCount() 119 this.count = this.data_follow.totalCount()
@@ -139,24 +139,25 @@ export struct OtherUserHomeComponent { @@ -139,24 +139,25 @@ export struct OtherUserHomeComponent {
139 .padding({ left: '35lpx' }) 139 .padding({ left: '35lpx' })
140 140
141 //用户简介区域 141 //用户简介区域
142 - Column() {  
143 - Row() {  
144 - Text(this.desc)  
145 - .fontSize('27lpx')  
146 - .maxLines(3)  
147 - .textOverflow({ overflow: TextOverflow.Ellipsis })  
148 - .lineHeight('40lpx')  
149 - .fontWeight('400lpx')  
150 - .fontColor($r('app.color.color_222222'))  
151 - .textAlign(TextAlign.Start) 142 + if(StringUtils.isNotEmpty(this.desc)){
  143 + Column() {
  144 + Row() {
  145 + Text(this.desc)
  146 + .fontSize('27lpx')
  147 + .maxLines(3)
  148 + .textOverflow({ overflow: TextOverflow.Ellipsis })
  149 + .lineHeight('40lpx')
  150 + .fontWeight('400lpx')
  151 + .fontColor($r('app.color.color_222222'))
  152 + .textAlign(TextAlign.Start)
152 153
153 - }  
154 - }.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'})  
155 - .alignItems(HorizontalAlign.Start)  
156 - .justifyContent(FlexAlign.Center)  
157 - .width('100%')  
158 - .backgroundColor($r('app.color.white'))  
159 - .visibility(StringUtils.isEmpty(this.desc)?Visibility.Hidden:Visibility.Visible) 154 + }
  155 + }.padding({ left: '31lpx',right:'31lpx',top:'19lpx',bottom:'31lpx'})
  156 + .alignItems(HorizontalAlign.Start)
  157 + .justifyContent(FlexAlign.Center)
  158 + .width('100%')
  159 + .backgroundColor($r('app.color.white'))
  160 + }
160 161
161 //间隔符 162 //间隔符
162 Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx') 163 Divider().width('100%').height('12lpx').color($r('app.color.color_F5F5F5')).strokeWidth('12lpx')
@@ -22,6 +22,8 @@ import { QueryCommentListIsLikedItem } from '../viewmodel/QueryCommentListIsLike @@ -22,6 +22,8 @@ import { QueryCommentListIsLikedItem } from '../viewmodel/QueryCommentListIsLike
22 import { UserFollowListRequestItem } from '../viewmodel/UserFollowListRequestItem'; 22 import { UserFollowListRequestItem } from '../viewmodel/UserFollowListRequestItem';
23 import { OtherUserDetailRequestItem } from '../viewmodel/OtherUserDetailRequestItem'; 23 import { OtherUserDetailRequestItem } from '../viewmodel/OtherUserDetailRequestItem';
24 import { AppointmentOperationRequestItem } from '../viewmodel/AppointmentOperationRequestItem'; 24 import { AppointmentOperationRequestItem } from '../viewmodel/AppointmentOperationRequestItem';
  25 +import { FollowOperationRequestItem } from '../viewmodel/FollowOperationRequestItem';
  26 +import { CommentLikeOperationRequestItem } from '../viewmodel/CommentLikeOperationRequestItem';
25 const TAG = "MinePageDatasModel" 27 const TAG = "MinePageDatasModel"
26 28
27 /** 29 /**
@@ -676,6 +678,86 @@ class MinePageDatasModel{ @@ -676,6 +678,86 @@ class MinePageDatasModel{
676 return compRes 678 return compRes
677 } 679 }
678 680
  681 + /**
  682 + * 评论点赞操作
  683 + * @param params
  684 + * @param context
  685 + * @returns
  686 + */
  687 + getCommentLikeOperation(params:CommentLikeOperationRequestItem,context: Context): Promise<ResponseDTO> {
  688 + return new Promise((success, error) => {
  689 + Logger.info(TAG, `getAppointmentList start`);
  690 + this.fetchCommentLikeOperation(params).then((navResDTO: ResponseDTO) => {
  691 + if (!navResDTO || navResDTO.code != 0) {
  692 + success(this.getCommentLikeOperationLocal(context))
  693 + return
  694 + }
  695 + Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
  696 + success(navResDTO);
  697 + }).catch((err: Error) => {
  698 + Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
  699 + success(this.getCommentLikeOperationLocal(context))
  700 + })
  701 + })
  702 + }
  703 +
  704 + fetchCommentLikeOperation(object:CommentLikeOperationRequestItem) {
  705 + let url = HttpUrlUtils.getCommentLikeOperationUrl()
  706 + let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders();
  707 + return WDHttp.post<ResponseDTO>(url,object, headers)
  708 + };
  709 +
  710 + async getCommentLikeOperationLocal(context: Context): Promise<ResponseDTO> {
  711 + Logger.info(TAG, `getMineFollowListDataLocal start`);
  712 + let compRes: ResponseDTO | null = await ResourcesUtils.getResourcesJson<ResponseDTO>('comment_like_operation_data.json',context);
  713 + if (!compRes ) {
  714 + Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`);
  715 + return compRes
  716 + }
  717 + Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
  718 + return compRes
  719 + }
  720 +
  721 + /**
  722 + * 关注 取消关注 操作
  723 + * @param params
  724 + * @param context
  725 + * @returns
  726 + */
  727 + getFollowOperation(params:FollowOperationRequestItem,context: Context): Promise<ResponseDTO> {
  728 + return new Promise((success, error) => {
  729 + Logger.info(TAG, `getAppointmentList start`);
  730 + this.fetchFollowOperation(params).then((navResDTO: ResponseDTO) => {
  731 + if (!navResDTO || navResDTO.code != 0) {
  732 + success(this.getFollowOperationLocal(context))
  733 + return
  734 + }
  735 + Logger.info(TAG, "getAppointmentList then,AppointmentResDTO.timeStamp:" + navResDTO.timestamp);
  736 + success(navResDTO);
  737 + }).catch((err: Error) => {
  738 + Logger.error(TAG, `fetchAppointmentListDataApi catch, error.name : ${err.name}, error.message:${err.message}`);
  739 + success(this.getFollowOperationLocal(context))
  740 + })
  741 + })
  742 + }
  743 +
  744 + fetchFollowOperation(object:FollowOperationRequestItem) {
  745 + let url = HttpUrlUtils.getFollowOperationUrl()
  746 + let headers: HashMap<string, string> = HttpUrlUtils.getYcgCommonHeaders();
  747 + return WDHttp.post<ResponseDTO>(url,object, headers)
  748 + };
  749 +
  750 + async getFollowOperationLocal(context: Context): Promise<ResponseDTO> {
  751 + Logger.info(TAG, `getMineFollowListDataLocal start`);
  752 + let compRes: ResponseDTO | null = await ResourcesUtils.getResourcesJson<ResponseDTO>('follow_operation_data.json',context);
  753 + if (!compRes ) {
  754 + Logger.info(TAG, `getMineFollowListDataLocal compRes is empty`);
  755 + return compRes
  756 + }
  757 + Logger.info(TAG, `getMineFollowListDataLocal getResourcesJsonSync compRes : ${JSON.stringify(compRes)}`);
  758 + return compRes
  759 + }
  760 +
679 } 761 }
680 762
681 const minePageDatasModel = MinePageDatasModel.getInstance() 763 const minePageDatasModel = MinePageDatasModel.getInstance()
@@ -248,6 +248,26 @@ export class HttpUrlUtils { @@ -248,6 +248,26 @@ export class HttpUrlUtils {
248 return url 248 return url
249 } 249 }
250 250
  251 + static getCommentLikeOperationUrl() {
  252 + let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.COMMENT_LIKE_OPERATION_PATH
  253 + return url
  254 + }
  255 +
  256 + static getFollowOperationUrl() {
  257 + let url = HttpUrlUtils.HOST_SIT + HttpUrlUtils.FOLLOW_OPERATION_PATH
  258 + return url
  259 + }
  260 +
  261 +
  262 + /**
  263 + * 预约操作
  264 + */
  265 + static readonly COMMENT_LIKE_OPERATION_PATH: string = "/api/rmrb-comment/comment/zh/c/commentLike";
  266 + /**
  267 + * 关注操作
  268 + */
  269 + static readonly FOLLOW_OPERATION_PATH: string = "https://pd-apis-sit.pdnews.cn/api/rmrb-interact/interact/zh/c/attention/operation";
  270 +
251 static getYcgCommonHeaders(): HashMap<string, string> { 271 static getYcgCommonHeaders(): HashMap<string, string> {
252 let headers: HashMap<string, string> = new HashMap<string, string>() 272 let headers: HashMap<string, string> = new HashMap<string, string>()
253 273
@@ -402,4 +422,12 @@ export class HttpUrlUtils { @@ -402,4 +422,12 @@ export class HttpUrlUtils {
402 private static getUserType() { 422 private static getUserType() {
403 return '2'; 423 return '2';
404 } 424 }
  425 +
  426 + public static getYcgUserType() {
  427 + return '1';
  428 + }
  429 +
  430 + public static getYcgUserId() {
  431 + return '459776297474949';
  432 + }
405 } 433 }
  1 +// {
  2 +// "targetId":"30000627490",
  3 +// "commentId":"303318",
  4 +// "targetType":"13",
  5 +// "userName":"人民日报网友aPrtq5",
  6 +// "userHeaderUrl":"https://sitcontentjdcdn.aikan.pdnews.cn//img/user/2024031215/48d5bd53227d436b9faa937b3ac14600.png",
  7 +// "status":1
  8 +// }
  9 +export class CommentLikeOperationRequestItem{
  10 + targetId:string = ""
  11 + commentId:string = ""
  12 + targetType:string = ""
  13 + userName:string = ""
  14 + userHeaderUrl:string = ""
  15 + status:number = 1
  16 +
  17 + constructor(targetId: string, commentId: string, targetType: string , userName: string,
  18 + userHeaderUrl: string , status:number) {
  19 + this.targetId = targetId
  20 + this.commentId = commentId
  21 + this.targetType = targetType
  22 + this.userName = userName
  23 + this.userHeaderUrl = userHeaderUrl
  24 + this.status = status
  25 +}
  26 +
  27 +}
@@ -10,8 +10,10 @@ export class CommentListItem{ @@ -10,8 +10,10 @@ export class CommentListItem{
10 likeNum:number = 0 10 likeNum:number = 0
11 like_status:number = 0 11 like_status:number = 0
12 id:number = 0 12 id:number = 0
  13 + targetId:string = ""
  14 + targetType:number = 0
13 15
14 - constructor(fromUserHeader:string,fromUserName:string,targetTitle:string,createTime:string,commentContent:string,likeNum:number,like_status:number,id:number) { 16 + constructor(fromUserHeader:string,fromUserName:string,targetTitle:string,createTime:string,commentContent:string,likeNum:number,like_status:number,id:number,targetId:string,targetType:number) {
15 this.fromUserHeader = fromUserHeader 17 this.fromUserHeader = fromUserHeader
16 this.fromUserName = fromUserName 18 this.fromUserName = fromUserName
17 this.commentContent = commentContent 19 this.commentContent = commentContent
@@ -20,5 +22,7 @@ export class CommentListItem{ @@ -20,5 +22,7 @@ export class CommentListItem{
20 this.likeNum = likeNum 22 this.likeNum = likeNum
21 this.like_status = like_status 23 this.like_status = like_status
22 this.id = id 24 this.id = id
  25 + this.targetId = targetId
  26 + this.targetType = targetType
23 } 27 }
24 } 28 }
@@ -69,13 +69,18 @@ export class FollowListDetailItem{ @@ -69,13 +69,18 @@ export class FollowListDetailItem{
69 creatorId:string = "" 69 creatorId:string = ""
70 attentionUserId:string = "" 70 attentionUserId:string = ""
71 71
  72 + cnUserType:string = ""
  73 + cnUserId:string = ""
  74 +
  75 +
72 attentionCreatorId:string = "" 76 attentionCreatorId:string = ""
  77 + attentionUserType:string = ""
73 attentionHeadPhotoUrl:string = "" 78 attentionHeadPhotoUrl:string = ""
74 attentionUserName:string = "" 79 attentionUserName:string = ""
75 fansNum :number = 0 80 fansNum :number = 0
76 81
77 82
78 - constructor(headPhotoUrl:string,cnUserName:string,cnFansNum:number,introduction:string,creatorId:string,status:string,attentionUserId:string) { 83 + constructor(headPhotoUrl:string,cnUserName:string,cnFansNum:number,introduction:string,creatorId:string,status:string,attentionUserId:string,cnUserType:string,cnUserId:string) {
79 this.headPhotoUrl = headPhotoUrl 84 this.headPhotoUrl = headPhotoUrl
80 this.cnUserName = cnUserName 85 this.cnUserName = cnUserName
81 this.cnFansNum = cnFansNum 86 this.cnFansNum = cnFansNum
@@ -83,5 +88,7 @@ export class FollowListDetailItem{ @@ -83,5 +88,7 @@ export class FollowListDetailItem{
83 this.creatorId = creatorId 88 this.creatorId = creatorId
84 this.status = status 89 this.status = status
85 this.attentionUserId = attentionUserId 90 this.attentionUserId = attentionUserId
  91 + this.cnUserType = cnUserType
  92 + this.cnUserId = cnUserId
86 } 93 }
87 } 94 }
  1 +// {
  2 +// "attentionUserType":"2",
  3 +// "attentionUserId":"444911718724933",
  4 +// "attentionCreatorId":"3004861",
  5 +// "userType":1,
  6 +// "userId":"567387477063621",
  7 +// "status":1
  8 +// }
  9 +export class FollowOperationRequestItem{
  10 + attentionUserType:string = ""
  11 + attentionUserId:string = ""
  12 + attentionCreatorId:string = ""
  13 + userType:string = ""
  14 + userId:string = ""
  15 + status:number = 1
  16 +
  17 + constructor(attentionUserType:string, attentionUserId:string, attentionCreatorId:string, userType:string, userId:string, status:number) {
  18 + this.attentionUserType = attentionUserType
  19 + this.attentionUserId = attentionUserId
  20 + this.attentionCreatorId = attentionCreatorId
  21 + this.userType = userType
  22 + this.userId = userId
  23 + this.status = status
  24 + }
  25 +
  26 +}
@@ -18,7 +18,7 @@ export class CommentLikeOperationRequestItem{ @@ -18,7 +18,7 @@ export class CommentLikeOperationRequestItem{
18 userHeaderUrl: string , status:number) { 18 userHeaderUrl: string , status:number) {
19 this.targetId = targetId 19 this.targetId = targetId
20 this.commentId = commentId 20 this.commentId = commentId
21 - this.targetId = targetId 21 + this.targetType = targetType
22 this.userName = userName 22 this.userName = userName
23 this.userHeaderUrl = userHeaderUrl 23 this.userHeaderUrl = userHeaderUrl
24 this.status = status 24 this.status = status