|
@@ -477,10 +477,10 @@ extension VirusViewModel {
|
|
|
}
|
|
|
// MARK: - 评论
|
|
|
extension VirusViewModel {
|
|
|
- func comment(communityPostDetailModel:CommunityPostDetailModel,id:Int,communityPostCommentModel:CommunityPostCommentModel? = nil,communityPostReplyModel:CommunityPostReplyModel? = nil) {
|
|
|
+ func comment(communityPostDetailModel:CommunityPostDetailModel,id:Int,content:String,communityPostCommentModel:CommunityPostCommentModel? = nil,communityPostReplyModel:CommunityPostReplyModel? = nil) {
|
|
|
let virueRecordAddParameterModel = VirueRecordAddParameterModel()
|
|
|
- virueRecordAddParameterModel.behaviorId = (ConfigModel.shared.object()?.virus?.publish ?? "")
|
|
|
- virueRecordAddParameterModel.behaviorFlag = BehaviorFlagType.publish.rawValue
|
|
|
+ virueRecordAddParameterModel.behaviorId = (ConfigModel.shared.object()?.virus?.comment ?? "")
|
|
|
+ virueRecordAddParameterModel.behaviorFlag = BehaviorFlagType.comment.rawValue
|
|
|
|
|
|
virueRecordAddParameterModel.postId = communityPostDetailModel.id
|
|
|
virueRecordAddParameterModel.postAuthorUid = "\(communityPostDetailModel.uid!)"
|
|
@@ -493,24 +493,24 @@ extension VirusViewModel {
|
|
|
virueRecordAddParameterModel.postCover = communityPostDetailModel.img
|
|
|
|
|
|
virueRecordAddParameterModel.actionId = "\(id)"
|
|
|
-
|
|
|
- virueRecordAddParameterModel.commentId = communityPostCommentModel?.id
|
|
|
- virueRecordAddParameterModel.commentContent = communityPostCommentModel?.content
|
|
|
|
|
|
virueRecordAddParameterModel.parentCommentId = communityPostReplyModel?.id
|
|
|
virueRecordAddParameterModel.parentCommentContent = communityPostReplyModel?.content
|
|
|
virueRecordAddParameterModel.parentCommentUid = communityPostReplyModel?.uid
|
|
|
virueRecordAddParameterModel.parentCommentTime = communityPostReplyModel?.createdAt
|
|
|
+
|
|
|
+ virueRecordAddParameterModel.commentContent = content
|
|
|
+ virueRecordAddParameterModel.commentId = id
|
|
|
|
|
|
|
|
|
SwiftMoyaNetWorkServiceVirus.shared().virueRecordAddApi(virueRecordAddParameterModel: virueRecordAddParameterModel, completion: {(data) -> (Void) in
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- func comment(communityVideoItemModel:CommunityVideoItemModel,id:Int,communityPostCommentModel:CommunityPostCommentModel? = nil,communityPostReplyModel:CommunityPostReplyModel? = nil) {
|
|
|
+ func comment(communityVideoItemModel:CommunityVideoItemModel,id:Int,content:String,communityPostCommentModel:CommunityPostCommentModel? = nil,communityPostReplyModel:CommunityPostReplyModel? = nil) {
|
|
|
let virueRecordAddParameterModel = VirueRecordAddParameterModel()
|
|
|
- virueRecordAddParameterModel.behaviorId = (ConfigModel.shared.object()?.virus?.publish ?? "")
|
|
|
- virueRecordAddParameterModel.behaviorFlag = BehaviorFlagType.publish.rawValue
|
|
|
+ virueRecordAddParameterModel.behaviorId = (ConfigModel.shared.object()?.virus?.comment ?? "")
|
|
|
+ virueRecordAddParameterModel.behaviorFlag = BehaviorFlagType.comment.rawValue
|
|
|
|
|
|
virueRecordAddParameterModel.postId = communityVideoItemModel.id
|
|
|
virueRecordAddParameterModel.postAuthorUid = "\(communityVideoItemModel.uid!)"
|
|
@@ -524,23 +524,23 @@ extension VirusViewModel {
|
|
|
|
|
|
virueRecordAddParameterModel.actionId = "\(id)"
|
|
|
|
|
|
- virueRecordAddParameterModel.commentId = communityPostCommentModel?.id
|
|
|
- virueRecordAddParameterModel.commentContent = communityPostCommentModel?.content
|
|
|
-
|
|
|
virueRecordAddParameterModel.parentCommentId = communityPostReplyModel?.id
|
|
|
virueRecordAddParameterModel.parentCommentContent = communityPostReplyModel?.content
|
|
|
virueRecordAddParameterModel.parentCommentUid = communityPostReplyModel?.uid
|
|
|
virueRecordAddParameterModel.parentCommentTime = communityPostReplyModel?.createdAt
|
|
|
|
|
|
+ virueRecordAddParameterModel.commentContent = content
|
|
|
+ virueRecordAddParameterModel.commentId = id
|
|
|
+
|
|
|
|
|
|
SwiftMoyaNetWorkServiceVirus.shared().virueRecordAddApi(virueRecordAddParameterModel: virueRecordAddParameterModel, completion: {(data) -> (Void) in
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- func comment(communityRecommendDataModel:CommunityRecommendDataModel? = nil,id:Int) {
|
|
|
+ func comment(communityRecommendDataModel:CommunityRecommendDataModel? = nil,id:Int,content:String) {
|
|
|
let virueRecordAddParameterModel = VirueRecordAddParameterModel()
|
|
|
- virueRecordAddParameterModel.behaviorId = (ConfigModel.shared.object()?.virus?.publish ?? "")
|
|
|
- virueRecordAddParameterModel.behaviorFlag = BehaviorFlagType.publish.rawValue
|
|
|
+ virueRecordAddParameterModel.behaviorId = (ConfigModel.shared.object()?.virus?.comment ?? "")
|
|
|
+ virueRecordAddParameterModel.behaviorFlag = BehaviorFlagType.comment.rawValue
|
|
|
|
|
|
virueRecordAddParameterModel.postId = communityRecommendDataModel?.id
|
|
|
virueRecordAddParameterModel.postAuthorUid = "\(communityRecommendDataModel?.uid ?? 0)"
|
|
@@ -550,19 +550,20 @@ extension VirusViewModel {
|
|
|
virueRecordAddParameterModel.postDesc = communityRecommendDataModel?.title
|
|
|
}
|
|
|
virueRecordAddParameterModel.postType = communityRecommendDataModel?.type
|
|
|
- virueRecordAddParameterModel.postCover = communityRecommendDataModel?.img
|
|
|
- virueRecordAddParameterModel.targetId = "\((UserModel.shared().getModel()?.uid)!)"
|
|
|
-
|
|
|
+ virueRecordAddParameterModel.postCover = communityRecommendDataModel?.img
|
|
|
virueRecordAddParameterModel.actionId = "\(id)"
|
|
|
|
|
|
+ virueRecordAddParameterModel.commentContent = content
|
|
|
+ virueRecordAddParameterModel.commentId = id
|
|
|
+
|
|
|
SwiftMoyaNetWorkServiceVirus.shared().virueRecordAddApi(virueRecordAddParameterModel: virueRecordAddParameterModel, completion: {(data) -> (Void) in
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- func comment(communityFollowDataModel:CommunityFollowDataModel? = nil,id:Int) {
|
|
|
+ func comment(communityFollowDataModel:CommunityFollowDataModel? = nil,id:Int,content:String) {
|
|
|
let virueRecordAddParameterModel = VirueRecordAddParameterModel()
|
|
|
- virueRecordAddParameterModel.behaviorId = (ConfigModel.shared.object()?.virus?.publish ?? "")
|
|
|
- virueRecordAddParameterModel.behaviorFlag = BehaviorFlagType.publish.rawValue
|
|
|
+ virueRecordAddParameterModel.behaviorId = (ConfigModel.shared.object()?.virus?.comment ?? "")
|
|
|
+ virueRecordAddParameterModel.behaviorFlag = BehaviorFlagType.comment.rawValue
|
|
|
|
|
|
virueRecordAddParameterModel.postId = communityFollowDataModel?.relateData?.id
|
|
|
virueRecordAddParameterModel.postAuthorUid = "\(communityFollowDataModel?.relateData?.uid ?? 0)"
|
|
@@ -575,6 +576,9 @@ extension VirusViewModel {
|
|
|
virueRecordAddParameterModel.postCover = communityFollowDataModel?.relateData?.img
|
|
|
virueRecordAddParameterModel.actionId = "\(id)"
|
|
|
virueRecordAddParameterModel.targetId = "\((UserModel.shared().getModel()?.uid)!)"
|
|
|
+
|
|
|
+ virueRecordAddParameterModel.commentContent = content
|
|
|
+ virueRecordAddParameterModel.commentId = id
|
|
|
|
|
|
|
|
|
SwiftMoyaNetWorkServiceVirus.shared().virueRecordAddApi(virueRecordAddParameterModel: virueRecordAddParameterModel, completion: {(data) -> (Void) in
|
|
@@ -583,31 +587,6 @@ extension VirusViewModel {
|
|
|
|
|
|
}
|
|
|
|
|
|
-// MARK: - 阅读
|
|
|
-extension VirusViewModel {
|
|
|
- func read(communityPostDetailModel:CommunityPostDetailModel) {
|
|
|
- let virueRecordAddParameterModel = VirueRecordAddParameterModel()
|
|
|
- virueRecordAddParameterModel.behaviorId = (ConfigModel.shared.object()?.virus?.read ?? "")
|
|
|
- virueRecordAddParameterModel.behaviorFlag = BehaviorFlagType.read.rawValue
|
|
|
-
|
|
|
- virueRecordAddParameterModel.postId = communityPostDetailModel.id
|
|
|
- virueRecordAddParameterModel.postAuthorUid = "\(communityPostDetailModel.uid!)"
|
|
|
- if communityPostDetailModel.title == nil || communityPostDetailModel.title == "" {
|
|
|
- virueRecordAddParameterModel.postDesc = String(describing: communityPostDetailModel.content!.prefix(20))
|
|
|
- }else {
|
|
|
- virueRecordAddParameterModel.postDesc = communityPostDetailModel.title
|
|
|
- }
|
|
|
- virueRecordAddParameterModel.postType = communityPostDetailModel.type
|
|
|
- virueRecordAddParameterModel.postCover = communityPostDetailModel.img
|
|
|
- virueRecordAddParameterModel.actionId = "\(communityPostDetailModel.id!)"
|
|
|
- virueRecordAddParameterModel.targetId = "\((UserModel.shared().getModel()?.uid)!)"
|
|
|
- virueRecordAddParameterModel.behaviorValue = 1
|
|
|
-
|
|
|
- SwiftMoyaNetWorkServiceVirus.shared().virueRecordAddApi(virueRecordAddParameterModel: virueRecordAddParameterModel, completion: {(data) -> (Void) in
|
|
|
- })
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
|
|
|
// MARK: - 帖子详情
|
|
|
extension VirusViewModel {
|
|
@@ -705,16 +684,88 @@ extension VirusViewModel {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// MARK: - 搜索点赞
|
|
|
+extension VirusViewModel {
|
|
|
+ func likeVirueRecordAddApi(communityPostDataModel:CommunityPostDataModel,cell:SearchContentListCollectionCell) {
|
|
|
+ let virueRecordAddParameterModel = VirueRecordAddParameterModel()
|
|
|
+ virueRecordAddParameterModel.behaviorId = (ConfigModel.shared.object()?.virus?.like ?? "")
|
|
|
+ virueRecordAddParameterModel.behaviorFlag = BehaviorFlagType.like.rawValue
|
|
|
+ if communityPostDataModel.isLike == 0 {
|
|
|
+ virueRecordAddParameterModel.behaviorValue = 1
|
|
|
+ }else {
|
|
|
+ virueRecordAddParameterModel.behaviorValue = 0
|
|
|
+ }
|
|
|
+ virueRecordAddParameterModel.postId = communityPostDataModel.id
|
|
|
+ virueRecordAddParameterModel.postAuthorUid = "\(communityPostDataModel.uid!)"
|
|
|
+ virueRecordAddParameterModel.postDesc = communityPostDataModel.title
|
|
|
+ virueRecordAddParameterModel.postCover = communityPostDataModel.img
|
|
|
+ virueRecordAddParameterModel.actionId = "\(communityPostDataModel.id!)"
|
|
|
+ virueRecordAddParameterModel.postType = communityPostDataModel.type
|
|
|
+
|
|
|
+ SwiftMoyaNetWorkServiceVirus.shared().virueRecordAddApi(virueRecordAddParameterModel: virueRecordAddParameterModel, completion: {
|
|
|
+ (data) -> (Void) in
|
|
|
+ let followStatusModel = FollowStatusModel()
|
|
|
+ followStatusModel.uid = communityPostDataModel.uid
|
|
|
+ if communityPostDataModel.isLike == 0 {
|
|
|
+ communityPostDataModel.isLike = 1
|
|
|
+ followStatusModel.isFollowStatus = 1
|
|
|
+
|
|
|
+ cell.likeBtn.isSelected = true
|
|
|
+ let praiseCount = (communityPostDataModel.praiseCount ?? 0) + 1
|
|
|
+ cell.likeBtn.setTitle("\(praiseCount)", for: UIControl.State.normal)
|
|
|
+ communityPostDataModel.praiseCount = praiseCount
|
|
|
+
|
|
|
+ }else {
|
|
|
+ communityPostDataModel.isLike = 0
|
|
|
+ followStatusModel.isFollowStatus = 0
|
|
|
+ cell.likeBtn.isSelected = false
|
|
|
+ let praiseCount = (communityPostDataModel.praiseCount ?? 0) - 1
|
|
|
+
|
|
|
+ cell.likeBtn.setTitle("\(praiseCount)", for: UIControl.State.normal)
|
|
|
+ communityPostDataModel.praiseCount = praiseCount
|
|
|
+
|
|
|
+ }
|
|
|
+ cell.likeBtn.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.left, imageTitleSpace: 5)
|
|
|
+ NotificationCenter.default.post(name: NSNotification.Name(rawValue: "isLikeApi"), object: followStatusModel)
|
|
|
+
|
|
|
+ })
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// MARK: - 阅读
|
|
|
+extension VirusViewModel {
|
|
|
+
|
|
|
+ func readVirueRecordAddApi(postId:Int?,
|
|
|
+ postAuthorUid:String?,
|
|
|
+ postDesc:String?,
|
|
|
+ postType:String?,
|
|
|
+ postCover:String?,
|
|
|
+ actionId:String) {
|
|
|
+ let virueRecordAddParameterModel = VirueRecordAddParameterModel()
|
|
|
+ virueRecordAddParameterModel.behaviorId = (ConfigModel.shared.object()?.virus?.read ?? "")
|
|
|
+ virueRecordAddParameterModel.behaviorFlag = BehaviorFlagType.read.rawValue
|
|
|
+ virueRecordAddParameterModel.behaviorValue = 1
|
|
|
+
|
|
|
+ virueRecordAddParameterModel.postId = postId
|
|
|
+ virueRecordAddParameterModel.actionId = actionId
|
|
|
+ virueRecordAddParameterModel.postAuthorUid = postAuthorUid
|
|
|
+ virueRecordAddParameterModel.postDesc = postDesc
|
|
|
+ virueRecordAddParameterModel.postType = postType
|
|
|
+ virueRecordAddParameterModel.postCover = postCover
|
|
|
+ SwiftMoyaNetWorkServiceVirus.shared().virueRecordAddApi(virueRecordAddParameterModel: virueRecordAddParameterModel, completion: {(data) -> (Void) in
|
|
|
+ })
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+// MARK: - 转发
|
|
|
extension VirusViewModel {
|
|
|
- // 转发
|
|
|
func forwarVirueRecordAddApi(postId:Int?,postAuthorUid:String?,title:String?,content:String?,postType:String?,postCover:String?) {
|
|
|
|
|
|
let virueRecordAddParameterModel = VirueRecordAddParameterModel()
|
|
|
virueRecordAddParameterModel.behaviorId = (ConfigModel.shared.object()?.virus?.forward ?? "")
|
|
|
virueRecordAddParameterModel.behaviorFlag = BehaviorFlagType.forward.rawValue
|
|
|
virueRecordAddParameterModel.behaviorValue = 1
|
|
|
- virueRecordAddParameterModel.targetId = "\((UserModel.shared().getModel()?.uid)!)"
|
|
|
-
|
|
|
|
|
|
virueRecordAddParameterModel.postId = postId
|
|
|
virueRecordAddParameterModel.actionId = "\(postId ?? 0)"
|
|
@@ -732,24 +783,8 @@ extension VirusViewModel {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// MARK: - 发布
|
|
|
extension VirusViewModel {
|
|
|
- // 注册
|
|
|
- func registeredVirueRecordAddApi(completion:@escaping ()->()) {
|
|
|
-
|
|
|
- let virueRecordAddParameterModel = VirueRecordAddParameterModel()
|
|
|
- virueRecordAddParameterModel.behaviorId = (ConfigModel.shared.object()?.virus?.register ?? "")
|
|
|
- virueRecordAddParameterModel.behaviorFlag =
|
|
|
- BehaviorFlagType.register.rawValue
|
|
|
- virueRecordAddParameterModel.sourceId = "\(UserModel.shared().getModel()?.inviteUid ?? 0)"
|
|
|
- virueRecordAddParameterModel.actionId = "\(UserModel.shared().getModel()?.uid ?? 0)"
|
|
|
- SwiftMoyaNetWorkServiceVirus.shared().virueRecordAddApi(virueRecordAddParameterModel: virueRecordAddParameterModel, completion: {(data) -> (Void) in
|
|
|
- completion()
|
|
|
- })
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-extension VirusViewModel {
|
|
|
- // 发布
|
|
|
func publishVirueRecordAddApi(postId:Int?,postType:String?,title:String?,content:String?,postCover:String?) {
|
|
|
|
|
|
let virueRecordAddParameterModel = VirueRecordAddParameterModel()
|
|
@@ -774,52 +809,18 @@ extension VirusViewModel {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+// MARK: - 注册
|
|
|
extension VirusViewModel {
|
|
|
- func virueRecordAddApi(communityPostDataModel:CommunityPostDataModel,cell:SearchContentListCollectionCell) {
|
|
|
+ func registeredVirueRecordAddApi(completion:@escaping ()->()) {
|
|
|
let virueRecordAddParameterModel = VirueRecordAddParameterModel()
|
|
|
- virueRecordAddParameterModel.behaviorId = (ConfigModel.shared.object()?.virus?.like ?? "")
|
|
|
- virueRecordAddParameterModel.behaviorFlag = BehaviorFlagType.like.rawValue
|
|
|
- if communityPostDataModel.isLike == 0 {
|
|
|
- virueRecordAddParameterModel.behaviorValue = 1
|
|
|
- }else {
|
|
|
- virueRecordAddParameterModel.behaviorValue = 0
|
|
|
- }
|
|
|
- virueRecordAddParameterModel.postId = communityPostDataModel.id
|
|
|
- virueRecordAddParameterModel.postAuthorUid = "\(communityPostDataModel.uid!)"
|
|
|
- virueRecordAddParameterModel.postDesc = communityPostDataModel.title
|
|
|
- virueRecordAddParameterModel.postCover = communityPostDataModel.img
|
|
|
- virueRecordAddParameterModel.actionId = "\(communityPostDataModel.id!)"
|
|
|
- virueRecordAddParameterModel.targetId = "\((UserModel.shared().getModel()?.uid)!)"
|
|
|
- virueRecordAddParameterModel.postType = communityPostDataModel.type
|
|
|
-
|
|
|
- SwiftMoyaNetWorkServiceVirus.shared().virueRecordAddApi(virueRecordAddParameterModel: virueRecordAddParameterModel, completion: {
|
|
|
- (data) -> (Void) in
|
|
|
- let followStatusModel = FollowStatusModel()
|
|
|
- followStatusModel.uid = communityPostDataModel.uid
|
|
|
- if communityPostDataModel.isLike == 0 {
|
|
|
- communityPostDataModel.isLike = 1
|
|
|
- followStatusModel.isFollowStatus = 1
|
|
|
-
|
|
|
- cell.likeBtn.isSelected = true
|
|
|
- let praiseCount = (communityPostDataModel.praiseCount ?? 0) + 1
|
|
|
- cell.likeBtn.setTitle("\(praiseCount)", for: UIControl.State.normal)
|
|
|
- communityPostDataModel.praiseCount = praiseCount
|
|
|
-
|
|
|
- }else {
|
|
|
- communityPostDataModel.isLike = 0
|
|
|
- followStatusModel.isFollowStatus = 0
|
|
|
- cell.likeBtn.isSelected = false
|
|
|
- let praiseCount = (communityPostDataModel.praiseCount ?? 0) - 1
|
|
|
-
|
|
|
- cell.likeBtn.setTitle("\(praiseCount)", for: UIControl.State.normal)
|
|
|
- communityPostDataModel.praiseCount = praiseCount
|
|
|
-
|
|
|
- }
|
|
|
- cell.likeBtn.layoutButton(edgeInsetsStyle: ButtonEdgeInsetsStyle.left, imageTitleSpace: 5)
|
|
|
- NotificationCenter.default.post(name: NSNotification.Name(rawValue: "isLikeApi"), object: followStatusModel)
|
|
|
-
|
|
|
+ virueRecordAddParameterModel.behaviorId = (ConfigModel.shared.object()?.virus?.register ?? "")
|
|
|
+ virueRecordAddParameterModel.behaviorFlag =
|
|
|
+ BehaviorFlagType.register.rawValue
|
|
|
+ virueRecordAddParameterModel.sourceId = "\(UserModel.shared().getModel()?.inviteUid ?? 0)"
|
|
|
+ virueRecordAddParameterModel.actionId = BehaviorFlagType.register.rawValue
|
|
|
+ SwiftMoyaNetWorkServiceVirus.shared().virueRecordAddApi(virueRecordAddParameterModel: virueRecordAddParameterModel, completion: {(data) -> (Void) in
|
|
|
+ completion()
|
|
|
})
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
+
|