更新代码

This commit is contained in:
2024-09-07 20:26:15 +08:00
parent 49aea88b0b
commit 03a4db8a4b
12 changed files with 370 additions and 63 deletions

View File

@@ -21,7 +21,8 @@ interface CommentService {
pageNumber: Int,
postId: Int? = null,
postUser: Int? = null,
selfNotice: Boolean? = null
selfNotice: Boolean? = null,
order: String? = null
): ListContainer<CommentEntity>
/**
@@ -48,6 +49,12 @@ interface CommentService {
* @param commentId 评论ID
*/
suspend fun updateReadStatus(commentId: Int)
/**
* 删除评论
* @param commentId 评论ID
*/
suspend fun DeleteComment(commentId: Int)
}
/**
@@ -119,13 +126,15 @@ class CommentRemoteDataSource(
pageNumber: Int,
postId: Int?,
postUser: Int?,
selfNotice: Boolean?
selfNotice: Boolean?,
order: String?
): ListContainer<CommentEntity> {
return commentService.getComments(
pageNumber,
postId,
postUser = postUser,
selfNotice = selfNotice
selfNotice = selfNotice,
order = order
)
}
}
@@ -136,12 +145,14 @@ class CommentServiceImpl : CommentService {
pageNumber: Int,
postId: Int?,
postUser: Int?,
selfNotice: Boolean?
selfNotice: Boolean?,
order: String?
): ListContainer<CommentEntity> {
val resp = ApiClient.api.getComments(
page = pageNumber,
postId = postId,
postUser = postUser,
order = order,
selfNotice = selfNotice?.let {
if (it) 1 else 0
}
@@ -175,4 +186,8 @@ class CommentServiceImpl : CommentService {
return
}
override suspend fun DeleteComment(commentId: Int) {
val resp = ApiClient.api.deleteComment(commentId)
return
}
}

View File

@@ -174,6 +174,7 @@ interface RiderProAPI {
@Query("pageSize") pageSize: Int = 20,
@Query("postUser") postUser: Int? = null,
@Query("selfNotice") selfNotice: Int? = 0,
@Query("order") order: String? = null,
): Response<ListContainer<Comment>>
@GET("account/my")
@@ -257,4 +258,9 @@ interface RiderProAPI {
@Path("id") id: Int
): Response<Unit>
@DELETE("comment/{id}")
suspend fun deleteComment(
@Path("id") id: Int
): Response<Unit>
}