作者 yangfu
正在显示 42 个修改的文件 包含 1525 行增加394 行删除
syntax = "v1"
import "core/article_type.api"
import "core/comment.api"
import "core/message.api"
import "core/article_tag.api"
import "core/user.api"
import "core/company.api"
import "core/article_type.api"
import "core/article.api"
import "core/role.api"
\ No newline at end of file
import "core/role.api"
import "core/department.api"
\ No newline at end of file
... ...
... ... @@ -32,18 +32,37 @@ service Core {
@handler MiniArticleMarkUserRead
post /article/mark/user_read (MiniArticleMarkUserReadRequest) returns (MiniArticleMarkUserReadResponse)
@doc "小程序获取文章浏览记录"
@handler MiniArticleMarkList
post /article/mark/list (MiniArticleMarkListRequest) returns (MiniArticleMarkListResponse)
@doc "小程序获取我发布的文章"
@handler MiniArticleSearchMe
post /article/search/me (MiniArticleSearchMeRequest) returns (MiniArticleSearchMeResponse)
@doc "小程序创建文章进草稿箱"
@handler MiniCreateArticleDraft
post /article_draft (MiniArticleSearchMeRequest) returns (MiniArticleSearchMeResponse)
post /article_draft (MiniArticleDraftCreateRequest) returns (MiniArticleDraftCreateResponse)
@doc "小程序更新文章草稿"
@handler MiniUpdateArticleDraft
put /article_draft (MiniArticleDraftUpdateRequest) returns (MiniArticleDraftUpdateResponse)
@doc "小程序获取我的草稿箱列表"
@handler MiniSearchArticleDraftMe
post /article_draft/search/me (MiniArticleDraftSearchMeRequest) returns (MiniArticleDraftSearchMeResponse)
@doc "小程序获取我的草稿内容"
@handler MiniGetArticleDraftMe
get /article_draft/me/:id (MiniArticleDraftGetMeRequest) returns (MiniArticleDraftGetMeResponse)
@doc "小程序删除我的草稿内容"
@handler MiniDeleteArticleDraftMe
delete /article_draft/me/:id (MiniArticleDraftDeleteMeRequest) returns (MiniArticleDraftDeleteMeResponse)
@doc "小程序获取文章的编辑记录"
@handler MiniArticleBackupSearch
post /article_backup/search (MiniArticleBackupSearchRequest) returns (MiniArticleBackupSearchResponse)
}
// 管理后台接口
... ...
... ... @@ -8,11 +8,10 @@ type Location {
}
// 人员的简单展示信息
type Author {
type ArticleAuthor {
Id int64 `json:"id"` // 人员id
Name string `json:"name"` // 人员的名字
Avatar string `json:"avatar"` // 人员头像URL
Group string `json:"group"` // 人员的分组
Position string `json:"position"` // 职位
Company string `json:"company"` // 公司
}
... ... @@ -37,13 +36,14 @@ type (
type (
MiniArticleGetRequest {
Id int64 `path:"id"` //id
CompanyId int64 `path:",optional"`
CompanyId int64 `path:",optional"`//当前公司
UserId int `path:",optional"` //当前用户
}
MiniArticleGetResponse {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题
AuthorId int64 `json:"authorId"` //发布人id
Author Author `json:"author"` //发布人
Author ArticleAuthor `json:"author"` //发布人
CreatedAt int64 `json:"createdAt"` //文章的发布时间
Section []ArticleSection `json:"section"` //文章的文本内容
Images []string `json:"images"` //图片
... ... @@ -55,6 +55,7 @@ type (
CountRead int `json:"countRead"` // 浏览数量
Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
Edit int `json:"edit"` // 文章是否存在变更记录 (0 不存在 1存在)
MeLoveFlag int `json:"meLoveFlag"` //当前人员对文章的点赞标识
}
ArticleSection {
Id int64 `json:"id"` //段落id
... ... @@ -160,17 +161,125 @@ type (
}
)
//保存文章到草稿箱
//小程序端创建文章到草稿箱
type (
MiniArticleDraftCreateRequest {
Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
Content []string `json:"content"` // 填写的内容
Title string `json:"title"` //标题
Images []string `json:"images"` //图片
CompanyId int64 `json:",optional"`
AuthorId int64 `json:",optional"` // 发布人
Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
Section []string `json:"section"` // 填写的内容
Title string `json:"title"` // 标题
Images []string `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
}
MiniArticleDraftCreateResponse {
Id int64 `json:"id"`
}
)
//小程序端更新文章草稿
type (
MiniArticleDraftUpdateRequest {
Id int64 `json:"id"`
CompanyId int64 `json:",optional"`
AuthorId int64 `json:",optional"` // 发布人
Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
Section []string `json:"section"` // 填写的内容
Title string `json:"title"` // 标题
Images []string `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
}
MiniArticleDraftUpdateResponse {
Id int64 `json:"id"`
}
)
//小程序端获取我的草稿列表
type (
MiniArticleDraftSearchMeRequest {
CompanyId int64 `json:",optional"` // 公司id
AuthorId int64 `json:",optional"` // 发布人
Page int `json:"page"`
Size int `json:"size"`
}
MiniArticleDraftSearchMeResponse {
Total int64 `json:"total"`
List []MiniArticleDraftItem `json:"list"`
}
MiniArticleDraftItem {
Id int64 `json:"id"`
Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
Section []string `json:"section"` // 填写的内容
Title string `json:"title"` // 标题
Images []string `json:"images"` // 图片
CreatedAt int64 `json:"createdAt"`
}
)
//小程序端获取我的草稿内容
type (
MiniArticleDraftGetMeRequest {
CompanyId int64 `path:",optional"` // 公司id
AuthorId int64 `path:",optional"` // 发布人
Id int64 `path:"id"`
}
MiniArticleDraftGetMeResponse {
Id int64 `json:"id"` //
Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
Section []string `json:"Section"` // 填写的内容
Title string `json:"title"` // 标题
Images []string `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
}
)
// 小程序端删除我的草稿内容
type (
MiniArticleDraftDeleteMeRequest {
CompanyId int64 `path:",optional"` // 公司id
AuthorId int64 `path:",optional"` // 发布人
Id int64 `path:"id"`
}
MiniArticleDraftCreateResponse struct{}
MiniArticleDraftDeleteMeResponse {
Id int64 `json:"id"` //
}
)
// 小程序端获取我的浏览记录
type (
MiniArticleMarkListRequest {
Page int `json:"page"`
Size int `json:"size"`
}
MiniArticleMarkListResponse {
Total int64 `json:"total"`
List []MiniArticleMarkItem `json:"list"`
}
MiniArticleMarkItem {
Id int64 `json:"id"`
CompanyId int64 `json:"companyId"`
UserId int64 `json:"userId"`
ArticleId int64 `json:"articleId"`
Title string `json:"title"`
Author SimpleUser `json:"author"` // 发布人
UpdatedAt int64 `json:"updatedAt"`
}
)
//管理后台获取文章详情
type (
... ... @@ -188,7 +297,7 @@ type (
Id int64 `json:"id"` // id
Title string `json:"title"` // 标题
AuthorId int64 `json:"authorId"` // 发布人id
Author Author `json:"author"` // 发布人
Author ArticleAuthor `json:"author"` // 发布人
CreatedAt int64 `json:"createdAt"` // 文章的发布时间
Section []ArticleSection `json:"section"` // 文章的文本内容
Images []string `json:"images"` // 图片
... ...
syntax = "v1"
info(
title: "天联鹰蜓"
desc: "天联鹰蜓"
author: "email"
title: "评论相关"
desc: "编辑处理文章的评论"
author: "author"
email: "email"
version: "v1"
)
// 小程序接口
@server(
prefix: v1
prefix: v1/mini
group: comment
jwt: MiniAuth
)
service Core {
@doc "小程序评论"
@handler miniComment
get /mini/comment (CommentRequest) returns (CommentResposne)
@doc "小程序获取回复@人可选列表"
@handler MiniArticleCommentAtUser
post /article_comment/at_user/select (MiniArticleCommentAtUserRequest) returns (MiniArticleCommentAtUserResponse)
@doc "小程序填写文章的评论"
@handler MiniCreateArticleComment
post /article_comment (MiniCreateArticleCommentRequest) returns (MiniCreateArticleCommentResponse)
}
// 后台接口
@server(
prefix: v1
group: comment
jwt: SystemAuth
//
// 小程序获取回复@人可选列表
type (
MiniArticleCommentAtUserRequest {
ArtitceId int64 `json:"articleId"`
}
MiniArticleCommentAtUserResponse {
}
)
service Core {
@doc "系统评论"
@handler systemComment
get /system/comment (CommentRequest) returns (CommentResposne)
//评论的填写人
type CommentAuthor {
Id int64 `json:"id"` // 人员id
Name string `json:"name"` // 人员的名字
Avatar string `json:"avatar"` // 人员头像URL
Position string `json:"position"` // 职位
Company string `json:"company"` // 公司
}
// 小程序填写文章的评论
type (
CommentRequest {
}
CommentResposne {
List []Comment `json:"list"`
MiniCreateArticleCommentRequest {
ArtitceId int64 `json:"articleId"` // 文章id
SectionId int64 `json:"sectionId"` // 段落id
FromUserId int64 `json:",optional"` // 填写文章的人,服务端自动获取
Pid int64 `json:"commnet"` // 回复那个评论的id
Content string `json:"content"` // 评论的内容
AtWho []int64 `json:"atWho"` // 填写评论时@的人
}
Comment {
MiniCreateArticleCommentResponse {
Id int64 `json:"id"`
Pid int64 `json:"pid"`
TopId int64 `json:"topId"`
ArtitceId int64 `json:"articleId"` // 文章id
SectionId int64 `json:"sectionId"` // 段落id
FromUserId int64 `json:"fromUserId"` // 填写评论的人
FromUser CommentAuthor `json:"fromUser"` // 填写评论的人
ToUserId int64 `json:"toUserId"` // 回复哪个人
ToUser CommentAuthor `json:"toUser"` // 回复哪个人
SectionContent string `json:"sectionContent"` // 引用的文章内容文本
CountReply int `json:"countReply"` // 回复数量
CountUserLove int `json:"countUserLove"` // 用户点赞数量
CountAdminLove int `json:"countAdminLove"` // 运营点赞数量
AtWho []CommentAuthor `json:"atWho"` // 填写评论时@的人
}
)
\ No newline at end of file
... ...
syntax = "v1"
info(
title: "部门分组"
desc: "部门分组"
author: "zz"
email: "email"
version: "v1"
)
@server(
prefix: v1
group: department
jwt: SystemAuth
)
service Core {
@doc "部门列表"
@handler systemList
post /system/department/list (DepartmentListRequest) returns (DepartmentListResponse)
@doc "部门-新增"
@handler systemAdd
post /system/department/add (DepartmentAddRequest) returns (DepartmentGetResponse)
@doc "部门-详情"
@handler systemGet
get /system/department/:id (DepartmentGetRequest) returns (DepartmentGetResponse)
@doc "部门-更新"
@handler systemUpdate
put /system/department/:id (DepartmentUpdateRequest) returns (DepartmentGetResponse)
}
type (
DepartmentAddRequest {
Name string `json:"name"` // 分组名称
Ids []int64 `json:"ids"` // 用户ID
}
DepartmentGetRequest {
Id int64 `path:"id"`
}
DepartmentGetResponse struct{
Department Department `json:"department"`
}
DepartmentUpdateRequest {
Id int64 `path:"id"`
Name string `json:"name"`
}
DepartmentListRequest {
Page int `json:"page"`
Size int `json:"size"`
}
DepartmentListResponse {
List []Department `json:"list"`
Total int64 `json:"total"`
}
)
... ...
package article
import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
)
func MiniArticleMarkListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniArticleMarkListRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := article.NewMiniArticleMarkListLogic(r.Context(), svcCtx)
resp, err := l.MiniArticleMarkList(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
... ... @@ -7,22 +7,23 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
)
func MiniCreateArticleDraftHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniArticleSearchMeRequest
var req types.MiniArticleDraftCreateRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := article.NewMiniCreateArticleDraftLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.AuthorId = token.UserId
req.CompanyId = token.CompanyId
resp, err := l.MiniCreateArticleDraft(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
result.HttpResult(r, w, resp, err)
}
}
... ...
package article
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
)
func MiniDeleteArticleDraftMeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniArticleDraftDeleteMeRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := article.NewMiniDeleteArticleDraftMeLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.AuthorId = token.UserId
req.CompanyId = token.CompanyId
resp, err := l.MiniDeleteArticleDraftMe(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package article
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
)
func MiniGetArticleDraftMeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniArticleDraftGetMeRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := article.NewMiniGetArticleDraftMeLogic(r.Context(), svcCtx)
resp, err := l.MiniGetArticleDraftMe(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}
... ...
package article
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
)
func MiniSearchArticleDraftMeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniArticleDraftSearchMeRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := article.NewMiniSearchArticleDraftMeLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.AuthorId = token.UserId
req.CompanyId = token.CompanyId
resp, err := l.MiniSearchArticleDraftMe(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package article
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
)
func MiniUpdateArticleDraftHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniArticleDraftUpdateRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := article.NewMiniUpdateArticleDraftLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.AuthorId = token.UserId
req.CompanyId = token.CompanyId
resp, err := l.MiniUpdateArticleDraft(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
... ... @@ -9,16 +9,16 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
)
func MiniCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
func MiniArticleCommentAtUserHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CommentRequest
var req types.MiniArticleCommentAtUserRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := comment.NewMiniCommentLogic(r.Context(), svcCtx)
resp, err := l.MiniComment(&req)
l := comment.NewMiniArticleCommentAtUserLogic(r.Context(), svcCtx)
resp, err := l.MiniArticleCommentAtUser(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
... ...
... ... @@ -9,16 +9,16 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
)
func SystemCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
func MiniCreateArticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CommentRequest
var req types.MiniCreateArticleCommentRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := comment.NewSystemCommentLogic(r.Context(), svcCtx)
resp, err := l.SystemComment(&req)
l := comment.NewMiniCreateArticleCommentLogic(r.Context(), svcCtx)
resp, err := l.MiniCreateArticleComment(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
... ...
package department
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/department"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
)
func SystemAddHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DepartmentAddRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := department.NewSystemAddLogic(r.Context(), svcCtx)
resp, err := l.SystemAdd(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}
... ...
package department
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/department"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
)
func SystemGetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DepartmentGetRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := department.NewSystemGetLogic(r.Context(), svcCtx)
resp, err := l.SystemGet(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}
... ...
package department
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/department"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
)
func SystemListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DepartmentListRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := department.NewSystemListLogic(r.Context(), svcCtx)
resp, err := l.SystemList(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}
... ...
package department
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/department"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
)
func SystemUpdateHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.DepartmentUpdateRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := department.NewSystemUpdateLogic(r.Context(), svcCtx)
resp, err := l.SystemUpdate(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}
... ...
... ... @@ -7,6 +7,7 @@ import (
article "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/article"
comment "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/comment"
company "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/company"
department "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/department"
message "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/message"
role "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/role"
tags "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/tags"
... ... @@ -20,25 +21,18 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/mini/comment",
Handler: comment.MiniCommentHandler(serverCtx),
Method: http.MethodPost,
Path: "/article_comment/at_user/select",
Handler: comment.MiniArticleCommentAtUserHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
rest.WithPrefix("/v1"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodGet,
Path: "/system/comment",
Handler: comment.SystemCommentHandler(serverCtx),
Method: http.MethodPost,
Path: "/article_comment",
Handler: comment.MiniCreateArticleCommentHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
rest.WithPrefix("/v1"),
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
rest.WithPrefix("/v1/mini"),
)
server.AddRoutes(
... ... @@ -284,6 +278,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
},
{
Method: http.MethodPost,
Path: "/article/mark/list",
Handler: article.MiniArticleMarkListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article/search/me",
Handler: article.MiniArticleSearchMeHandler(serverCtx),
},
... ... @@ -293,6 +292,26 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
Handler: article.MiniCreateArticleDraftHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/article_draft",
Handler: article.MiniUpdateArticleDraftHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article_draft/search/me",
Handler: article.MiniSearchArticleDraftMeHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/article_draft/me/:id",
Handler: article.MiniGetArticleDraftMeHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/article_draft/me/:id",
Handler: article.MiniDeleteArticleDraftMeHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article_backup/search",
Handler: article.MiniArticleBackupSearchHandler(serverCtx),
... ... @@ -350,4 +369,31 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
rest.WithPrefix("/v1"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/system/department/list",
Handler: department.SystemListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/system/department/add",
Handler: department.SystemAddHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/system/department/:id",
Handler: department.SystemGetHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/system/department/:id",
Handler: department.SystemUpdateHandler(serverCtx),
},
},
rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
rest.WithPrefix("/v1"),
)
}
... ...
package article
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type MiniArticleMarkListLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMiniArticleMarkListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniArticleMarkListLogic {
return &MiniArticleMarkListLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *MiniArticleMarkListLogic) MiniArticleMarkList(req *types.MiniArticleMarkListRequest) (resp *types.MiniArticleMarkListResponse, err error) {
var userToken = contextdata.GetUserTokenFromCtx(l.ctx)
total, list, err := l.svcCtx.UserReadArticleRepository.Find(l.ctx, l.svcCtx.DefaultDBConn(), domain.NewQueryOptions().
WithOffsetLimit(req.Page, req.Size).
WithKV("userId", userToken.UserId))
if err != nil {
return nil, err
}
resp = &types.MiniArticleMarkListResponse{}
resp.Total = total
resp.List = make([]types.MiniArticleMarkItem, 0)
for _, item := range list {
to := types.MiniArticleMarkItem{
Id: item.Id,
CompanyId: item.CompanyId,
ArticleId: item.ArticleId,
Title: item.Title,
Author: types.SimpleUser{
Id: item.Author.Id,
CompanyId: item.Author.CompanyId,
CompanyName: item.Author.Company,
Name: item.Author.Name,
Avatar: item.Author.Avatar,
Position: item.Author.Position,
},
UpdatedAt: item.UpdatedAt,
}
resp.List = append(resp.List, to)
}
return resp, nil
}
... ...
... ... @@ -83,6 +83,7 @@ func (l *MiniArticleMarkUserReadLogic) MiniArticleMarkUserRead(req *types.MiniAr
if err != nil {
return err
}
//增加浏览计数
err = l.svcCtx.ArticleRepository.IncreaseCountRead(ctx, c, 1, articleInfo)
return err
}, true)
... ...
... ... @@ -5,6 +5,8 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
"github.com/zeromicro/go-zero/core/logx"
)
... ... @@ -23,8 +25,43 @@ func NewMiniCreateArticleDraftLogic(ctx context.Context, svcCtx *svc.ServiceCont
}
}
func (l *MiniCreateArticleDraftLogic) MiniCreateArticleDraft(req *types.MiniArticleSearchMeRequest) (resp *types.MiniArticleSearchMeResponse, err error) {
// todo: add your logic here and delete this line
// 保存文章进草稿箱
func (l *MiniCreateArticleDraftLogic) MiniCreateArticleDraft(req *types.MiniArticleDraftCreateRequest) (resp *types.MiniArticleDraftCreateResponse, err error) {
var conn = l.svcCtx.DefaultDBConn()
newDraft := domain.ArticleDraft{
Id: 0,
CompanyId: req.CompanyId,
CreatedAt: 0,
UpdatedAt: 0,
DeletedAt: 0,
Version: 0,
Template: req.Template,
Content: req.Section,
AuthorId: req.AuthorId,
Title: req.Title,
Images: []domain.Image{},
WhoRead: req.WhoRead,
WhoReview: req.WhoReview,
Location: domain.Location{
Longitude: req.Location.Longitude,
Latitude: req.Location.Latitude,
Descript: req.Location.Descript,
},
}
for _, val := range req.Images {
newDraft.Images = append(newDraft.Images, domain.Image{
Url: val,
})
}
_, err = l.svcCtx.ArticleDraftRepository.Insert(l.ctx, conn, &newDraft)
if err != nil {
return nil, xerr.NewErrMsgErr("保存草稿失败", err)
}
resp = &types.MiniArticleDraftCreateResponse{
Id: newDraft.Id,
}
return
}
... ...
... ... @@ -43,19 +43,10 @@ func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateR
Id: author.Id,
Name: author.Name,
Avatar: author.Avatar,
GroupId: 0,
Group: "",
Position: author.Position,
Company: companyInfo.Name,
CompanyId: author.CompanyId,
}
if author.DepartmentId > 0 {
department, err := l.svcCtx.DepartmentRepository.FindOne(l.ctx, conn, author.DepartmentId)
if err == nil {
articleAuthor.GroupId = department.Id
articleAuthor.Group = department.Name
}
}
if len(req.Images) > 9 {
return nil, xerr.NewErrMsg("图片数量最多9张")
}
... ...
package article
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
"github.com/zeromicro/go-zero/core/logx"
)
type MiniDeleteArticleDraftMeLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMiniDeleteArticleDraftMeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniDeleteArticleDraftMeLogic {
return &MiniDeleteArticleDraftMeLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
// 删除我的草稿记录
func (l *MiniDeleteArticleDraftMeLogic) MiniDeleteArticleDraftMe(req *types.MiniArticleDraftDeleteMeRequest) (resp *types.MiniArticleDraftDeleteMeResponse, err error) {
var conn = l.svcCtx.DefaultDBConn()
draftInfo, err := l.svcCtx.ArticleDraftRepository.FindOne(l.ctx, conn, req.Id)
if err != nil {
return nil, xerr.NewErrMsgErr("删除草稿失败", err)
}
if draftInfo.AuthorId != req.AuthorId {
if err != nil {
return nil, xerr.NewErrMsg("删除草稿失败")
}
}
_, err = l.svcCtx.ArticleDraftRepository.Delete(l.ctx, conn, draftInfo)
if err != nil {
return nil, xerr.NewErrMsgErr("删除草稿失败", err)
}
resp = &types.MiniArticleDraftDeleteMeResponse{
Id: draftInfo.Id,
}
return resp, nil
}
... ...
package article
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
"github.com/zeromicro/go-zero/core/logx"
)
type MiniGetArticleDraftMeLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMiniGetArticleDraftMeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniGetArticleDraftMeLogic {
return &MiniGetArticleDraftMeLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
// 获取我的草稿记录
func (l *MiniGetArticleDraftMeLogic) MiniGetArticleDraftMe(req *types.MiniArticleDraftGetMeRequest) (resp *types.MiniArticleDraftGetMeResponse, err error) {
var conn = l.svcCtx.DefaultDBConn()
draftInfo, err := l.svcCtx.ArticleDraftRepository.FindOne(l.ctx, conn, req.Id)
if err != nil {
return nil, xerr.NewErrMsgErr("获取草稿失败", err)
}
if draftInfo.AuthorId != req.AuthorId {
if err != nil {
return nil, xerr.NewErrMsg("获取草稿失败")
}
}
resp = &types.MiniArticleDraftGetMeResponse{
Id: draftInfo.Id,
Template: draftInfo.Template,
Section: draftInfo.Content,
Title: draftInfo.Title,
Images: []string{},
WhoRead: draftInfo.WhoRead,
WhoReview: draftInfo.WhoReview,
Location: types.Location{
Longitude: draftInfo.Location.Longitude,
Latitude: draftInfo.Location.Latitude,
Descript: draftInfo.Location.Descript,
},
}
for _, val := range draftInfo.Images {
resp.Images = append(resp.Images, val.Url)
}
return
}
... ...
... ... @@ -38,7 +38,10 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) (
return nil, xerr.NewErrMsg("没有查看权限")
}
//TODO 检查可查看人
if articleInfo.Show == domain.ArticleShowDisable {
// 文章内容不显示
resp = &types.MiniArticleGetResponse{
Id: articleInfo.Id,
Title: articleInfo.Title,
... ... @@ -54,6 +57,20 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) (
if err != nil {
return nil, xerr.NewErrMsgErr("读取文章内容失败", err)
}
var meLoveFlag int
if req.UserId > 0 {
// 获取我对文章的点赞标识
queryOption = domain.NewQueryOptions().
WithCountOnly().
MustWithKV("articleId", articleInfo.Id).
MustWithKV("commentId", 0).
MustWithKV("userId", req.UserId)
cnt, _, _ := l.svcCtx.UserLoveFlagRepository.Find(l.ctx, conn, queryOption)
if cnt > 0 {
meLoveFlag = 1
}
}
sortBy := domain.SortArticleSection(sectionList)
sort.Sort(sortBy)
articleSection := []types.ArticleSection{}
... ... @@ -70,11 +87,11 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) (
Id: articleInfo.Id,
Title: articleInfo.Title,
AuthorId: articleInfo.AuthorId,
Author: types.Author{
Id: articleInfo.Author.Id,
Name: articleInfo.Author.Name,
Avatar: articleInfo.Author.Avatar,
Group: articleInfo.Author.Group,
Author: types.ArticleAuthor{
Id: articleInfo.Author.Id,
Name: articleInfo.Author.Name,
Avatar: articleInfo.Author.Avatar,
// Group: articleInfo.Author.Group,
Position: articleInfo.Author.Position,
Company: articleInfo.Author.Company,
},
... ... @@ -93,6 +110,7 @@ func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) (
CountRead: articleInfo.CountRead,
Show: int(articleInfo.Show),
Edit: 0,
MeLoveFlag: meLoveFlag,
}
if articleInfo.CreatedAt != articleInfo.UpdatedAt {
resp.Edit = 1
... ...
package article
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
"github.com/zeromicro/go-zero/core/logx"
)
type MiniSearchArticleDraftMeLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMiniSearchArticleDraftMeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniSearchArticleDraftMeLogic {
return &MiniSearchArticleDraftMeLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *MiniSearchArticleDraftMeLogic) MiniSearchArticleDraftMe(req *types.MiniArticleDraftSearchMeRequest) (resp *types.MiniArticleDraftSearchMeResponse, err error) {
var conn = l.svcCtx.DefaultDBConn()
queryOption := domain.NewQueryOptions().
WithOffsetLimit(req.Page, req.Size).
MustWithKV("authorId", req.AuthorId)
cnt, draftList, err := l.svcCtx.ArticleDraftRepository.Find(l.ctx, conn, queryOption)
if err != nil {
return nil, xerr.NewErrMsgErr("获取草稿列表失败", err)
}
resp = &types.MiniArticleDraftSearchMeResponse{
Total: cnt,
List: make([]types.MiniArticleDraftItem, len(draftList)),
}
for i := range draftList {
images := []string{}
for _, val := range draftList[i].Images {
images = append(images, val.Url)
}
resp.List[i] = types.MiniArticleDraftItem{
Id: draftList[i].Id,
Template: draftList[i].Template,
Section: draftList[i].Content,
Title: draftList[i].Title,
Images: images,
}
}
return resp, nil
}
... ...
... ... @@ -233,7 +233,7 @@ func (l *MiniSetUserLikeLogic) setUserLikeArticle(req *types.MiniSetUserLikeRequ
CommentAuthor: 0,
UserId: req.UserId,
}
// 去除点赞标识
// 添加点赞标识
_, err = l.svcCtx.UserLoveFlagRepository.Insert(ctx, c, &flagInfo)
if err != nil {
return err
... ...
package article
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
"github.com/zeromicro/go-zero/core/logx"
)
type MiniUpdateArticleDraftLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMiniUpdateArticleDraftLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUpdateArticleDraftLogic {
return &MiniUpdateArticleDraftLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *MiniUpdateArticleDraftLogic) MiniUpdateArticleDraft(req *types.MiniArticleDraftUpdateRequest) (resp *types.MiniArticleDraftUpdateResponse, err error) {
var conn = l.svcCtx.DefaultDBConn()
draftInfo, err := l.svcCtx.ArticleDraftRepository.FindOne(l.ctx, conn, req.Id)
if err != nil {
return nil, xerr.NewErrMsgErr("更新草稿失败", err)
}
if draftInfo.AuthorId != req.AuthorId {
if err != nil {
return nil, xerr.NewErrMsg("更新草稿失败")
}
}
draftInfo.Content = req.Section
draftInfo.Title = req.Title
draftInfo.Location = domain.Location{
Longitude: req.Location.Longitude,
Latitude: req.Location.Latitude,
Descript: req.Location.Descript,
}
draftInfo.WhoRead = req.WhoRead
draftInfo.WhoReview = req.WhoReview
draftInfo.Images = []domain.Image{}
for _, val := range req.Images {
draftInfo.Images = append(draftInfo.Images, domain.Image{
Url: val,
})
}
_, err = l.svcCtx.ArticleDraftRepository.Update(l.ctx, conn, draftInfo)
if err != nil {
return nil, xerr.NewErrMsgErr("更新草稿失败", err)
}
resp = &types.MiniArticleDraftUpdateResponse{
Id: draftInfo.Id,
}
return
}
... ...
... ... @@ -9,21 +9,21 @@ import (
"github.com/zeromicro/go-zero/core/logx"
)
type MiniCommentLogic struct {
type MiniArticleCommentAtUserLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewMiniCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniCommentLogic {
return &MiniCommentLogic{
func NewMiniArticleCommentAtUserLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniArticleCommentAtUserLogic {
return &MiniArticleCommentAtUserLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *MiniCommentLogic) MiniComment(req *types.CommentRequest) (resp *types.CommentResposne, err error) {
func (l *MiniArticleCommentAtUserLogic) MiniArticleCommentAtUser(req *types.MiniArticleCommentAtUserRequest) (resp *types.MiniArticleCommentAtUserResponse, err error) {
// todo: add your logic here and delete this line
return
... ...
... ... @@ -9,21 +9,21 @@ import (
"github.com/zeromicro/go-zero/core/logx"
)
type SystemCommentLogic struct {
type MiniCreateArticleCommentLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewSystemCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemCommentLogic {
return &SystemCommentLogic{
func NewMiniCreateArticleCommentLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniCreateArticleCommentLogic {
return &MiniCreateArticleCommentLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *SystemCommentLogic) SystemComment(req *types.CommentRequest) (resp *types.CommentResposne, err error) {
func (l *MiniCreateArticleCommentLogic) MiniCreateArticleComment(req *types.MiniCreateArticleCommentRequest) (resp *types.MiniCreateArticleCommentResponse, err error) {
// todo: add your logic here and delete this line
return
... ...
package department
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type SystemAddLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewSystemAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemAddLogic {
return &SystemAddLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *SystemAddLogic) SystemAdd(req *types.DepartmentAddRequest) (resp *types.DepartmentGetResponse, err error) {
// todo: add your logic here and delete this line
return
}
... ...
package department
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type SystemGetLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewSystemGetLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemGetLogic {
return &SystemGetLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *SystemGetLogic) SystemGet(req *types.DepartmentGetRequest) (resp *types.DepartmentGetResponse, err error) {
// todo: add your logic here and delete this line
return
}
... ...
package department
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type SystemListLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewSystemListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemListLogic {
return &SystemListLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *SystemListLogic) SystemList(req *types.DepartmentListRequest) (resp *types.DepartmentListResponse, err error) {
// todo: add your logic here and delete this line
return
}
... ...
package department
import (
"context"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
"github.com/zeromicro/go-zero/core/logx"
)
type SystemUpdateLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewSystemUpdateLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemUpdateLogic {
return &SystemUpdateLogic{
Logger: logx.WithContext(ctx),
ctx: ctx,
svcCtx: svcCtx,
}
}
func (l *SystemUpdateLogic) SystemUpdate(req *types.DepartmentUpdateRequest) (resp *types.DepartmentGetResponse, err error) {
// todo: add your logic here and delete this line
return
}
... ...
// Code generated by goctl. DO NOT EDIT.
package types
type Location struct {
Longitude float64 `json:"longitude,optional"` //经度
Latitude float64 `json:"latitude,optional"` //纬度
Descript string `json:"descript,optional"` //地点描述
type MiniArticleCommentAtUserRequest struct {
ArtitceId int64 `json:"articleId"`
}
type Author struct {
type MiniArticleCommentAtUserResponse struct {
}
type CommentAuthor struct {
Id int64 `json:"id"` // 人员id
Name string `json:"name"` // 人员的名字
Avatar string `json:"avatar"` // 人员头像URL
Group string `json:"group"` // 人员的分组
Position string `json:"position"` // 职位
Company string `json:"company"` // 公司
}
type MiniArticleCreateRequest struct {
Title string `json:"title"` //标题
Section []string `json:"section"` //文章的文本内容
AuthorId int64 `json:"authorId,optional"` //发布人id
Images []string `json:"images,optional"` //图片
WhoRead []int64 `json:"whoRead,optional"` //谁可查看
WhoReview []int64 `json:"whoReview,optional"` //谁可评论
Location Location `json:"location,optional"` //定位坐标
}
type MiniArticleCreateResponse struct {
Id int64 `json:"id"`
}
type MiniArticleGetRequest struct {
Id int64 `path:"id"` //id
CompanyId int64 `path:",optional"`
}
type MiniArticleGetResponse struct {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题
AuthorId int64 `json:"authorId"` //发布人id
Author Author `json:"author"` //发布人
CreatedAt int64 `json:"createdAt"` //文章的发布时间
Section []ArticleSection `json:"section"` //文章的文本内容
Images []string `json:"images"` //图片
WhoRead []int64 `json:"whoRead"` //谁可查看
WhoReview []int64 `json:"whoReview"` //谁可评论
Location Location `json:"location"` //定位坐标
CountLove int `json:"countLove"` // 点赞数量
CountComment int `json:"countComment"` // 评论数量
CountRead int `json:"countRead"` // 浏览数量
Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
Edit int `json:"edit"` // 文章是否存在变更记录 (0 不存在 1存在)
}
type ArticleSection struct {
Id int64 `json:"id"` //段落id
Content string `json:"content"` // 文本内容
SortBy int `json:"sortBy"` // 排序
TotalComment int `json:"totalComment"` // 评论的数量
}
type MiniArticleSearchMeRequest struct {
AuthorId int64 `json:",optional"`
CompanyId int64 `json:",optional"`
Page int `json:"page"`
Size int `json:"size"`
}
type MiniArticleSearchMeResponse struct {
Total int `json:"total"`
List []ArticleSearchMe `json:"list"`
}
type ArticleSearchMe struct {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题
Images []string `json:"images"` //图片
CreatedAt int64 `json:"createdAt"` //文章的创建日期
CountLove int `json:"countLove"` //点赞数量
CountComment int `json:"CountComment"` //评论数量
Show int `json:"show"` //是否隐藏 [0显示、1不显示]
}
type MiniUserLikeArticleRequest struct {
ArticleId int64 `json:"articleId"` // 文章id
CompanyId int64 `json:",optional"` //公司id
Page int `json:"page"` //分页,第几页
Size int `json:"size"` //分页,每页几条
}
type MiniUserLikeArticleResponse struct {
Total int64 `json:"total"` //总数
List []WhichUserLikeArticle `json:"list"` //列表
}
type WhichUserLikeArticle struct {
ArticleId int64 `json:"articleId"` // 文章id
UserId int64 `json:"userId"` // 人员id
Name string `json:"name"` // 人员名称
Avatar string `json:"avatar"` // 人员头像
CreatedAt int64 `json:"createdAt"` // 点赞记录的时间
}
type MiniSetUserLikeRequset struct {
ArticleId int64 `json:"articleId"` //文章id
CommentId int64 `json:"commentId"` //评论id
UserId int64 `json:",optional"` //操作人
Flag int `json:"flag"` //点赞标志 1、点赞 2 、取消点赞
}
type MiniSetUserLikeResponse struct {
ArticleId int64 `json:"articleId"` //文章id
CommentId int64 `json:"commentId"` //评论id
Count int `json:"count"` //现有的点赞数量
}
type MiniArticleBackupSearchRequest struct {
Page int `json:"page"`
Size int `json:"size"`
ArticleId int `json:"articleId"`
CompanyId int64 `json:",optional"` // 服务端自动获取
}
type MiniArticleBackupSearchResponse struct {
Total int64 `json:"total"`
List []MiniArticleBackupItem `json:"list"`
}
type MiniArticleBackupItem struct {
Id int64 `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
Images []string `json:"images"`
CreatedAt int64 `json:"createdAt"`
Location Location `json:"location"`
}
type MiniArticleMarkUserReadRequest struct {
UserId int64 `json:",optional"` // 当前操作人
CompanyId int64 `json:",optional"` // 当前公司
ArticleId int64 `json:"articleId"` // 文章id
}
type MiniArticleMarkUserReadResponse struct {
Id int64 `json:"id"`
}
type MiniArticleDraftCreateRequest struct {
Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
Content []string `json:"content"` // 填写的内容
Title string `json:"title"` //标题
Images []string `json:"images"` //图片
}
type MiniArticleDraftCreateResponse struct {
}
type SystemArticleGetRequest struct {
Id int64 `path:"id"` //id
CompanyId int64 `path:",optional"`
}
type UserShowName struct {
Id int `json:"id"`
Name int `json:"name"`
}
type SystemArticleGetResponse struct {
Id int64 `json:"id"` // id
Title string `json:"title"` // 标题
AuthorId int64 `json:"authorId"` // 发布人id
Author Author `json:"author"` // 发布人
CreatedAt int64 `json:"createdAt"` // 文章的发布时间
Section []ArticleSection `json:"section"` // 文章的文本内容
Images []string `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可查看
WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看
WhoReview []int64 `json:"whoReview"` // 谁可评论
WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论
Location Location `json:"location"` // 定位坐标
CountLove int `json:"countLove"` // 点赞数量
CountComment int `json:"countComment"` // 评论数量
CountRead int `json:"countRead"` // 浏览数量
Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
}
type SystemArticleSearchRequest struct {
CompanyId int64 `json:",optional"`
Page int `json:"page"`
Size int `json:"size"`
}
type SystemArticleSearchResponse struct {
Total int `json:"total"`
List []SystemArticleSearch `json:"list"`
}
type SystemArticleSearch struct {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题
Author string `json:"author"` //发布人
Images []string `json:"images"` //图片
CreatedAt int64 `json:"createdAt"` //文章的创建日期
CountLove int `json:"countLove"` //点赞数量
CountComment int `json:"CountComment"` //评论数量
Show int `json:"show"` //是否隐藏 [0显示、1不显示]
Tags []string `json:"tags"` //标签
TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人]
}
type CommentRequest struct {
}
type CommentResposne struct {
List []Comment `json:"list"`
}
type Comment struct {
type MiniCreateArticleCommentRequest struct {
ArtitceId int64 `json:"articleId"` // 文章id
SectionId int64 `json:"sectionId"` // 段落id
FromUserId int64 `json:",optional"` // 填写文章的人,服务端自动获取
Pid int64 `json:"commnet"` // 回复那个评论的id
Content string `json:"content"` // 评论的内容
AtWho []int64 `json:"atWho"` // 填写评论时@的人
}
type MiniCreateArticleCommentResponse struct {
Id int64 `json:"id"`
Pid int64 `json:"pid"`
TopId int64 `json:"topId"`
ArtitceId int64 `json:"articleId"` // 文章id
SectionId int64 `json:"sectionId"` // 段落id
FromUserId int64 `json:"fromUserId"` // 填写评论的人
FromUser CommentAuthor `json:"fromUser"` // 填写评论的人
ToUserId int64 `json:"toUserId"` // 回复哪个人
ToUser CommentAuthor `json:"toUser"` // 回复哪个人
SectionContent string `json:"sectionContent"` // 引用的文章内容文本
CountReply int `json:"countReply"` // 回复数量
CountUserLove int `json:"countUserLove"` // 用户点赞数量
CountAdminLove int `json:"countAdminLove"` // 运营点赞数量
AtWho []CommentAuthor `json:"atWho"` // 填写评论时@的人
}
type MessageSystemRequest struct {
... ... @@ -646,6 +469,306 @@ type Company struct {
Logo string `json:"logo,omitempty"` // 公司LOGO
}
type Location struct {
Longitude float64 `json:"longitude,optional"` //经度
Latitude float64 `json:"latitude,optional"` //纬度
Descript string `json:"descript,optional"` //地点描述
}
type ArticleAuthor struct {
Id int64 `json:"id"` // 人员id
Name string `json:"name"` // 人员的名字
Avatar string `json:"avatar"` // 人员头像URL
Position string `json:"position"` // 职位
Company string `json:"company"` // 公司
}
type MiniArticleCreateRequest struct {
Title string `json:"title"` //标题
Section []string `json:"section"` //文章的文本内容
AuthorId int64 `json:"authorId,optional"` //发布人id
Images []string `json:"images,optional"` //图片
WhoRead []int64 `json:"whoRead,optional"` //谁可查看
WhoReview []int64 `json:"whoReview,optional"` //谁可评论
Location Location `json:"location,optional"` //定位坐标
}
type MiniArticleCreateResponse struct {
Id int64 `json:"id"`
}
type MiniArticleGetRequest struct {
Id int64 `path:"id"` //id
CompanyId int64 `path:",optional"` //当前公司
UserId int `path:",optional"` //当前用户
}
type MiniArticleGetResponse struct {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题
AuthorId int64 `json:"authorId"` //发布人id
Author ArticleAuthor `json:"author"` //发布人
CreatedAt int64 `json:"createdAt"` //文章的发布时间
Section []ArticleSection `json:"section"` //文章的文本内容
Images []string `json:"images"` //图片
WhoRead []int64 `json:"whoRead"` //谁可查看
WhoReview []int64 `json:"whoReview"` //谁可评论
Location Location `json:"location"` //定位坐标
CountLove int `json:"countLove"` // 点赞数量
CountComment int `json:"countComment"` // 评论数量
CountRead int `json:"countRead"` // 浏览数量
Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
Edit int `json:"edit"` // 文章是否存在变更记录 (0 不存在 1存在)
MeLoveFlag int `json:"meLoveFlag"` //当前人员对文章的点赞标识
}
type ArticleSection struct {
Id int64 `json:"id"` //段落id
Content string `json:"content"` // 文本内容
SortBy int `json:"sortBy"` // 排序
TotalComment int `json:"totalComment"` // 评论的数量
}
type MiniArticleSearchMeRequest struct {
AuthorId int64 `json:",optional"`
CompanyId int64 `json:",optional"`
Page int `json:"page"`
Size int `json:"size"`
}
type MiniArticleSearchMeResponse struct {
Total int `json:"total"`
List []ArticleSearchMe `json:"list"`
}
type ArticleSearchMe struct {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题
Images []string `json:"images"` //图片
CreatedAt int64 `json:"createdAt"` //文章的创建日期
CountLove int `json:"countLove"` //点赞数量
CountComment int `json:"CountComment"` //评论数量
Show int `json:"show"` //是否隐藏 [0显示、1不显示]
}
type MiniUserLikeArticleRequest struct {
ArticleId int64 `json:"articleId"` // 文章id
CompanyId int64 `json:",optional"` //公司id
Page int `json:"page"` //分页,第几页
Size int `json:"size"` //分页,每页几条
}
type MiniUserLikeArticleResponse struct {
Total int64 `json:"total"` //总数
List []WhichUserLikeArticle `json:"list"` //列表
}
type WhichUserLikeArticle struct {
ArticleId int64 `json:"articleId"` // 文章id
UserId int64 `json:"userId"` // 人员id
Name string `json:"name"` // 人员名称
Avatar string `json:"avatar"` // 人员头像
CreatedAt int64 `json:"createdAt"` // 点赞记录的时间
}
type MiniSetUserLikeRequset struct {
ArticleId int64 `json:"articleId"` //文章id
CommentId int64 `json:"commentId"` //评论id
UserId int64 `json:",optional"` //操作人
Flag int `json:"flag"` //点赞标志 1、点赞 2 、取消点赞
}
type MiniSetUserLikeResponse struct {
ArticleId int64 `json:"articleId"` //文章id
CommentId int64 `json:"commentId"` //评论id
Count int `json:"count"` //现有的点赞数量
}
type MiniArticleBackupSearchRequest struct {
Page int `json:"page"`
Size int `json:"size"`
ArticleId int `json:"articleId"`
CompanyId int64 `json:",optional"` // 服务端自动获取
}
type MiniArticleBackupSearchResponse struct {
Total int64 `json:"total"`
List []MiniArticleBackupItem `json:"list"`
}
type MiniArticleBackupItem struct {
Id int64 `json:"id"`
Title string `json:"title"`
Content string `json:"content"`
Images []string `json:"images"`
CreatedAt int64 `json:"createdAt"`
Location Location `json:"location"`
}
type MiniArticleMarkUserReadRequest struct {
UserId int64 `json:",optional"` // 当前操作人
CompanyId int64 `json:",optional"` // 当前公司
ArticleId int64 `json:"articleId"` // 文章id
}
type MiniArticleMarkUserReadResponse struct {
Id int64 `json:"id"`
}
type MiniArticleDraftCreateRequest struct {
CompanyId int64 `json:",optional"`
AuthorId int64 `json:",optional"` // 发布人
Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
Section []string `json:"section"` // 填写的内容
Title string `json:"title"` // 标题
Images []string `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
}
type MiniArticleDraftCreateResponse struct {
Id int64 `json:"id"`
}
type MiniArticleDraftUpdateRequest struct {
Id int64 `json:"id"`
CompanyId int64 `json:",optional"`
AuthorId int64 `json:",optional"` // 发布人
Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
Section []string `json:"section"` // 填写的内容
Title string `json:"title"` // 标题
Images []string `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
}
type MiniArticleDraftUpdateResponse struct {
Id int64 `json:"id"`
}
type MiniArticleDraftSearchMeRequest struct {
CompanyId int64 `json:",optional"` // 公司id
AuthorId int64 `json:",optional"` // 发布人
Page int `json:"page"`
Size int `json:"size"`
}
type MiniArticleDraftSearchMeResponse struct {
Total int64 `json:"total"`
List []MiniArticleDraftItem `json:"list"`
}
type MiniArticleDraftItem struct {
Id int64 `json:"id"`
Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
Section []string `json:"section"` // 填写的内容
Title string `json:"title"` // 标题
Images []string `json:"images"` // 图片
CreatedAt int64 `json:"createdAt"`
}
type MiniArticleDraftGetMeRequest struct {
CompanyId int64 `path:",optional"` // 公司id
AuthorId int64 `path:",optional"` // 发布人
Id int64 `path:"id"`
}
type MiniArticleDraftGetMeResponse struct {
Id int64 `json:"id"` //
Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
Section []string `json:"Section"` // 填写的内容
Title string `json:"title"` // 标题
Images []string `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
Location Location `json:"location"` // 坐标
}
type MiniArticleDraftDeleteMeRequest struct {
CompanyId int64 `path:",optional"` // 公司id
AuthorId int64 `path:",optional"` // 发布人
Id int64 `path:"id"`
}
type MiniArticleDraftDeleteMeResponse struct {
Id int64 `json:"id"` //
}
type MiniArticleMarkListRequest struct {
Page int `json:"page"`
Size int `json:"size"`
}
type MiniArticleMarkListResponse struct {
Total int64 `json:"total"`
List []MiniArticleMarkItem `json:"list"`
}
type MiniArticleMarkItem struct {
Id int64 `json:"id"`
CompanyId int64 `json:"companyId"`
UserId int64 `json:"userId"`
ArticleId int64 `json:"articleId"`
Title string `json:"title"`
Author SimpleUser `json:"author"` // 发布人
UpdatedAt int64 `json:"updatedAt"`
}
type SystemArticleGetRequest struct {
Id int64 `path:"id"` //id
CompanyId int64 `path:",optional"`
}
type UserShowName struct {
Id int `json:"id"`
Name int `json:"name"`
}
type SystemArticleGetResponse struct {
Id int64 `json:"id"` // id
Title string `json:"title"` // 标题
AuthorId int64 `json:"authorId"` // 发布人id
Author ArticleAuthor `json:"author"` // 发布人
CreatedAt int64 `json:"createdAt"` // 文章的发布时间
Section []ArticleSection `json:"section"` // 文章的文本内容
Images []string `json:"images"` // 图片
WhoRead []int64 `json:"whoRead"` // 谁可查看
WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看
WhoReview []int64 `json:"whoReview"` // 谁可评论
WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论
Location Location `json:"location"` // 定位坐标
CountLove int `json:"countLove"` // 点赞数量
CountComment int `json:"countComment"` // 评论数量
CountRead int `json:"countRead"` // 浏览数量
Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
}
type SystemArticleSearchRequest struct {
CompanyId int64 `json:",optional"`
Page int `json:"page"`
Size int `json:"size"`
}
type SystemArticleSearchResponse struct {
Total int `json:"total"`
List []SystemArticleSearch `json:"list"`
}
type SystemArticleSearch struct {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题
Author string `json:"author"` //发布人
Images []string `json:"images"` //图片
CreatedAt int64 `json:"createdAt"` //文章的创建日期
CountLove int `json:"countLove"` //点赞数量
CountComment int `json:"CountComment"` //评论数量
Show int `json:"show"` //是否隐藏 [0显示、1不显示]
Tags []string `json:"tags"` //标签
TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人]
}
type RoleGetRequest struct {
Id int64 `path:"id"`
}
... ... @@ -710,3 +833,31 @@ type Auth struct {
Name string `json:"name"` // 名称
Code string `json:"code"` // 编码
}
type DepartmentAddRequest struct {
Name string `json:"name"` // 分组名称
Ids []int64 `json:"ids"` // 用户ID
}
type DepartmentGetRequest struct {
Id int64 `path:"id"`
}
type DepartmentGetResponse struct {
Department Department `json:"department"`
}
type DepartmentUpdateRequest struct {
Id int64 `path:"id"`
Name string `json:"name"`
}
type DepartmentListRequest struct {
Page int `json:"page"`
Size int `json:"size"`
}
type DepartmentListResponse struct {
List []Department `json:"list"`
Total int64 `json:"total"`
}
... ...
... ... @@ -10,27 +10,28 @@ import (
)
type ArticleComment struct {
Id int64 `gorm:"primaryKey"` // 唯一标识
CompanyId int64
CreatedAt int64
UpdatedAt int64
IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"`
DeletedAt int64
Version int
Pid int64 // 对哪个评论进行回复
TopId int64 // 归属于最上级的哪个评论
ArticleId int64 // 文章id
ArticleSectionId int64 // 文本内容id
SectionContent string // 引用的文章内容文本
FromUserId int64 // 谁填写的评论
FromUser domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 谁填写的评论
ToUserId int64 // 回复谁的评论
ToUser domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 回复谁的评论
Content string // 评论内容
CountReply int // 回复数量
CountUserLove int // 用户点赞数量
CountAdminLove int // 运营点赞数量
Show int // 评论的展示状态(0显示、1不显示)
Id int64 `gorm:"primaryKey"` // 唯一标识
CompanyId int64
CreatedAt int64
UpdatedAt int64
IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"`
DeletedAt int64
Version int
Pid int64 // 对哪个评论进行回复
TopId int64 // 归属于最上级的哪个评论
ArticleId int64 // 文章id
SectionId int64 // 文本内容id
SectionContent string // 引用的文章内容文本
FromUserId int64 // 谁填写的评论
FromUser domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 谁填写的评论
ToUserId int64 // 回复谁的评论
ToUser domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 回复谁的评论
AtWho []domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 填写评论@的人
Content string // 评论内容
CountReply int // 回复数量
CountUserLove int // 用户点赞数量
CountAdminLove int // 运营点赞数量
Show int // 评论的展示状态(0显示、1不显示)
}
func (m *ArticleComment) TableName() string {
... ...
... ... @@ -2,6 +2,7 @@ package models
import (
"fmt"
"time"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gorm.io/gorm"
... ... @@ -31,13 +32,14 @@ func (m *ArticleDraft) TableName() string {
}
func (m *ArticleDraft) BeforeCreate(tx *gorm.DB) (err error) {
// m.CreatedAt = time.Now().Unix()
// m.UpdatedAt = time.Now().Unix()
nowTime := time.Now().Unix()
m.CreatedAt = nowTime
m.UpdatedAt = nowTime
return
}
func (m *ArticleDraft) BeforeUpdate(tx *gorm.DB) (err error) {
// m.UpdatedAt = time.Now().Unix()
m.UpdatedAt = time.Now().Unix()
return
}
... ...
... ... @@ -5,14 +5,14 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gorm.io/gorm"
"gorm.io/plugin/soft_delete"
"time"
)
type Department struct {
Id int64 // 唯一标识
CompanyId int64 `json:"companyId,omitempty"` // 公司ID
ParentId int64 `json:"parentId,omitempty"` // 父级ID
Name string `json:"name,omitempty"` // 部门名称
Id int64 // 唯一标识
CompanyId int64 `json:"companyId,omitempty"` // 公司ID
ParentId int64 `json:"parentId,omitempty"` // 父级ID
Name string `json:"name,omitempty"` // 部门名称
CreatedAt int64 `json:"createdAt,omitempty"`
UpdatedAt int64 `json:"updatedAt,omitempty"`
DeletedAt int64 `json:"deletedAt,omitempty"`
... ... @@ -25,13 +25,13 @@ func (m *Department) TableName() string {
}
func (m *Department) BeforeCreate(tx *gorm.DB) (err error) {
// m.CreatedAt = time.Now().Unix()
// m.UpdatedAt = time.Now().Unix()
m.CreatedAt = time.Now().Unix()
m.UpdatedAt = time.Now().Unix()
return
}
func (m *Department) BeforeUpdate(tx *gorm.DB) (err error) {
// m.UpdatedAt = time.Now().Unix()
m.UpdatedAt = time.Now().Unix()
return
}
... ...
... ... @@ -6,6 +6,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gorm.io/gorm"
"gorm.io/plugin/soft_delete"
)
type UserReadArticle struct {
... ... @@ -13,6 +14,7 @@ type UserReadArticle struct {
CreatedAt int64
UpdatedAt int64
DeletedAt int64
IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"`
Version int
CompanyId int64
UserId int64
... ...
... ... @@ -142,26 +142,26 @@ func (repository *ArticleCommentRepository) Find(ctx context.Context, conn trans
func (repository *ArticleCommentRepository) ModelToDomainModel(from *models.ArticleComment) (*domain.ArticleComment, error) {
to := &domain.ArticleComment{
Id: from.Id,
CompanyId: from.CompanyId,
CreatedAt: from.CreatedAt,
UpdatedAt: from.UpdatedAt,
DeletedAt: from.DeletedAt,
Version: from.Version,
Pid: from.Pid,
TopId: from.TopId,
ArticleId: from.ArticleId,
ArticleSectionId: from.ArticleSectionId,
SectionContent: from.SectionContent,
FromUserId: from.FromUserId,
FromUser: from.FromUser,
ToUserId: from.ToUser.Id,
ToUser: from.ToUser,
Content: from.Content,
CountReply: from.CountReply,
CountUserLove: from.CountUserLove,
CountAdminLove: from.CountAdminLove,
Show: domain.CommentShow(from.Show),
Id: from.Id,
CompanyId: from.CompanyId,
CreatedAt: from.CreatedAt,
UpdatedAt: from.UpdatedAt,
DeletedAt: from.DeletedAt,
Version: from.Version,
Pid: from.Pid,
TopId: from.TopId,
ArticleId: from.ArticleId,
SectionId: from.SectionId,
SectionContent: from.SectionContent,
FromUserId: from.FromUserId,
FromUser: from.FromUser,
ToUserId: from.ToUser.Id,
ToUser: from.ToUser,
Content: from.Content,
CountReply: from.CountReply,
CountUserLove: from.CountUserLove,
CountAdminLove: from.CountAdminLove,
Show: domain.CommentShow(from.Show),
}
// err := copier.Copy(to, from)
return to, nil
... ... @@ -169,26 +169,26 @@ func (repository *ArticleCommentRepository) ModelToDomainModel(from *models.Arti
func (repository *ArticleCommentRepository) DomainModelToModel(from *domain.ArticleComment) (*models.ArticleComment, error) {
to := &models.ArticleComment{
Id: from.Id,
CompanyId: from.CompanyId,
CreatedAt: from.CreatedAt,
UpdatedAt: from.UpdatedAt,
DeletedAt: from.DeletedAt,
Version: from.Version,
Pid: from.Pid,
TopId: from.TopId,
ArticleId: from.ArticleId,
ArticleSectionId: from.ArticleSectionId,
SectionContent: from.SectionContent,
FromUserId: from.FromUserId,
FromUser: from.FromUser,
ToUserId: from.ToUser.Id,
ToUser: from.ToUser,
Content: from.Content,
CountReply: from.CountReply,
CountUserLove: from.CountUserLove,
CountAdminLove: from.CountAdminLove,
Show: int(from.Show),
Id: from.Id,
CompanyId: from.CompanyId,
CreatedAt: from.CreatedAt,
UpdatedAt: from.UpdatedAt,
DeletedAt: from.DeletedAt,
Version: from.Version,
Pid: from.Pid,
TopId: from.TopId,
ArticleId: from.ArticleId,
SectionId: from.SectionId,
SectionContent: from.SectionContent,
FromUserId: from.FromUserId,
FromUser: from.FromUser,
ToUserId: from.ToUser.Id,
ToUser: from.ToUser,
Content: from.Content,
CountReply: from.CountReply,
CountUserLove: from.CountUserLove,
CountAdminLove: from.CountAdminLove,
Show: int(from.Show),
}
// err := copier.Copy(to, from)
return to, nil
... ...
... ... @@ -8,26 +8,27 @@ import (
// 文章评论
type ArticleComment struct {
Id int64 `json:"id"` // 评论id
CompanyId int64 `json:"companyId"`
CreatedAt int64 `json:"createdAt,omitempty"`
UpdatedAt int64 `json:"updatedAt,omitempty"`
DeletedAt int64 `json:"deletedAt,omitempty"`
Version int `json:"version,omitempty"`
Pid int64 `json:"pid"` // 对哪个评论进行回复
TopId int64 `json:"topId"` // 归属于最上级的哪个评论
ArticleId int64 `json:"articleId"` // 文章id
ArticleSectionId int64 `json:"articleSectionId"` // 文本内容id
SectionContent string `json:"sectionContent"` // 引用的文章内容文本
FromUserId int64 `json:"fromUserId"` // 谁填写的评论
FromUser UserSimple `json:"fromUser"` // 谁填写的评论
ToUserId int64 `json:"toUserId"` // 回复谁的评论
ToUser UserSimple `json:"toUser"` // 回复谁的评论
Content string `json:"content"` // 评论内容
CountReply int `json:"countReply"` // 回复数量
CountUserLove int `json:"countUserLove"` // 用户点赞数量
CountAdminLove int `json:"countAdminLove"` // 运营点赞数量
Show CommentShow `json:"showState"` // 评论的展示状态(0显示、1不显示)
Id int64 `json:"id"` // 评论id
CompanyId int64 `json:"companyId"`
CreatedAt int64 `json:"createdAt,omitempty"`
UpdatedAt int64 `json:"updatedAt,omitempty"`
DeletedAt int64 `json:"deletedAt,omitempty"`
Version int `json:"version,omitempty"`
Pid int64 `json:"pid"` // 对哪个评论进行回复
TopId int64 `json:"topId"` // 归属于最上级的哪个评论
ArticleId int64 `json:"articleId"` // 文章id
SectionId int64 `json:"sectionId"` // 文本段落内容id
SectionContent string `json:"sectionContent"` // 引用的文章内容文本
FromUserId int64 `json:"fromUserId"` // 谁填写的评论
FromUser UserSimple `json:"fromUser"` // 谁填写的评论
ToUserId int64 `json:"toUserId"` // 回复谁的评论
ToUser UserSimple `json:"toUser"` // 回复谁的评论
Content string `json:"content"` // 评论内容
CountReply int `json:"countReply"` // 回复数量
CountUserLove int `json:"countUserLove"` // 用户点赞数量
CountAdminLove int `json:"countAdminLove"` // 运营点赞数量
Show CommentShow `json:"showState"` // 评论的展示状态(0显示、1不显示)
AtWho []UserSimple `json:"atWho"` // 填写评论时@的人
// ...more
}
... ...
... ... @@ -29,11 +29,11 @@ type Opinion struct {
}
type UserSimple struct {
Id int64 `json:"id"` // 人员id
Name string `json:"name"` // 人员的名字
Avatar string `json:"avatar,omitempty"` // 人员头像URL
GroupId int64 `json:"groupId,omitempty"`
Group string `json:"group,omitempty"` // 人员的分组
Id int64 `json:"id"` // 人员id
Name string `json:"name"` // 人员的名字
Avatar string `json:"avatar,omitempty"` // 人员头像URL
// GroupId int64 `json:"groupId"` //分组id
//Group string `json:"group,omitempty"` // 人员的分组
Position string `json:"position,omitempty"` // 职位
Company string `json:"company,omitempty"` // 公司
CompanyId int64 `json:"companyId"`
... ...