|
@@ -28,6 +28,9 @@ class CommunityAllCommentView: FWPopupView {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 视频贴のModel
|
|
|
+ var videoItemModel: CommunityVideoItemModel?
|
|
|
+
|
|
|
// 评论
|
|
|
var communityPostCommentsModel : CommunityPostCommentsModel?
|
|
|
var communityPostCommentModels = Array<CommunityPostCommentModel>()
|
|
@@ -97,7 +100,7 @@ class CommunityAllCommentView: FWPopupView {
|
|
|
|
|
|
commentInputView.commentInputViewClosure = {
|
|
|
[weak self] text in
|
|
|
-// self?.communityPostCommentApi(text: text)
|
|
|
+ self?.communityPostCommentApi(text: text)
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -229,6 +232,65 @@ extension CommunityAllCommentView {
|
|
|
self?.noCommentsLabel.isHidden = true
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ /// 评论
|
|
|
+ func communityPostCommentApi(text:String) {
|
|
|
+ let communityCustomCommnetModel = CommunityCustomCommnetModel()
|
|
|
+ communityCustomCommnetModel.postId = videoItemModel?.id ?? 0
|
|
|
+ communityCustomCommnetModel.content = text
|
|
|
+ if communityPostCommentModel != nil {
|
|
|
+ communityCustomCommnetModel.parentId = communityPostCommentModel?.id
|
|
|
+ communityCustomCommnetModel.replyUid = communityPostCommentModel?.uid
|
|
|
+ communityCustomCommnetModel.replyUsername = communityPostCommentModel?.username
|
|
|
+ }
|
|
|
|
|
|
+ SwiftMoyaNetWorkServiceCommunity.shared().communityPostCommentApi(communityCustomCommnetModel: communityCustomCommnetModel) {
|
|
|
+ [weak self] (communityPostCommentIdModel) -> (Void) in
|
|
|
+
|
|
|
+ let communityPostCommentIdModel = communityPostCommentIdModel as? CommunityPostCommentIdModel
|
|
|
+
|
|
|
+
|
|
|
+ if self?.communityPostCommentModel == nil { //评
|
|
|
+ let communityPostCommentModel = CommunityPostCommentModel()
|
|
|
+ communityPostCommentModel.avatar = UserModel.shared().getModel()?.avatarurl
|
|
|
+ communityPostCommentModel.content = text
|
|
|
+ communityPostCommentModel.createdAt = "刚刚"
|
|
|
+ communityPostCommentModel.id = communityPostCommentIdModel?.id
|
|
|
+ communityPostCommentModel.username = UserModel.shared().getModel()?.username
|
|
|
+ communityPostCommentModel.uid = UserModel.shared().getModel()?.uid
|
|
|
+ self?.communityPostCommentModels.insert(communityPostCommentModel, at: 0)
|
|
|
+
|
|
|
+
|
|
|
+ VirusViewModel.shared.comment(communityVideoItemModel: (self?.videoItemModel)!, id: communityPostCommentIdModel?.id ?? 0)
|
|
|
+
|
|
|
+ self?.tableView.reloadData()
|
|
|
+
|
|
|
+ }else { //回评论
|
|
|
+ let communityPostReplyModel = CommunityPostReplyModel()
|
|
|
+ communityPostReplyModel.avatar = UserModel.shared().getModel()?.avatarurl
|
|
|
+ communityPostReplyModel.content = text
|
|
|
+ communityPostReplyModel.createdAt = "刚刚"
|
|
|
+ communityPostReplyModel.id = communityPostCommentIdModel?.id
|
|
|
+ communityPostReplyModel.username = UserModel.shared().getModel()?.username
|
|
|
+ communityPostReplyModel.uid = UserModel.shared().getModel()?.uid
|
|
|
+ let count = self?.communityPostCommentModel?.replyCount ?? 0 + 1
|
|
|
+ self?.communityPostCommentModel?.replyCount = count
|
|
|
+ if self?.communityPostCommentModel?.reply == nil {
|
|
|
+ self?.communityPostCommentModel?.reply = Array<CommunityPostReplyModel>()
|
|
|
+ }
|
|
|
+ self?.communityPostCommentModel?.reply?.insert(communityPostReplyModel, at: 0)
|
|
|
+
|
|
|
+// VirusViewModel.shared.comment(communityVideoItemModel: (self?.videoItemModel)!, id: communityPostCommentIdModel?.id ?? 0, communityPostCommentModel: <#T##CommunityPostCommentModel?#>, communityPostReplyModel: <#T##CommunityPostReplyModel?#>)
|
|
|
+//
|
|
|
+// self?.communityPostCommentModel
|
|
|
+
|
|
|
+ self?.tableView.reloadData()
|
|
|
+ }
|
|
|
+ self?.commentInputView.sendSuccess()
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|