Browse Source

评论bug修改

xiaoming_global 6 years ago
parent
commit
7956a261a8

+ 33 - 1
controllers/article/article_controller.go View File

43
 	beego.Router("/api/article/clearRelyInfo",&ArticleManage{},"Delete:ClearReplyInfo")
43
 	beego.Router("/api/article/clearRelyInfo",&ArticleManage{},"Delete:ClearReplyInfo")
44
 	beego.Router("/api/article/deleteReply",&ArticleManage{},"Delete:DeleteReply")
44
 	beego.Router("/api/article/deleteReply",&ArticleManage{},"Delete:DeleteReply")
45
 	beego.Router("/api/article/spread",&ArticleManage{},"Get:GetSpreadInfo")
45
 	beego.Router("/api/article/spread",&ArticleManage{},"Get:GetSpreadInfo")
46
+	beego.Router("/api/article/clear",&ArticleManage{},"Delete:ClearReply")
47
+	beego.Router("/api/article/deleteComments",&ArticleManage{},"Delete:DeleteComments")
46
 }
48
 }
47
 
49
 
48
 type ArticleManage struct {
50
 type ArticleManage struct {
902
 	adminUserInfo := this.GetAdminUserInfo()
904
 	adminUserInfo := this.GetAdminUserInfo()
903
 	userOrgID := adminUserInfo.CurrentOrgId
905
 	userOrgID := adminUserInfo.CurrentOrgId
904
 	articles, err := article_service.GetArticleCommentDetail(id, userOrgID)
906
 	articles, err := article_service.GetArticleCommentDetail(id, userOrgID)
905
-	comment, total, err := article_service.FindAllComments(page, limit, 20142)
907
+	comment, total, err := article_service.FindAllComments(page, limit, id)
906
 	org := adminUserInfo.Orgs[adminUserInfo.CurrentOrgId]
908
 	org := adminUserInfo.Orgs[adminUserInfo.CurrentOrgId]
907
 	fmt.Println("err是什么",err)
909
 	fmt.Println("err是什么",err)
908
 	fmt.Println("total",total)
910
 	fmt.Println("total",total)
1072
 	this.ServeSuccessJSON(map[string]interface{}{
1074
 	this.ServeSuccessJSON(map[string]interface{}{
1073
 		"comments":comments,
1075
 		"comments":comments,
1074
 	})
1076
 	})
1077
+}
1078
+
1079
+func (this * ArticleManage) ClearReply()  {
1080
+	id, _ := this.GetInt64("id")
1081
+	fmt.Println("id是多少?",id)
1082
+	err :=article_service.DeleteReply(id)
1083
+	if err !=nil{
1084
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
1085
+		return
1086
+	}
1087
+
1088
+	returnData := make(map[string]interface{}, 0)
1089
+	returnData["msg"] = "ok"
1090
+	this.ServeSuccessJSON(returnData)
1091
+	return
1092
+}
1093
+
1094
+func  (this * ArticleManage) DeleteComments()  {
1095
+	id, _ := this.GetInt64("id")
1096
+	fmt.Println("id事多少",id);
1097
+	err := article_service.DeleteReply(id)
1098
+	if err !=nil{
1099
+		this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
1100
+		return
1101
+	}
1102
+
1103
+	returnData := make(map[string]interface{}, 0)
1104
+	returnData["msg"] = "ok"
1105
+	this.ServeSuccessJSON(returnData)
1106
+	return
1075
 }
1107
 }

+ 2 - 0
service/article_service/article_category_service.go View File

301
 		Where("article_id = ? AND parent_id = ? AND status = ?", articleID, parentid, 1).Find(&comments).Error
301
 		Where("article_id = ? AND parent_id = ? AND status = ?", articleID, parentid, 1).Find(&comments).Error
302
 		return  comments,errs
302
 		return  comments,errs
303
 }
303
 }
304
+
305
+