|
@@ -35,6 +35,9 @@ func ArticleRouters() {
|
35
|
35
|
beego.Router("/api/acticle/getPreviewInfo",&ArticleManage{},"Post:GetPreviewInfo")
|
36
|
36
|
beego.Router("/api/acticle/getAllComment",&ArticleManage{},"Get:GetAllComment")
|
37
|
37
|
beego.Router("/api/acticle/getArticleCommentDetail",&ArticleManage{},"Get:GetArticleCommentDetail")
|
|
38
|
+ beego.Router("/api/article/deleteArticle",&ArticleManage{},"Get:DeleteArticles")
|
|
39
|
+ beego.Router("/api/acticle/send",&ArticleManage{},"Get:SendReplycontent")
|
|
40
|
+ beego.Router("/api/acticle/getReplyAllComents",&ArticleManage{},"Get:GetReplyAllComents")
|
38
|
41
|
}
|
39
|
42
|
|
40
|
43
|
type ArticleManage struct {
|
|
@@ -123,6 +126,7 @@ func (this *ArticleManage) GetAllArticles() {
|
123
|
126
|
limit, _ := this.GetInt64("limit", 10)
|
124
|
127
|
fmt.Println("限制",limit)
|
125
|
128
|
searchKey := this.GetString("keyword", "")
|
|
129
|
+ fmt.Println("搜索字",searchKey)
|
126
|
130
|
classId,_ := this.GetInt64("id",0)
|
127
|
131
|
status, _ := this.GetInt64("status")
|
128
|
132
|
fmt.Println("页面",page,"限制",limit,"关键字",searchKey,"分类号",classId,"状态值:",status)
|
|
@@ -200,7 +204,6 @@ func (this *ArticleManage) GetAllArticles() {
|
200
|
204
|
})
|
201
|
205
|
return
|
202
|
206
|
}
|
203
|
|
-
|
204
|
207
|
func (this *ArticleManage) AddCategory(){
|
205
|
208
|
|
206
|
209
|
dataBody := make(map[string]interface{}, 0)
|
|
@@ -262,7 +265,9 @@ func (this *ArticleManage) GetCategorys() {
|
262
|
265
|
adminUserInfo := this.GetAdminUserInfo()
|
263
|
266
|
userOrgID := adminUserInfo.CurrentOrgId
|
264
|
267
|
page, _ := this.GetInt64("page", 1)
|
|
268
|
+ fmt.Println("页面",page)
|
265
|
269
|
limit, _ := this.GetInt64("limit", 10)
|
|
270
|
+ fmt.Println("限制",limit)
|
266
|
271
|
if page <= 0 {
|
267
|
272
|
page = 1
|
268
|
273
|
}
|
|
@@ -701,6 +706,22 @@ func (this *ArticleManage) DeleteArticle() {
|
701
|
706
|
return
|
702
|
707
|
}
|
703
|
708
|
|
|
709
|
+func (this *ArticleManage) DeleteArticles() {
|
|
710
|
+ id, _:= this.GetInt64("id")
|
|
711
|
+ fmt.Println("id是多少呢",id)
|
|
712
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
713
|
+ userOrgID := adminUserInfo.CurrentOrgId
|
|
714
|
+ err := article_service.DeleteArticles(id, userOrgID)
|
|
715
|
+ if err !=nil{
|
|
716
|
+ this.ServeFailJsonSend(enums.ErrorCodeDataException, "删除失败")
|
|
717
|
+ return
|
|
718
|
+ }
|
|
719
|
+ returnData := make(map[string]interface{}, 0)
|
|
720
|
+ returnData["msg"] = "ok"
|
|
721
|
+ this.ServeSuccessJSON(returnData)
|
|
722
|
+ return
|
|
723
|
+}
|
|
724
|
+
|
704
|
725
|
func (this *ArticleManage) GetMenus(){
|
705
|
726
|
adminUserInfo := this.GetAdminUserInfo()
|
706
|
727
|
userOrgID := adminUserInfo.CurrentOrgId
|
|
@@ -863,14 +884,91 @@ func (this * ArticleManage) GetAllComment() {
|
863
|
884
|
func (this * ArticleManage) GetArticleCommentDetail(){
|
864
|
885
|
id, _ := this.GetInt64("id")
|
865
|
886
|
fmt.Println("id是多少",id)
|
|
887
|
+ page, _ := this.GetInt64("page", 1)
|
|
888
|
+ fmt.Println("页面",page)
|
|
889
|
+ limit, _ := this.GetInt64("limit", 10)
|
|
890
|
+ fmt.Println("限制",limit)
|
|
891
|
+ if page <= 0 {
|
|
892
|
+ page = 1
|
|
893
|
+ }
|
|
894
|
+ if limit <= 0 {
|
|
895
|
+ limit = 10
|
|
896
|
+ }
|
866
|
897
|
adminUserInfo := this.GetAdminUserInfo()
|
867
|
898
|
userOrgID := adminUserInfo.CurrentOrgId
|
868
|
899
|
articles, err := article_service.GetArticleCommentDetail(id, userOrgID)
|
|
900
|
+ comment, total, err := article_service.FindAllComments(page, limit, 20142)
|
|
901
|
+ org := adminUserInfo.Orgs[adminUserInfo.CurrentOrgId]
|
|
902
|
+ fmt.Println("err是什么",err)
|
|
903
|
+ fmt.Println("total",total)
|
869
|
904
|
if err !=nil{
|
870
|
905
|
this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取预览失败")
|
871
|
906
|
return
|
872
|
907
|
}
|
873
|
908
|
this.ServeSuccessJSON(map[string]interface{}{
|
874
|
909
|
"articles":articles,
|
|
910
|
+ "comment":comment,
|
|
911
|
+ "total":total,
|
|
912
|
+ "orgName":org.OrgName,
|
|
913
|
+ "orgID":userOrgID,
|
875
|
914
|
})
|
876
|
|
-}
|
|
915
|
+}
|
|
916
|
+
|
|
917
|
+func (this * ArticleManage) SendReplycontent() {
|
|
918
|
+ replycontent := this.GetString("replycontent")
|
|
919
|
+ actilcid, _ := this.GetInt64("acticlid")
|
|
920
|
+ parentid, _ := this.GetInt64("parentid")
|
|
921
|
+ fmt.Println("回复的内容",replycontent)
|
|
922
|
+ fmt.Println("文章ID",actilcid)
|
|
923
|
+ fmt.Println("父类ID",parentid)
|
|
924
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
925
|
+ userOrgID := adminUserInfo.CurrentOrgId
|
|
926
|
+ org := adminUserInfo.Orgs[adminUserInfo.CurrentOrgId]
|
|
927
|
+ orgName := org.OrgName
|
|
928
|
+ orgLogo := org.OrgLogo
|
|
929
|
+ fmt.Println("logo",orgLogo)
|
|
930
|
+ comment := models.Comment{
|
|
931
|
+ Content: replycontent,
|
|
932
|
+ ParentId: parentid,
|
|
933
|
+ ArticleId: actilcid,
|
|
934
|
+ Ctime: time.Now().Unix(),
|
|
935
|
+ CommentUserId:userOrgID,
|
|
936
|
+ Status:1,
|
|
937
|
+ CommentUserAvater: orgLogo,
|
|
938
|
+ CommentUserName:orgName,
|
|
939
|
+ }
|
|
940
|
+ err := article_service.AddComment(&comment)
|
|
941
|
+ fmt.Println("错误是什么",err)
|
|
942
|
+ if err !=nil{
|
|
943
|
+ this.ServeFailJsonSend(enums.ErrorCodeDataException, "添加回复内容失败")
|
|
944
|
+ return
|
|
945
|
+ }
|
|
946
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
947
|
+ "comment":comment,
|
|
948
|
+ })
|
|
949
|
+}
|
|
950
|
+
|
|
951
|
+func (this * ArticleManage) GetReplyAllComents() {
|
|
952
|
+ page, _ := this.GetInt64("page", 1)
|
|
953
|
+ fmt.Println("页面",page)
|
|
954
|
+ limit, _ := this.GetInt64("limit", 10)
|
|
955
|
+ fmt.Println("限制",limit)
|
|
956
|
+ if page <= 0 {
|
|
957
|
+ page = 1
|
|
958
|
+ }
|
|
959
|
+ if limit <= 0 {
|
|
960
|
+ limit = 10
|
|
961
|
+ }
|
|
962
|
+ adminUserInfo := this.GetAdminUserInfo()
|
|
963
|
+ userOrgID := adminUserInfo.CurrentOrgId
|
|
964
|
+ fmt.Println("机构ID",userOrgID)
|
|
965
|
+ comment, total, err := article_service.GetReplyAllComents(page, limit)
|
|
966
|
+ if err !=nil{
|
|
967
|
+ this.ServeFailJsonSend(enums.ErrorCodeDataException, "获取评论列表失败")
|
|
968
|
+ return
|
|
969
|
+ }
|
|
970
|
+ this.ServeSuccessJSON(map[string]interface{}{
|
|
971
|
+ "comments":comment,
|
|
972
|
+ "total":total,
|
|
973
|
+ })
|
|
974
|
+}
|