Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss into dev
正在显示
20 个修改的文件
包含
106 行增加
和
58 行删除
| 1 | -测试环境服务端域名 http://sumifcc-discuss-test.sumifcc.com/ | ||
| 1 | +# 说明 | ||
| 2 | + | ||
| 3 | +### 测试环境 | ||
| 4 | +服务端域名 http://sumifcc-discuss-test.sumifcc.com/ | ||
| 5 | + | ||
| 6 | +### 可设置环境变量 | ||
| 7 | +- DataSource | ||
| 8 | + 数据库连接,样例 | ||
| 9 | + ``` code | ||
| 10 | + host=数据库IP地址 user=用户名 password=密码 dbname=数据库名 port=31543 sslmode=disable TimeZone=Asia/Shanghai | ||
| 11 | + ``` | ||
| 12 | + |
| @@ -48,7 +48,7 @@ type ( | @@ -48,7 +48,7 @@ type ( | ||
| 48 | Name string `json:"name"` // 标签名称 | 48 | Name string `json:"name"` // 标签名称 |
| 49 | Category string `json:"category"` // 标签分类 | 49 | Category string `json:"category"` // 标签分类 |
| 50 | Remark string `json:"remark,optional"` // 备注 | 50 | Remark string `json:"remark,optional"` // 备注 |
| 51 | - Other string `json:"other"` | 51 | + Other string `json:"other,optional"` |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | TagCreateResponse { | 54 | TagCreateResponse { |
| @@ -65,7 +65,7 @@ type ( | @@ -65,7 +65,7 @@ type ( | ||
| 65 | Name string `json:"name"` // 标签名称 | 65 | Name string `json:"name"` // 标签名称 |
| 66 | Category string `json:"category"` // 标签分类 | 66 | Category string `json:"category"` // 标签分类 |
| 67 | Remark string `json:"remark,optional"` // 备注 | 67 | Remark string `json:"remark,optional"` // 备注 |
| 68 | - Other string `json:"other"` | 68 | + Other string `json:"other,optional"` |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | TagEditResponse { | 71 | TagEditResponse { |
| @@ -248,7 +248,7 @@ type ( | @@ -248,7 +248,7 @@ type ( | ||
| 248 | MiniArticleDraftGetMeResponse { | 248 | MiniArticleDraftGetMeResponse { |
| 249 | Id int64 `json:"id"` // | 249 | Id int64 `json:"id"` // |
| 250 | Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 | 250 | Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 |
| 251 | - Section []string `json:"Section"` // 填写的内容 | 251 | + Section []string `json:"section"` // 填写的内容 |
| 252 | Title string `json:"title"` // 标题 | 252 | Title string `json:"title"` // 标题 |
| 253 | Images []string `json:"images"` // 图片 | 253 | Images []string `json:"images"` // 图片 |
| 254 | WhoRead []int64 `json:"whoRead"` // 谁可以看 | 254 | WhoRead []int64 `json:"whoRead"` // 谁可以看 |
| @@ -356,6 +356,7 @@ type ( | @@ -356,6 +356,7 @@ type ( | ||
| 356 | CountRead int `json:"countRead"` // 浏览数量 | 356 | CountRead int `json:"countRead"` // 浏览数量 |
| 357 | Show int `json:"show"` // 评论的展示状态(0显示、1不显示) | 357 | Show int `json:"show"` // 评论的展示状态(0显示、1不显示) |
| 358 | Tags []ArticleTagItem `json:"tags"` //标签 | 358 | Tags []ArticleTagItem `json:"tags"` //标签 |
| 359 | + TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | ||
| 359 | } | 360 | } |
| 360 | ) | 361 | ) |
| 361 | 362 |
| @@ -229,7 +229,7 @@ type ( | @@ -229,7 +229,7 @@ type ( | ||
| 229 | Page int `json:"page"` | 229 | Page int `json:"page"` |
| 230 | Size int `json:"size"` | 230 | Size int `json:"size"` |
| 231 | ArticleId int64 `json:"articleId"` // 文章ID | 231 | ArticleId int64 `json:"articleId"` // 文章ID |
| 232 | - TopId int64 `json:"topId"` // 文章顶层ID | 232 | + TopId int64 `json:"topId,optional"` // 文章顶层ID |
| 233 | AuthorId int64 `json:"authorId,optional"` // 用户 | 233 | AuthorId int64 `json:"authorId,optional"` // 用户 |
| 234 | Show int `json:"show,optional"` // 显示状态 | 234 | Show int `json:"show,optional"` // 显示状态 |
| 235 | BeginTime int64 `json:"beginTime,optional"` // 开始时间 | 235 | BeginTime int64 `json:"beginTime,optional"` // 开始时间 |
| @@ -71,9 +71,9 @@ type ( | @@ -71,9 +71,9 @@ type ( | ||
| 71 | Id int64 `json:"id"` | 71 | Id int64 `json:"id"` |
| 72 | CompanyId int64 `json:"companyId,omitempty"` // 公司ID | 72 | CompanyId int64 `json:"companyId,omitempty"` // 公司ID |
| 73 | CompanyName string `json:"companyName,omitempty"` // 公司名称 | 73 | CompanyName string `json:"companyName,omitempty"` // 公司名称 |
| 74 | - Name string `json:"name,omitempty"` // 名称 | ||
| 75 | - Avatar string `json:"avatar,omitempty"` // 头像 | ||
| 76 | - Position string `json:"position,omitempty"` // 职位 | 74 | + Name string `json:"name"` // 名称 |
| 75 | + Avatar string `json:"avatar"` // 头像 | ||
| 76 | + Position string `json:"position"` // 职位 | ||
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | 79 |
| @@ -71,7 +71,7 @@ service Core { | @@ -71,7 +71,7 @@ service Core { | ||
| 71 | post /mini/user/unfollow (FollowRequest) | 71 | post /mini/user/unfollow (FollowRequest) |
| 72 | @doc "我点赞的文章或评论" | 72 | @doc "我点赞的文章或评论" |
| 73 | @handler miniMyLike | 73 | @handler miniMyLike |
| 74 | - post /user/mylike (MiniMyLikeRequest)returns (MiniMyLikeResponse) | 74 | + post /mini/user/mylike (MiniMyLikeRequest)returns (MiniMyLikeResponse) |
| 75 | } | 75 | } |
| 76 | 76 | ||
| 77 | type( | 77 | type( |
| @@ -183,9 +183,10 @@ type( | @@ -183,9 +183,10 @@ type( | ||
| 183 | } | 183 | } |
| 184 | Department struct { | 184 | Department struct { |
| 185 | Id int64 `json:"id,omitempty"` // 部门ID | 185 | Id int64 `json:"id,omitempty"` // 部门ID |
| 186 | - CompanyId int64 `json:"companyId,omitempty"` // 公司ID | ||
| 187 | - ParentId int64 `json:"parentId,omitempty"` // 父级ID | ||
| 188 | - Name string `json:"name,omitempty"` // 部门名称 | 186 | + CompanyId int64 `json:"companyId"` // 公司ID |
| 187 | + ParentId int64 `json:"parentId"` // 父级ID | ||
| 188 | + Name string `json:"name"` // 部门名称 | ||
| 189 | + UserIds []int64 `json:"userIds"` // 部门下的用户 | ||
| 189 | } | 190 | } |
| 190 | UserSearchRequest{ | 191 | UserSearchRequest{ |
| 191 | Page int `json:"page,optional"` | 192 | Page int `json:"page,optional"` |
| @@ -242,7 +242,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -242,7 +242,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
| 242 | }, | 242 | }, |
| 243 | { | 243 | { |
| 244 | Method: http.MethodPost, | 244 | Method: http.MethodPost, |
| 245 | - Path: "/user/mylike", | 245 | + Path: "/mini/user/mylike", |
| 246 | Handler: user.MiniMyLikeHandler(serverCtx), | 246 | Handler: user.MiniMyLikeHandler(serverCtx), |
| 247 | }, | 247 | }, |
| 248 | }, | 248 | }, |
| @@ -51,6 +51,8 @@ func (l *MiniArticleMarkUserReadLogic) MiniArticleMarkUserRead(req *types.MiniAr | @@ -51,6 +51,8 @@ func (l *MiniArticleMarkUserReadLogic) MiniArticleMarkUserRead(req *types.MiniAr | ||
| 51 | return nil, xerr.NewErrMsgErr("标记浏览记录失败", err) | 51 | return nil, xerr.NewErrMsgErr("标记浏览记录失败", err) |
| 52 | } | 52 | } |
| 53 | if len(markRecord) > 0 { | 53 | if len(markRecord) > 0 { |
| 54 | + markRecord[0].Author = articleData.Author | ||
| 55 | + markRecord[0].Title = articleData.Title | ||
| 54 | _, err = l.svcCtx.UserReadArticleRepository.Update(l.ctx, conn, markRecord[0]) | 56 | _, err = l.svcCtx.UserReadArticleRepository.Update(l.ctx, conn, markRecord[0]) |
| 55 | if err != nil { | 57 | if err != nil { |
| 56 | return nil, xerr.NewErrMsgErr("标记浏览记录失败", err) | 58 | return nil, xerr.NewErrMsgErr("标记浏览记录失败", err) |
| @@ -170,11 +170,11 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR | @@ -170,11 +170,11 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR | ||
| 170 | } | 170 | } |
| 171 | //设置内容概要 | 171 | //设置内容概要 |
| 172 | if len(sectionList) > 0 { | 172 | if len(sectionList) > 0 { |
| 173 | - // 截取内容 30个字 | 173 | + // 截取内容 50个字 |
| 174 | runeNumber := 0 //字数 | 174 | runeNumber := 0 //字数 |
| 175 | stringIndex := 0 //字符串长度 | 175 | stringIndex := 0 //字符串长度 |
| 176 | for i := range sectionList[0].Content { | 176 | for i := range sectionList[0].Content { |
| 177 | - if runeNumber > 30 { | 177 | + if runeNumber > 50 { |
| 178 | break | 178 | break |
| 179 | } | 179 | } |
| 180 | runeNumber += 1 | 180 | runeNumber += 1 |
| @@ -47,11 +47,12 @@ func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.Mini | @@ -47,11 +47,12 @@ func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.Mini | ||
| 47 | images = append(images, val.Url) | 47 | images = append(images, val.Url) |
| 48 | } | 48 | } |
| 49 | resp.List[i] = types.MiniArticleDraftItem{ | 49 | resp.List[i] = types.MiniArticleDraftItem{ |
| 50 | - Id: draftList[i].Id, | ||
| 51 | - Template: draftList[i].Template, | ||
| 52 | - Section: draftList[i].Content, | ||
| 53 | - Title: draftList[i].Title, | ||
| 54 | - Images: images, | 50 | + Id: draftList[i].Id, |
| 51 | + Template: draftList[i].Template, | ||
| 52 | + Section: draftList[i].Content, | ||
| 53 | + Title: draftList[i].Title, | ||
| 54 | + Images: images, | ||
| 55 | + CreatedAt: draftList[i].CreatedAt, | ||
| 55 | } | 56 | } |
| 56 | } | 57 | } |
| 57 | return resp, nil | 58 | return resp, nil |
| @@ -65,6 +65,7 @@ func (l *SystemGetArticleLogic) SystemGetArticle(req *types.SystemArticleGetRequ | @@ -65,6 +65,7 @@ func (l *SystemGetArticleLogic) SystemGetArticle(req *types.SystemArticleGetRequ | ||
| 65 | CountRead: article.CountRead, | 65 | CountRead: article.CountRead, |
| 66 | Show: int(article.Show), | 66 | Show: int(article.Show), |
| 67 | Tags: make([]types.ArticleTagItem, 0), | 67 | Tags: make([]types.ArticleTagItem, 0), |
| 68 | + TargetUser: int(article.TargetUser), | ||
| 68 | } | 69 | } |
| 69 | //标签 | 70 | //标签 |
| 70 | if len(article.Tags) > 0 { | 71 | if len(article.Tags) > 0 { |
| @@ -4,6 +4,8 @@ import ( | @@ -4,6 +4,8 @@ import ( | ||
| 4 | "context" | 4 | "context" |
| 5 | "strconv" | 5 | "strconv" |
| 6 | 6 | ||
| 7 | + "strings" | ||
| 8 | + | ||
| 7 | "github.com/samber/lo" | 9 | "github.com/samber/lo" |
| 8 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" | 10 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" |
| 9 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | 11 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" |
| @@ -11,7 +13,6 @@ import ( | @@ -11,7 +13,6 @@ import ( | ||
| 11 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | 13 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" |
| 12 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/tool/oss" | 14 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/tool/oss" |
| 13 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | 15 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" |
| 14 | - "strings" | ||
| 15 | 16 | ||
| 16 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | 17 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" |
| 17 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | 18 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" |
| @@ -147,11 +148,11 @@ func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleU | @@ -147,11 +148,11 @@ func (l *SystemUpdateArticleLogic) SystemUpdateArticle(req *types.SystemArticleU | ||
| 147 | }) | 148 | }) |
| 148 | //设置内容概要 | 149 | //设置内容概要 |
| 149 | if len(req.Section) > 0 { | 150 | if len(req.Section) > 0 { |
| 150 | - // 截取内容 30个字 | 151 | + // 截取内容 50个字 |
| 151 | runeNumber := 0 //字数 | 152 | runeNumber := 0 //字数 |
| 152 | stringIndex := 0 //字符串长度 | 153 | stringIndex := 0 //字符串长度 |
| 153 | for i := range req.Section[0].Content { | 154 | for i := range req.Section[0].Content { |
| 154 | - if runeNumber > 30 { | 155 | + if runeNumber > 50 { |
| 155 | break | 156 | break |
| 156 | } | 157 | } |
| 157 | runeNumber += 1 | 158 | runeNumber += 1 |
| @@ -57,6 +57,7 @@ func (l *SystemAddLogic) SystemAdd(req *types.DepartmentAddRequest) (resp *types | @@ -57,6 +57,7 @@ func (l *SystemAddLogic) SystemAdd(req *types.DepartmentAddRequest) (resp *types | ||
| 57 | if len(req.Ids) > 0 { | 57 | if len(req.Ids) > 0 { |
| 58 | _, users, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions(). | 58 | _, users, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions(). |
| 59 | WithOffsetLimit(1, len(req.Ids)).WithFindOnly(). | 59 | WithOffsetLimit(1, len(req.Ids)).WithFindOnly(). |
| 60 | + WithKV("ids", req.Ids). | ||
| 60 | WithKV("companyId", userToken.CompanyId)) | 61 | WithKV("companyId", userToken.CompanyId)) |
| 61 | if err != nil { | 62 | if err != nil { |
| 62 | return err | 63 | return err |
| @@ -4,6 +4,8 @@ import ( | @@ -4,6 +4,8 @@ import ( | ||
| 4 | "context" | 4 | "context" |
| 5 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | 5 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" |
| 6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | 6 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" |
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata" | ||
| 7 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | 9 | "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" |
| 8 | 10 | ||
| 9 | "github.com/zeromicro/go-zero/core/logx" | 11 | "github.com/zeromicro/go-zero/core/logx" |
| @@ -24,17 +26,32 @@ func NewSystemGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemG | @@ -24,17 +26,32 @@ func NewSystemGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemG | ||
| 24 | } | 26 | } |
| 25 | 27 | ||
| 26 | func (l *SystemGetLogic) SystemGet(req *types.DepartmentGetRequest) (resp *types.DepartmentGetResponse, err error) { | 28 | func (l *SystemGetLogic) SystemGet(req *types.DepartmentGetRequest) (resp *types.DepartmentGetResponse, err error) { |
| 29 | + var userToken = contextdata.GetUserTokenFromCtx(l.ctx) | ||
| 27 | var conn = l.svcCtx.DefaultDBConn() | 30 | var conn = l.svcCtx.DefaultDBConn() |
| 28 | department, err := l.svcCtx.DepartmentRepository.FindOne(l.ctx, conn, req.Id) | 31 | department, err := l.svcCtx.DepartmentRepository.FindOne(l.ctx, conn, req.Id) |
| 29 | if err != nil { | 32 | if err != nil { |
| 30 | return nil, xerr.NewErrMsg("数据不存在") | 33 | return nil, xerr.NewErrMsg("数据不存在") |
| 31 | } | 34 | } |
| 35 | + | ||
| 36 | + // 部门下的用户 | ||
| 37 | + _, users, err := l.svcCtx.UserRepository.Find(l.ctx, conn, domain.NewQueryOptions().WithFindOnly(). | ||
| 38 | + WithKV("companyId", userToken.CompanyId). | ||
| 39 | + WithKV("auditStatus", domain.UserAuditStatusPassed). | ||
| 40 | + WithKV("departmentId", department.Id)) | ||
| 41 | + if err != nil { | ||
| 42 | + return nil, err | ||
| 43 | + } | ||
| 44 | + ids := make([]int64, 0) | ||
| 45 | + for i := range users { | ||
| 46 | + ids = append(ids, users[i].Id) | ||
| 47 | + } | ||
| 32 | resp = &types.DepartmentGetResponse{ | 48 | resp = &types.DepartmentGetResponse{ |
| 33 | Department: types.Department{ | 49 | Department: types.Department{ |
| 34 | Id: department.Id, | 50 | Id: department.Id, |
| 35 | CompanyId: department.CompanyId, | 51 | CompanyId: department.CompanyId, |
| 36 | ParentId: department.ParentId, | 52 | ParentId: department.ParentId, |
| 37 | Name: department.Name, | 53 | Name: department.Name, |
| 54 | + UserIds: ids, | ||
| 38 | }, | 55 | }, |
| 39 | } | 56 | } |
| 40 | return resp, nil | 57 | return resp, nil |
| @@ -43,10 +43,7 @@ func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.Tag | @@ -43,10 +43,7 @@ func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.Tag | ||
| 43 | if cnt > 0 { | 43 | if cnt > 0 { |
| 44 | return nil, xerr.NewErrMsg(fmt.Sprintf("已存在标签 分类[%s]名称[%s]", req.Category, req.Name)) | 44 | return nil, xerr.NewErrMsg(fmt.Sprintf("已存在标签 分类[%s]名称[%s]", req.Category, req.Name)) |
| 45 | } | 45 | } |
| 46 | - //获取图片的尺寸大小 | ||
| 47 | - fInfo, _ := oss.GetImageInfo(req.Image) | ||
| 48 | - w, _ := strconv.Atoi(fInfo.ImageWidth.Value) | ||
| 49 | - h, _ := strconv.Atoi(fInfo.ImageHeight.Value) | 46 | + |
| 50 | newTag := &domain.ArticleTag{ | 47 | newTag := &domain.ArticleTag{ |
| 51 | Id: 0, | 48 | Id: 0, |
| 52 | CompanyId: req.CompanyId, | 49 | CompanyId: req.CompanyId, |
| @@ -54,17 +51,23 @@ func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.Tag | @@ -54,17 +51,23 @@ func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.Tag | ||
| 54 | UpdatedAt: 0, | 51 | UpdatedAt: 0, |
| 55 | DeletedAt: 0, | 52 | DeletedAt: 0, |
| 56 | Version: 0, | 53 | Version: 0, |
| 57 | - Image: domain.Image{ | 54 | + Image: domain.Image{}, |
| 55 | + Name: req.Name, | ||
| 56 | + Category: req.Category, | ||
| 57 | + Remark: req.Remark, | ||
| 58 | + Other: req.Other, | ||
| 59 | + } | ||
| 60 | + if len(req.Image) > 0 { | ||
| 61 | + //获取图片的尺寸大小 | ||
| 62 | + fInfo, _ := oss.GetImageInfo(req.Image) | ||
| 63 | + w, _ := strconv.Atoi(fInfo.ImageWidth.Value) | ||
| 64 | + h, _ := strconv.Atoi(fInfo.ImageHeight.Value) | ||
| 65 | + newTag.Image = domain.Image{ | ||
| 58 | Url: req.Image, | 66 | Url: req.Image, |
| 59 | Width: w, | 67 | Width: w, |
| 60 | Height: h, | 68 | Height: h, |
| 61 | - }, | ||
| 62 | - Name: req.Name, | ||
| 63 | - Category: req.Category, | ||
| 64 | - Remark: req.Remark, | ||
| 65 | - Other: req.Other, | 69 | + } |
| 66 | } | 70 | } |
| 67 | - | ||
| 68 | newTag, err = l.svcCtx.ArticleTagRepository.Insert(l.ctx, conn, newTag) | 71 | newTag, err = l.svcCtx.ArticleTagRepository.Insert(l.ctx, conn, newTag) |
| 69 | if err != nil { | 72 | if err != nil { |
| 70 | return nil, xerr.NewErrMsgErr("添加标签失败", err) | 73 | return nil, xerr.NewErrMsgErr("添加标签失败", err) |
| @@ -54,16 +54,19 @@ func (l *EditTagLogic) EditTag(req *types.TagEditRequest) (resp *types.TagEditRe | @@ -54,16 +54,19 @@ func (l *EditTagLogic) EditTag(req *types.TagEditRequest) (resp *types.TagEditRe | ||
| 54 | if oldTag.CompanyId != req.CompanyId { | 54 | if oldTag.CompanyId != req.CompanyId { |
| 55 | return nil, xerr.NewErrMsg("修改标签失败") | 55 | return nil, xerr.NewErrMsg("修改标签失败") |
| 56 | } | 56 | } |
| 57 | - //获取图片的尺寸大小 | ||
| 58 | - fInfo, _ := oss.GetImageInfo(req.Image) | ||
| 59 | - w, _ := strconv.Atoi(fInfo.ImageWidth.Value) | ||
| 60 | - h, _ := strconv.Atoi(fInfo.ImageHeight.Value) | ||
| 61 | - oldTag.Category = req.Category | ||
| 62 | - oldTag.Image = domain.Image{ | ||
| 63 | - Url: req.Image, | ||
| 64 | - Width: w, | ||
| 65 | - Height: h, | 57 | + oldTag.Image = domain.Image{} |
| 58 | + if len(req.Image) > 0 { | ||
| 59 | + // 获取图片的尺寸大小 | ||
| 60 | + fInfo, _ := oss.GetImageInfo(req.Image) | ||
| 61 | + w, _ := strconv.Atoi(fInfo.ImageWidth.Value) | ||
| 62 | + h, _ := strconv.Atoi(fInfo.ImageHeight.Value) | ||
| 63 | + oldTag.Image = domain.Image{ | ||
| 64 | + Url: req.Image, | ||
| 65 | + Width: w, | ||
| 66 | + Height: h, | ||
| 67 | + } | ||
| 66 | } | 68 | } |
| 69 | + oldTag.Category = req.Category | ||
| 67 | oldTag.Name = req.Name | 70 | oldTag.Name = req.Name |
| 68 | oldTag.Remark = req.Remark | 71 | oldTag.Remark = req.Remark |
| 69 | oldTag.Other = req.Other | 72 | oldTag.Other = req.Other |
| @@ -28,10 +28,10 @@ func (l *SearchTagLogic) SearchTag(req *types.TagListRequest) (resp *types.TagLi | @@ -28,10 +28,10 @@ func (l *SearchTagLogic) SearchTag(req *types.TagListRequest) (resp *types.TagLi | ||
| 28 | queryOptions := domain.NewQueryOptions().WithOffsetLimit(req.Page, req.Size) | 28 | queryOptions := domain.NewQueryOptions().WithOffsetLimit(req.Page, req.Size) |
| 29 | 29 | ||
| 30 | if len(req.Category) > 0 { | 30 | if len(req.Category) > 0 { |
| 31 | - queryOptions = queryOptions.MustWithKV("group", req.Category) | 31 | + queryOptions = queryOptions.MustWithKV("group", "%"+req.Category+"%") |
| 32 | } | 32 | } |
| 33 | if len(req.TagName) > 0 { | 33 | if len(req.TagName) > 0 { |
| 34 | - queryOptions = queryOptions.MustWithKV("name", req.TagName) | 34 | + queryOptions = queryOptions.MustWithKV("name", "%"+req.TagName+"%") |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | if len(req.Remark) > 0 { | 37 | if len(req.Remark) > 0 { |
| @@ -140,7 +140,7 @@ type SystemArticleCommentSearchRequest struct { | @@ -140,7 +140,7 @@ type SystemArticleCommentSearchRequest struct { | ||
| 140 | Page int `json:"page"` | 140 | Page int `json:"page"` |
| 141 | Size int `json:"size"` | 141 | Size int `json:"size"` |
| 142 | ArticleId int64 `json:"articleId"` // 文章ID | 142 | ArticleId int64 `json:"articleId"` // 文章ID |
| 143 | - TopId int64 `json:"topId"` // 文章顶层ID | 143 | + TopId int64 `json:"topId,optional"` // 文章顶层ID |
| 144 | AuthorId int64 `json:"authorId,optional"` // 用户 | 144 | AuthorId int64 `json:"authorId,optional"` // 用户 |
| 145 | Show int `json:"show,optional"` // 显示状态 | 145 | Show int `json:"show,optional"` // 显示状态 |
| 146 | BeginTime int64 `json:"beginTime,optional"` // 开始时间 | 146 | BeginTime int64 `json:"beginTime,optional"` // 开始时间 |
| @@ -296,9 +296,9 @@ type SimpleUser struct { | @@ -296,9 +296,9 @@ type SimpleUser struct { | ||
| 296 | Id int64 `json:"id"` | 296 | Id int64 `json:"id"` |
| 297 | CompanyId int64 `json:"companyId,omitempty"` // 公司ID | 297 | CompanyId int64 `json:"companyId,omitempty"` // 公司ID |
| 298 | CompanyName string `json:"companyName,omitempty"` // 公司名称 | 298 | CompanyName string `json:"companyName,omitempty"` // 公司名称 |
| 299 | - Name string `json:"name,omitempty"` // 名称 | ||
| 300 | - Avatar string `json:"avatar,omitempty"` // 头像 | ||
| 301 | - Position string `json:"position,omitempty"` // 职位 | 299 | + Name string `json:"name"` // 名称 |
| 300 | + Avatar string `json:"avatar"` // 头像 | ||
| 301 | + Position string `json:"position"` // 职位 | ||
| 302 | } | 302 | } |
| 303 | 303 | ||
| 304 | type SimpleArticle struct { | 304 | type SimpleArticle struct { |
| @@ -316,7 +316,7 @@ type TagCreateRequest struct { | @@ -316,7 +316,7 @@ type TagCreateRequest struct { | ||
| 316 | Name string `json:"name"` // 标签名称 | 316 | Name string `json:"name"` // 标签名称 |
| 317 | Category string `json:"category"` // 标签分类 | 317 | Category string `json:"category"` // 标签分类 |
| 318 | Remark string `json:"remark,optional"` // 备注 | 318 | Remark string `json:"remark,optional"` // 备注 |
| 319 | - Other string `json:"other"` | 319 | + Other string `json:"other,optional"` |
| 320 | } | 320 | } |
| 321 | 321 | ||
| 322 | type TagCreateResponse struct { | 322 | type TagCreateResponse struct { |
| @@ -330,7 +330,7 @@ type TagEditRequest struct { | @@ -330,7 +330,7 @@ type TagEditRequest struct { | ||
| 330 | Name string `json:"name"` // 标签名称 | 330 | Name string `json:"name"` // 标签名称 |
| 331 | Category string `json:"category"` // 标签分类 | 331 | Category string `json:"category"` // 标签分类 |
| 332 | Remark string `json:"remark,optional"` // 备注 | 332 | Remark string `json:"remark,optional"` // 备注 |
| 333 | - Other string `json:"other"` | 333 | + Other string `json:"other,optional"` |
| 334 | } | 334 | } |
| 335 | 335 | ||
| 336 | type TagEditResponse struct { | 336 | type TagEditResponse struct { |
| @@ -519,10 +519,11 @@ type Account struct { | @@ -519,10 +519,11 @@ type Account struct { | ||
| 519 | } | 519 | } |
| 520 | 520 | ||
| 521 | type Department struct { | 521 | type Department struct { |
| 522 | - Id int64 `json:"id,omitempty"` // 部门ID | ||
| 523 | - CompanyId int64 `json:"companyId,omitempty"` // 公司ID | ||
| 524 | - ParentId int64 `json:"parentId,omitempty"` // 父级ID | ||
| 525 | - Name string `json:"name,omitempty"` // 部门名称 | 522 | + Id int64 `json:"id,omitempty"` // 部门ID |
| 523 | + CompanyId int64 `json:"companyId"` // 公司ID | ||
| 524 | + ParentId int64 `json:"parentId"` // 父级ID | ||
| 525 | + Name string `json:"name"` // 部门名称 | ||
| 526 | + UserIds []int64 `json:"userIds"` // 部门下的用户 | ||
| 526 | } | 527 | } |
| 527 | 528 | ||
| 528 | type UserSearchRequest struct { | 529 | type UserSearchRequest struct { |
| @@ -949,7 +950,7 @@ type MiniArticleDraftGetMeRequest struct { | @@ -949,7 +950,7 @@ type MiniArticleDraftGetMeRequest struct { | ||
| 949 | type MiniArticleDraftGetMeResponse struct { | 950 | type MiniArticleDraftGetMeResponse struct { |
| 950 | Id int64 `json:"id"` // | 951 | Id int64 `json:"id"` // |
| 951 | Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 | 952 | Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式 |
| 952 | - Section []string `json:"Section"` // 填写的内容 | 953 | + Section []string `json:"section"` // 填写的内容 |
| 953 | Title string `json:"title"` // 标题 | 954 | Title string `json:"title"` // 标题 |
| 954 | Images []string `json:"images"` // 图片 | 955 | Images []string `json:"images"` // 图片 |
| 955 | WhoRead []int64 `json:"whoRead"` // 谁可以看 | 956 | WhoRead []int64 `json:"whoRead"` // 谁可以看 |
| @@ -1047,6 +1048,7 @@ type SystemArticleGetResponse struct { | @@ -1047,6 +1048,7 @@ type SystemArticleGetResponse struct { | ||
| 1047 | CountRead int `json:"countRead"` // 浏览数量 | 1048 | CountRead int `json:"countRead"` // 浏览数量 |
| 1048 | Show int `json:"show"` // 评论的展示状态(0显示、1不显示) | 1049 | Show int `json:"show"` // 评论的展示状态(0显示、1不显示) |
| 1049 | Tags []ArticleTagItem `json:"tags"` //标签 | 1050 | Tags []ArticleTagItem `json:"tags"` //标签 |
| 1051 | + TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人] | ||
| 1050 | } | 1052 | } |
| 1051 | 1053 | ||
| 1052 | type SystemArticleSearchRequest struct { | 1054 | type SystemArticleSearchRequest struct { |
| @@ -136,7 +136,9 @@ func (repository *ArticleRepository) Find(ctx context.Context, conn transaction. | @@ -136,7 +136,9 @@ func (repository *ArticleRepository) Find(ctx context.Context, conn transaction. | ||
| 136 | if v, ok := queryOptions["endCreatedAt"]; ok { | 136 | if v, ok := queryOptions["endCreatedAt"]; ok { |
| 137 | tx = tx.Where("created_at < ?", v) | 137 | tx = tx.Where("created_at < ?", v) |
| 138 | } | 138 | } |
| 139 | - | 139 | + if v, ok := queryOptions["authorId"]; ok { |
| 140 | + tx = tx.Where("author_id=?", v) | ||
| 141 | + } | ||
| 140 | if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { | 142 | if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { |
| 141 | return dms, tx.Error | 143 | return dms, tx.Error |
| 142 | } | 144 | } |
| @@ -155,7 +155,9 @@ func (repository *ArticleTagRepository) Find(ctx context.Context, conn transacti | @@ -155,7 +155,9 @@ func (repository *ArticleTagRepository) Find(ctx context.Context, conn transacti | ||
| 155 | if v, ok := queryOptions["ids"]; ok { | 155 | if v, ok := queryOptions["ids"]; ok { |
| 156 | tx = tx.Where("id in (?)", v) | 156 | tx = tx.Where("id in (?)", v) |
| 157 | } | 157 | } |
| 158 | - | 158 | + if v, ok := queryOptions["remark"]; ok { |
| 159 | + tx = tx.Where("remark like ?", v) | ||
| 160 | + } | ||
| 159 | if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { | 161 | if total, tx = transaction.PaginationAndCount(ctx, tx, queryOptions, &ms); tx.Error != nil { |
| 160 | return dms, tx.Error | 162 | return dms, tx.Error |
| 161 | } | 163 | } |
-
请 注册 或 登录 后发表评论