|
@@ -38,6 +38,11 @@ func ArticleRouters() {
|
38
|
38
|
beego.Router("/api/article/deleteArticle",&ArticleManage{},"Get:DeleteArticles")
|
39
|
39
|
beego.Router("/api/acticle/send",&ArticleManage{},"Get:SendReplycontent")
|
40
|
40
|
beego.Router("/api/acticle/getReplyAllComents",&ArticleManage{},"Get:GetReplyAllComents")
|
|
41
|
+ beego.Router("/api/article/sendInformation",&ArticleManage{},"Get:GetSendInformation")
|
|
42
|
+ beego.Router("/api/article/spreadReplay",&ArticleManage{},"Get:GetSpreadReplay")
|
|
43
|
+ beego.Router("/api/article/clearRelyInfo",&ArticleManage{},"Delete:ClearReplyInfo")
|
|
44
|
+ beego.Router("/api/article/deleteReply",&ArticleManage{},"Delete:DeleteReply")
|
|
45
|
+ beego.Router("/api/article/spread",&ArticleManage{},"Get:GetSpreadInfo")
|
41
|
46
|
}
|
42
|
47
|
|
43
|
48
|
type ArticleManage struct {
|
|
@@ -972,3 +977,99 @@ func (this * ArticleManage) GetReplyAllComents() {
|
972
|
977
|
"total":total,
|
973
|
978
|
})
|
974
|
979
|
}
|
|
980
|
+
|
|
981
|
+func (this * ArticleManage) GetSendInformation() {
|
|
982
|
+ artilcid, _ := this.GetInt64("artilcid")
|
|
983
|
+ fmt.Println("文章id",artilcid)
|
|
984
|
+ parentid, _ := this.GetInt64("parentid")
|
|
985
|
+ fmt.Println("父类id",parentid)
|
|
986
|
+ content := this.GetString("content")
|
|
987
|
+ fmt.Println("文章内容",content)
|
|
988
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
989
|
+ userOrgID := adminUserInfo.CurrentOrgId
|
|
990
|
+ org := adminUserInfo.Orgs[adminUserInfo.CurrentOrgId]
|
|
991
|
+ orgName := org.OrgName
|
|
992
|
+ orgLogo := org.OrgLogo
|
|
993
|
+ fmt.Println("logo",orgLogo)
|
|
994
|
+ comment := models.Comment{
|
|
995
|
+ Content: content,
|
|
996
|
+ ParentId: parentid,
|
|
997
|
+ ArticleId: artilcid,
|
|
998
|
+ Ctime: time.Now().Unix(),
|
|
999
|
+ CommentUserId:userOrgID,
|
|
1000
|
+ Status:1,
|
|
1001
|
+ CommentUserAvater: orgLogo,
|
|
1002
|
+ CommentUserName:orgName,
|
|
1003
|
+ }
|
|
1004
|
+ err := article_service.AddComment(&comment)
|
|
1005
|
+ fmt.Println("错误是什么",err)
|
|
1006
|
+ if err !=nil{
|
|
1007
|
+ this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加回复内容失败")
|
|
1008
|
+ return
|
|
1009
|
+ }
|
|
1010
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1011
|
+ "comment":comment,
|
|
1012
|
+ })
|
|
1013
|
+}
|
|
1014
|
+
|
|
1015
|
+func (this * ArticleManage) GetSpreadReplay() {
|
|
1016
|
+ artilcid, _ := this.GetInt64("artilcid")
|
|
1017
|
+ fmt.Println("文章id",artilcid)
|
|
1018
|
+ parentid, _ := this.GetInt64("parentid")
|
|
1019
|
+ fmt.Println("父类id",parentid)
|
|
1020
|
+
|
|
1021
|
+ comments, err := article_service.GetAllReplyFormId(artilcid, parentid)
|
|
1022
|
+ if err !=nil{
|
|
1023
|
+ this.ServeFailJsonSend(enums.ErrorCodeDataException, "查询回复内容失败")
|
|
1024
|
+ return
|
|
1025
|
+ }
|
|
1026
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1027
|
+ "comments":comments,
|
|
1028
|
+ })
|
|
1029
|
+}
|
|
1030
|
+
|
|
1031
|
+func (this * ArticleManage) ClearReplyInfo() {
|
|
1032
|
+ id, _ := this.GetInt64("id")
|
|
1033
|
+ fmt.Println("id为",id)
|
|
1034
|
+ err := article_service.ClearReplyInfo(id)
|
|
1035
|
+ fmt.Println("错误为",err)
|
|
1036
|
+ if err !=nil{
|
|
1037
|
+ this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
|
|
1038
|
+ return
|
|
1039
|
+ }
|
|
1040
|
+
|
|
1041
|
+ returnData := make(map[string]interface{}, 0)
|
|
1042
|
+ returnData["msg"] = "ok"
|
|
1043
|
+ this.ServeSuccessJSON(returnData)
|
|
1044
|
+ return
|
|
1045
|
+}
|
|
1046
|
+
|
|
1047
|
+func (this * ArticleManage) DeleteReply() {
|
|
1048
|
+ id, _ := this.GetInt64("id")
|
|
1049
|
+ fmt.Println("id为",id)
|
|
1050
|
+ err := article_service.DeleteReply(id)
|
|
1051
|
+ if err !=nil{
|
|
1052
|
+ this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除回复成功")
|
|
1053
|
+ return
|
|
1054
|
+ }
|
|
1055
|
+
|
|
1056
|
+ returnData := make(map[string]interface{}, 0)
|
|
1057
|
+ returnData["msg"] = "ok"
|
|
1058
|
+ this.ServeSuccessJSON(returnData)
|
|
1059
|
+ return
|
|
1060
|
+}
|
|
1061
|
+
|
|
1062
|
+func (this * ArticleManage) GetSpreadInfo() {
|
|
1063
|
+ parentid, _ := this.GetInt64("parentid")
|
|
1064
|
+ acticlid, _ := this.GetInt64("acticlid")
|
|
1065
|
+ fmt.Println("父类id",parentid)
|
|
1066
|
+ fmt.Println("文章id",acticlid)
|
|
1067
|
+ comments, err := article_service.GetQueryReplyInfo(parentid, acticlid)
|
|
1068
|
+ if err !=nil{
|
|
1069
|
+ this.ServeFailJsonSend(enums.ErrorCodeDataException, "查询回复内容失败")
|
|
1070
|
+ return
|
|
1071
|
+ }
|
|
1072
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
1073
|
+ "comments":comments,
|
|
1074
|
+ })
|
|
1075
|
+}
|