作者 庄敏学

文章列表

... ... @@ -321,8 +321,6 @@
]
}
},
<<<<<<< HEAD
=======
"v1/mini/article_comment/at_who/list": {
"post": {
"summary": "小程序展示评论时@人可选列表",
... ... @@ -465,7 +463,6 @@
]
}
},
>>>>>>> 77e95275539c30c5787295a0b7f7cd16a3263567
"v1/mini/article_draft": {
"post": {
"summary": "小程序创建文章进草稿箱",
... ... @@ -603,8 +600,6 @@
"requestBody": {},
"tags": [
"article"
<<<<<<< HEAD
=======
]
}
},
... ... @@ -636,28 +631,11 @@
"required": false,
"type": "integer",
"format": "int64"
},
{
"name": "articleId",
"description": " 文章id",
"in": "query",
"required": true,
"type": "integer",
"format": "int64"
},
{
"name": "tagId",
"description": " 标签id",
"in": "query",
"required": true,
"type": "integer",
"format": "int64"
}
],
"requestBody": {},
"tags": [
"article"
>>>>>>> 77e95275539c30c5787295a0b7f7cd16a3263567
]
}
},
... ... @@ -1634,8 +1612,6 @@
"department"
]
},
<<<<<<< HEAD
=======
"delete": {
"summary": "部门-删除",
"operationId": "systemDelete",
... ... @@ -1668,7 +1644,6 @@
"department"
]
},
>>>>>>> 77e95275539c30c5787295a0b7f7cd16a3263567
"put": {
"summary": "部门-更新",
"operationId": "systemUpdate",
... ... @@ -2094,8 +2069,6 @@
"company"
]
},
<<<<<<< HEAD
=======
"ArticleCommentAndReply": {
"type": "object",
"properties": {
... ... @@ -2227,7 +2200,6 @@
"content"
]
},
>>>>>>> 77e95275539c30c5787295a0b7f7cd16a3263567
"ArticleSearchMe": {
"type": "object",
"properties": {
... ... @@ -2310,6 +2282,25 @@
"totalComment"
]
},
"ArticleTagGroup": {
"type": "object",
"properties": {
"group": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"$ref": "#/definitions/ArticleTagItem"
}
}
},
"title": "ArticleTagGroup",
"required": [
"group",
"tags"
]
},
"ArticleTagItem": {
"type": "object",
"properties": {
... ... @@ -2322,13 +2313,17 @@
},
"name": {
"type": "string"
},
"image": {
"type": "string"
}
},
"title": "ArticleTagItem",
"required": [
"id",
"group",
"name"
"name",
"image"
]
},
"Auth": {
... ... @@ -2355,8 +2350,6 @@
"code"
]
},
<<<<<<< HEAD
=======
"CommentAtWho": {
"type": "object",
"properties": {
... ... @@ -2366,6 +2359,9 @@
},
"name": {
"type": "string"
},
"firstLetter": {
"type": "string"
}
},
"title": "CommentAtWho",
... ... @@ -2373,7 +2369,6 @@
"id"
]
},
>>>>>>> 77e95275539c30c5787295a0b7f7cd16a3263567
"CommentAuthor": {
"type": "object",
"properties": {
... ... @@ -2402,14 +2397,7 @@
"title": "CommentAuthor",
"required": [
"id",
<<<<<<< HEAD
"name",
"avatar",
"position",
"company"
=======
"name"
>>>>>>> 77e95275539c30c5787295a0b7f7cd16a3263567
]
},
"Company": {
... ... @@ -2614,8 +2602,6 @@
},
"name": {
"type": "string"
<<<<<<< HEAD
=======
},
"ids": {
"type": "array",
... ... @@ -2624,18 +2610,13 @@
"format": "int64"
},
"description": " 用户ID"
>>>>>>> 77e95275539c30c5787295a0b7f7cd16a3263567
}
},
"title": "DepartmentUpdateRequest",
"required": [
"id",
<<<<<<< HEAD
"name"
=======
"name",
"ids"
>>>>>>> 77e95275539c30c5787295a0b7f7cd16a3263567
]
},
"FollowRequest": {
... ... @@ -2893,23 +2874,9 @@
"type": "integer",
"format": "int64",
"description": " 公司id"
},
"articleId": {
"type": "integer",
"format": "int64",
"description": " 文章id"
},
"tagId": {
"type": "integer",
"format": "int64",
"description": " 标签id"
}
},
"title": "MiniAllArticleTagRequest",
"required": [
"articleId",
"tagId"
]
"title": "MiniAllArticleTagRequest"
},
"MiniAllArticleTagResponse": {
"type": "object",
... ... @@ -2917,20 +2884,13 @@
"tagGroup": {
"type": "array",
"items": {
"type": "string"
}
},
"tags": {
"type": "array",
"items": {
"$ref": "#/definitions/ArticleTagItem"
"$ref": "#/definitions/ArticleTagGroup"
}
}
},
"title": "MiniAllArticleTagResponse",
"required": [
"tagGroup",
"tags"
"tagGroup"
]
},
"MiniArticleBackupItem": {
... ... @@ -3035,8 +2995,6 @@
"type": "object",
"title": "MiniArticleCommentAtUserResponse"
},
<<<<<<< HEAD
=======
"MiniArticleCommentAtWhoRequest": {
"type": "object",
"properties": {
... ... @@ -3073,7 +3031,6 @@
"list"
]
},
>>>>>>> 77e95275539c30c5787295a0b7f7cd16a3263567
"MiniArticleCreateRequest": {
"type": "object",
"properties": {
... ... @@ -3632,11 +3589,7 @@
"meLoveFlag": {
"type": "integer",
"format": "int32",
<<<<<<< HEAD
"description": "当前人员对文章的点赞标识"
=======
"description": " 当前人员对文章的点赞标识 (0 没有点赞 1有点赞)"
>>>>>>> 77e95275539c30c5787295a0b7f7cd16a3263567
}
},
"title": "MiniArticleGetResponse",
... ... @@ -3822,8 +3775,6 @@
"list"
]
},
<<<<<<< HEAD
=======
"MiniArticleSetTagRequest": {
"type": "object",
"properties": {
... ... @@ -3867,7 +3818,6 @@
"id"
]
},
>>>>>>> 77e95275539c30c5787295a0b7f7cd16a3263567
"MiniCreateArticleCommentRequest": {
"type": "object",
"properties": {
... ... @@ -3891,11 +3841,7 @@
"format": "int64",
"description": " 服务端自动获取"
},
<<<<<<< HEAD
"commnet": {
=======
"pid": {
>>>>>>> 77e95275539c30c5787295a0b7f7cd16a3263567
"type": "integer",
"format": "int64",
"description": " 回复那个评论的id"
... ... @@ -3907,12 +3853,7 @@
"atWho": {
"type": "array",
"items": {
<<<<<<< HEAD
"type": "integer",
"format": "int64"
=======
"$ref": "#/definitions/CommentAtWho"
>>>>>>> 77e95275539c30c5787295a0b7f7cd16a3263567
},
"description": " 填写评论时@的人"
}
... ... @@ -3921,11 +3862,7 @@
"required": [
"articleId",
"sectionId",
<<<<<<< HEAD
"commnet",
=======
"pid",
>>>>>>> 77e95275539c30c5787295a0b7f7cd16a3263567
"content",
"atWho"
]
... ... @@ -3995,11 +3932,6 @@
"atWho": {
"type": "array",
"items": {
<<<<<<< HEAD
"$ref": "#/definitions/CommentAuthor"
},
"description": " 填写评论时@的人"
=======
"$ref": "#/definitions/CommentAtWho"
},
"description": " 填写评论时@的人"
... ... @@ -4007,7 +3939,6 @@
"createdAt": {
"type": "integer",
"format": "int64"
>>>>>>> 77e95275539c30c5787295a0b7f7cd16a3263567
}
},
"title": "MiniCreateArticleCommentResponse",
... ... @@ -4025,9 +3956,6 @@
"countReply",
"countUserLove",
"countAdminLove",
<<<<<<< HEAD
"atWho"
=======
"atWho",
"createdAt"
]
... ... @@ -4149,7 +4077,6 @@
"required": [
"total",
"list"
>>>>>>> 77e95275539c30c5787295a0b7f7cd16a3263567
]
},
"MiniMyLikeRequest": {
... ... @@ -5320,7 +5247,7 @@
"SystemArticleSearchRequest": {
"type": "object",
"properties": {
"": {
"companyId": {
"type": "integer",
"format": "int64"
},
... ... @@ -5349,9 +5276,6 @@
},
"title": "SystemArticleSearchRequest",
"required": [
"title",
"author",
"publishDate",
"pageNumber",
"pageSize"
]
... ... @@ -5383,7 +5307,7 @@
"type": "integer",
"format": "int64"
},
"": {
"companyId": {
"type": "integer",
"format": "int64"
},
... ... @@ -5939,7 +5863,7 @@
"TagCreateRequest": {
"type": "object",
"properties": {
"companyId": {
"": {
"type": "integer",
"format": "int64"
},
... ... @@ -5950,21 +5874,24 @@
"type": "string",
"description": " 标签名称"
},
"group": {
"category": {
"type": "string",
"description": " 标签分类"
},
"remark": {
"type": "string",
"description": " 备注"
},
"other": {
"type": "string"
}
},
"title": "TagCreateRequest",
"required": [
"companyId",
"image",
"name",
"group"
"category",
"other"
]
},
"TagCreateResponse": {
... ... @@ -5987,15 +5914,14 @@
"type": "integer",
"format": "int64"
},
"companyId": {
"": {
"type": "integer",
"format": "int64"
}
},
"title": "TagDeleteRequest",
"required": [
"id",
"-"
"id"
]
},
"TagDeleteResponse": {
... ... @@ -6018,7 +5944,7 @@
"type": "integer",
"format": "int64"
},
"companyId": {
"": {
"type": "integer",
"format": "int64"
},
... ... @@ -6029,22 +5955,25 @@
"type": "string",
"description": " 标签名称"
},
"group": {
"category": {
"type": "string",
"description": " 标签分类"
},
"remark": {
"type": "string",
"description": " 备注"
},
"other": {
"type": "string"
}
},
"title": "TagEditRequest",
"required": [
"id",
"-",
"image",
"name",
"group"
"category",
"other"
]
},
"TagEditResponse": {
... ... @@ -6067,15 +5996,14 @@
"type": "integer",
"format": "int64"
},
"companyId": {
"": {
"type": "integer",
"format": "int64"
}
},
"title": "TagGetRequest",
"required": [
"id",
"-"
"id"
]
},
"TagGetResponse": {
... ... @@ -6092,13 +6020,16 @@
"type": "string",
"description": " 标签名称"
},
"group": {
"category": {
"type": "string",
"description": " 标签分类"
},
"remark": {
"type": "string",
"description": " 备注"
},
"other": {
"type": "string"
}
},
"title": "TagGetResponse",
... ... @@ -6106,8 +6037,9 @@
"id",
"image",
"name",
"group",
"remark"
"category",
"remark",
"other"
]
},
"TagItem": {
... ... @@ -6124,7 +6056,7 @@
"type": "string",
"description": " 标签名称"
},
"group": {
"category": {
"type": "string",
"description": " 标签分类"
},
... ... @@ -6142,7 +6074,7 @@
"id",
"image",
"name",
"group",
"category",
"remark",
"createdAt"
]
... ... @@ -6158,14 +6090,14 @@
"type": "integer",
"format": "int32"
},
"companyId": {
"": {
"type": "integer",
"format": "int64"
},
"tagName": {
"type": "string"
},
"group": {
"category": {
"type": "string"
},
"remark": {
... ... @@ -6175,8 +6107,7 @@
"title": "TagListRequest",
"required": [
"page",
"size",
"-"
"size"
]
},
"TagListResponse": {
... ... @@ -6456,6 +6387,10 @@
"type": "string",
"description": " 人员头像"
},
"position": {
"type": "string",
"description": " 职位"
},
"createdAt": {
"type": "integer",
"format": "int64",
... ... @@ -6468,6 +6403,7 @@
"userId",
"name",
"avatar",
"position",
"createdAt"
]
}
... ...
... ... @@ -363,10 +363,10 @@ type (
//管理后台获取文章列表
type (
SystemArticleSearchRequest {
CompanyId int64 `json:",optional"`
Title string `json:"title"` //标题
Author string `json:"author"` //发布人
PublishDate string `json:"publishDate"` //发布日期
CompanyId int64 `json:"companyId,optional"`
Title string `json:"title,optional"` //标题
Author string `json:"author,optional"` //发布人
PublishDate string `json:"publishDate,optional"` //发布日期
PageNumber int `json:"pageNumber"` //页码
PageSize int `json:"pageSize"` //每页行数
}
... ... @@ -390,7 +390,7 @@ type (
//编辑
SystemArticleUpdateRequest {
Id int64 `json:"id"`
CompanyId int64 `json:",optional"`
CompanyId int64 `json:"companyId,optional"`
Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
Section []ArticleSection `json:"section"` // 填写的内容
Title string `json:"title"` // 标题
... ...
... ... @@ -2,9 +2,11 @@ package article
import (
"context"
"github.com/jinzhu/now"
"github.com/samber/lo"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
"time"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
... ... @@ -28,15 +30,15 @@ func NewSystemSearchArticleLogic(ctx context.Context, svcCtx *svc.ServiceContext
func (l *SystemSearchArticleLogic) SystemSearchArticle(req *types.SystemArticleSearchRequest) (resp *types.SystemArticleSearchResponse, err error) {
var conn = l.svcCtx.DefaultDBConn()
total, articles, err := l.svcCtx.ArticleRepository.Find(
l.ctx,
conn,
req.CompanyId,
domain.NewQueryOptions().
WithOffsetLimit(req.PageNumber, req.PageSize).
WithKV("tile", req.Title).
WithKV("author", req.Author),
)
queryOptions := domain.NewQueryOptions().WithOffsetLimit(req.PageNumber, req.PageSize).WithKV("title", req.Title).WithKV("author", req.Author)
if req.PublishDate != "" {
publishTime, err := now.ParseInLocation(time.Local, req.PublishDate)
if err == nil {
queryOptions.WithKV("beginCreatedAt", now.With(publishTime).BeginningOfDay().Unix())
queryOptions.WithKV("endCreatedAt", now.With(publishTime).EndOfDay().Unix())
}
}
total, articles, err := l.svcCtx.ArticleRepository.Find(l.ctx, conn, req.CompanyId, queryOptions)
if err != nil {
return nil, xerr.NewErrMsgErr("搜索帖子异常", err)
}
... ...
... ... @@ -121,11 +121,13 @@ func (repository *ArticleRepository) Find(ctx context.Context, conn transaction.
queryFunc := func() (interface{}, error) {
tx = tx.Model(&ms).Order("id desc").Where("company_id=?", companyId)
if v, ok := queryOptions["ids"]; ok {
tx.Where("id in (?)", v)
tx = tx.Where("id in (?)", v)
}
if v, ok := queryOptions["authorId"]; ok {
tx = tx.Where("author_id = ?", v)
if v, ok := queryOptions["title"]; ok && v.(string) != "" {
tx = tx.Where("title like ?", "%"+v.(string)+"%")
}
if v, ok := queryOptions["author"]; ok {
tx = tx.Where(`author #>> '{"name"}' like ?`, "%"+v.(string)+"%")
}
if v, ok := queryOptions["beginCreatedAt"]; ok {
tx = tx.Where("created_at >= ?", v)
... ...