正在显示
9 个修改的文件
包含
275 行增加
和
43 行删除
| @@ -2,4 +2,5 @@ import "core/comment.api" | @@ -2,4 +2,5 @@ import "core/comment.api" | ||
| 2 | import "core/message.api" | 2 | import "core/message.api" |
| 3 | import "core/article_tag.api" | 3 | import "core/article_tag.api" |
| 4 | import "core/user.api" | 4 | import "core/user.api" |
| 5 | -import "core/company.api" | ||
| 5 | +import "core/company.api" | ||
| 6 | +import "core/article.api" |
| @@ -10,9 +10,9 @@ info( | @@ -10,9 +10,9 @@ info( | ||
| 10 | 10 | ||
| 11 | // 坐标地点描述 | 11 | // 坐标地点描述 |
| 12 | type Location { | 12 | type Location { |
| 13 | - Longitude float64 `json:"longitude"` //经度 | ||
| 14 | - Latitude float64 `json:"latitude"` //纬度 | ||
| 15 | - Descript string `json:"descript"` //地点描述 | 13 | + Longitude float64 `json:"longitude,optional"` //经度 |
| 14 | + Latitude float64 `json:"latitude,optional"` //纬度 | ||
| 15 | + Descript string `json:"descript,optional"` //地点描述 | ||
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | // 人员的简单展示信息 | 18 | // 人员的简单展示信息 |
| @@ -24,36 +24,36 @@ type Author { | @@ -24,36 +24,36 @@ type Author { | ||
| 24 | Position string `json:"position"` // 职位 | 24 | Position string `json:"position"` // 职位 |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | -// 创建发布文章 | 27 | +//小程序端创建发布文章 |
| 28 | type ( | 28 | type ( |
| 29 | - ArticleCreateRequest { | ||
| 30 | - Title string `json:"title"` //标题 | ||
| 31 | - Section []string `json:"section"` //文章的文本内容 | ||
| 32 | - AuthorId int `json:"authorId"` //发布人id | ||
| 33 | - Images []string `json:"images"` //图片 | ||
| 34 | - WhoRead []int `json:"whoRead"` //谁可查看 | ||
| 35 | - WhoReview []int `json:"whoReview"` //谁可评论 | ||
| 36 | - Location Location `json:"location"` //定位坐标 | 29 | + MiniArticleCreateRequest { |
| 30 | + Title string `json:"title"` //标题 | ||
| 31 | + Section []string `json:"section"` //文章的文本内容 | ||
| 32 | + AuthorId int64 `json:"authorId,optional"` //发布人id | ||
| 33 | + Images []string `json:"images,optional"` //图片 | ||
| 34 | + WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | ||
| 35 | + WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | ||
| 36 | + Location Location `json:"location,optional"` //定位坐标 | ||
| 37 | } | 37 | } |
| 38 | - ArticleCreateResponse { | 38 | + MiniArticleCreateResponse { |
| 39 | Id int64 `json:"id"` | 39 | Id int64 `json:"id"` |
| 40 | } | 40 | } |
| 41 | ) | 41 | ) |
| 42 | 42 | ||
| 43 | -// 查看文章的详情 | 43 | +//小程序端查看文章的详情 |
| 44 | type ( | 44 | type ( |
| 45 | - ArticleGetRequest { | ||
| 46 | - Id int64 `json:"id"` //id | 45 | + MiniArticleGetRequest { |
| 46 | + Id int64 `path:"id"` //id | ||
| 47 | } | 47 | } |
| 48 | - ArticleGetResponse { | 48 | + MiniArticleGetResponse { |
| 49 | Title string `json:"title"` //标题 | 49 | Title string `json:"title"` //标题 |
| 50 | AuthorId int `json:"authorId"` //发布人id | 50 | AuthorId int `json:"authorId"` //发布人id |
| 51 | Author Author `json:"author"` //发布人 | 51 | Author Author `json:"author"` //发布人 |
| 52 | CreatedAt int64 `json:"createdAt"` //文章的发布时间 | 52 | CreatedAt int64 `json:"createdAt"` //文章的发布时间 |
| 53 | Section []string `json:"section"` //文章的文本内容 | 53 | Section []string `json:"section"` //文章的文本内容 |
| 54 | Images []string `json:"images"` //图片 | 54 | Images []string `json:"images"` //图片 |
| 55 | - WhoRead []int `json:"whoRead"` //谁可查看 | ||
| 56 | - WhoReview []int `json:"whoReview"` //谁可评论 | 55 | + WhoRead []int64 `json:"whoRead"` //谁可查看 |
| 56 | + WhoReview []int64 `json:"whoReview"` //谁可评论 | ||
| 57 | Location Location `json:"location"` //定位坐标 | 57 | Location Location `json:"location"` //定位坐标 |
| 58 | CountLove int `json:"countLove"` // 点赞数量 | 58 | CountLove int `json:"countLove"` // 点赞数量 |
| 59 | CountComment int `json:"countComment"` // 评论数量 | 59 | CountComment int `json:"countComment"` // 评论数量 |
| @@ -69,9 +69,9 @@ type ( | @@ -69,9 +69,9 @@ type ( | ||
| 69 | ) | 69 | ) |
| 70 | service Core { | 70 | service Core { |
| 71 | @doc "小程序创建发布内容" | 71 | @doc "小程序创建发布内容" |
| 72 | - @handler CreateArticle | ||
| 73 | - post /article (ArticleCreateRequest) returns (ArticleCreateResponse) | 72 | + @handler MiniCreateArticle |
| 73 | + post /article (MiniArticleCreateRequest) returns (MiniArticleCreateResponse) | ||
| 74 | @doc "小程序获取文章内容详情" | 74 | @doc "小程序获取文章内容详情" |
| 75 | - @handler GetArticle | ||
| 76 | - get /article/:id (ArticleGetRequest) returns (ArticleGetResponse) | 75 | + @handler MiniGetArticle |
| 76 | + get /article/:id (MiniArticleGetRequest) returns (MiniArticleGetResponse) | ||
| 77 | } | 77 | } |
| 1 | +package article | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "net/http" | ||
| 5 | + | ||
| 6 | + "github.com/zeromicro/go-zero/rest/httpx" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
| 10 | +) | ||
| 11 | + | ||
| 12 | +func MiniCreateArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 13 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 14 | + var req types.MiniArticleCreateRequest | ||
| 15 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 16 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 17 | + return | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + l := article.NewMiniCreateArticleLogic(r.Context(), svcCtx) | ||
| 21 | + resp, err := l.MiniCreateArticle(&req) | ||
| 22 | + if err != nil { | ||
| 23 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 24 | + } else { | ||
| 25 | + httpx.OkJsonCtx(r.Context(), w, resp) | ||
| 26 | + } | ||
| 27 | + } | ||
| 28 | +} |
| 1 | +package article | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "net/http" | ||
| 5 | + | ||
| 6 | + "github.com/zeromicro/go-zero/rest/httpx" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
| 10 | +) | ||
| 11 | + | ||
| 12 | +func MiniGetArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 13 | + return func(w http.ResponseWriter, r *http.Request) { | ||
| 14 | + var req types.MiniArticleGetRequest | ||
| 15 | + if err := httpx.Parse(r, &req); err != nil { | ||
| 16 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 17 | + return | ||
| 18 | + } | ||
| 19 | + | ||
| 20 | + l := article.NewMiniGetArticleLogic(r.Context(), svcCtx) | ||
| 21 | + resp, err := l.MiniGetArticle(&req) | ||
| 22 | + if err != nil { | ||
| 23 | + httpx.ErrorCtx(r.Context(), w, err) | ||
| 24 | + } else { | ||
| 25 | + httpx.OkJsonCtx(r.Context(), w, resp) | ||
| 26 | + } | ||
| 27 | + } | ||
| 28 | +} |
| @@ -4,6 +4,7 @@ package handler | @@ -4,6 +4,7 @@ package handler | ||
| 4 | import ( | 4 | import ( |
| 5 | "net/http" | 5 | "net/http" |
| 6 | 6 | ||
| 7 | + article "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/article" | ||
| 7 | comment "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/comment" | 8 | comment "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/comment" |
| 8 | company "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/company" | 9 | company "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/company" |
| 9 | message "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/message" | 10 | message "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/message" |
| @@ -18,7 +19,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -18,7 +19,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
| 18 | server.AddRoutes( | 19 | server.AddRoutes( |
| 19 | []rest.Route{ | 20 | []rest.Route{ |
| 20 | { | 21 | { |
| 21 | - Method: http.MethodGet, | 22 | + Method: http.MethodGet, |
| 22 | Path: "/mini/comment", | 23 | Path: "/mini/comment", |
| 23 | Handler: comment.MiniCommentHandler(serverCtx), | 24 | Handler: comment.MiniCommentHandler(serverCtx), |
| 24 | }, | 25 | }, |
| @@ -75,7 +76,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -75,7 +76,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
| 75 | }, | 76 | }, |
| 76 | { | 77 | { |
| 77 | Method: http.MethodDelete, | 78 | Method: http.MethodDelete, |
| 78 | - Path: "/article_tag", | 79 | + Path: "/article_tag/:id", |
| 79 | Handler: tags.DeleteTagHandler(serverCtx), | 80 | Handler: tags.DeleteTagHandler(serverCtx), |
| 80 | }, | 81 | }, |
| 81 | { | 82 | { |
| @@ -85,7 +86,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -85,7 +86,7 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
| 85 | }, | 86 | }, |
| 86 | }, | 87 | }, |
| 87 | rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret), | 88 | rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret), |
| 88 | - rest.WithPrefix("/v1/mini"), | 89 | + rest.WithPrefix("/v1/system"), |
| 89 | ) | 90 | ) |
| 90 | 91 | ||
| 91 | server.AddRoutes( | 92 | server.AddRoutes( |
| @@ -173,4 +174,21 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -173,4 +174,21 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
| 173 | rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret), | 174 | rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret), |
| 174 | rest.WithPrefix("/v1"), | 175 | rest.WithPrefix("/v1"), |
| 175 | ) | 176 | ) |
| 177 | + | ||
| 178 | + server.AddRoutes( | ||
| 179 | + []rest.Route{ | ||
| 180 | + { | ||
| 181 | + Method: http.MethodPost, | ||
| 182 | + Path: "/article", | ||
| 183 | + Handler: article.MiniCreateArticleHandler(serverCtx), | ||
| 184 | + }, | ||
| 185 | + { | ||
| 186 | + Method: http.MethodGet, | ||
| 187 | + Path: "/article/:id", | ||
| 188 | + Handler: article.MiniGetArticleHandler(serverCtx), | ||
| 189 | + }, | ||
| 190 | + }, | ||
| 191 | + rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret), | ||
| 192 | + rest.WithPrefix("/v1/mini"), | ||
| 193 | + ) | ||
| 176 | } | 194 | } |
| 1 | +package article | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
| 8 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" | ||
| 9 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr" | ||
| 10 | + | ||
| 11 | + "github.com/samber/lo" | ||
| 12 | + "github.com/zeromicro/go-zero/core/logx" | ||
| 13 | +) | ||
| 14 | + | ||
| 15 | +type MiniCreateArticleLogic struct { | ||
| 16 | + logx.Logger | ||
| 17 | + ctx context.Context | ||
| 18 | + svcCtx *svc.ServiceContext | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +func NewMiniCreateArticleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniCreateArticleLogic { | ||
| 22 | + return &MiniCreateArticleLogic{ | ||
| 23 | + Logger: logx.WithContext(ctx), | ||
| 24 | + ctx: ctx, | ||
| 25 | + svcCtx: svcCtx, | ||
| 26 | + } | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +func (l *MiniCreateArticleLogic) MiniCreateArticle(req *types.MiniArticleCreateRequest) (resp *types.MiniArticleCreateResponse, err error) { | ||
| 30 | + var conn = l.svcCtx.DefaultDBConn() | ||
| 31 | + // 检查发布人 | ||
| 32 | + author, err := l.svcCtx.UserRepository.FindOne(l.ctx, conn, int64(req.AuthorId)) | ||
| 33 | + if err != nil { | ||
| 34 | + return nil, xerr.NewErrMsgErr("创建文章内容失败", err) | ||
| 35 | + } | ||
| 36 | + //TODO 获取图片的尺寸大小 | ||
| 37 | + images := []domain.Image{} | ||
| 38 | + for _, val := range req.Images { | ||
| 39 | + images = append(images, domain.Image{ | ||
| 40 | + Url: val, | ||
| 41 | + Width: 0, | ||
| 42 | + Height: 0, | ||
| 43 | + }) | ||
| 44 | + } | ||
| 45 | + //检查文章可被哪些人查看 | ||
| 46 | + whoRead := []int64{} | ||
| 47 | + if len(req.WhoRead) > 0 { | ||
| 48 | + whoRead = lo.Uniq(req.WhoRead) | ||
| 49 | + var u *domain.User | ||
| 50 | + for _, val := range whoRead { | ||
| 51 | + u, err = l.svcCtx.UserRepository.FindOne(l.ctx, conn, val) | ||
| 52 | + if err != nil { | ||
| 53 | + return nil, xerr.NewErrMsgErr("文章可查看人设置错误", err) | ||
| 54 | + } | ||
| 55 | + if u.CompanyId != author.CompanyId { | ||
| 56 | + return nil, xerr.NewErrMsg("文章可查看人设置错误") | ||
| 57 | + } | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + //检查文章可被哪些人评论 | ||
| 61 | + whoReview := []int64{} | ||
| 62 | + if len(req.WhoReview) > 0 && len(whoRead) > 0 { | ||
| 63 | + whoReview = lo.Uniq(req.WhoReview) | ||
| 64 | + // 检查 whoRead 是否 完全包含 whoReview | ||
| 65 | + ok := lo.Every(whoRead, whoReview) | ||
| 66 | + if !ok { | ||
| 67 | + return nil, xerr.NewErrMsg("文章可评论人设置错误") | ||
| 68 | + } | ||
| 69 | + } | ||
| 70 | + if len(whoRead) > 0 && len(whoReview) == 0 { | ||
| 71 | + //有指定可查看人 ,但未指定可评论人 | ||
| 72 | + return nil, xerr.NewErrMsg("文章可评论人设置错误") | ||
| 73 | + } | ||
| 74 | + // if len(whoRead) == 0 && len(whoReview) > 0 { | ||
| 75 | + // 未指定可查看人(全员可看),有指定可评论人 ,忽略判断 | ||
| 76 | + // } | ||
| 77 | + // if len(whoRead) == 0 && len(whoReview) == 0 { | ||
| 78 | + // 未指定可查看人(全员可看),未指定可评论人 ,忽略判断 | ||
| 79 | + // } | ||
| 80 | + | ||
| 81 | + return | ||
| 82 | +} |
| 1 | +package article | ||
| 2 | + | ||
| 3 | +import ( | ||
| 4 | + "context" | ||
| 5 | + | ||
| 6 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" | ||
| 7 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" | ||
| 8 | + | ||
| 9 | + "github.com/zeromicro/go-zero/core/logx" | ||
| 10 | +) | ||
| 11 | + | ||
| 12 | +type MiniGetArticleLogic struct { | ||
| 13 | + logx.Logger | ||
| 14 | + ctx context.Context | ||
| 15 | + svcCtx *svc.ServiceContext | ||
| 16 | +} | ||
| 17 | + | ||
| 18 | +func NewMiniGetArticleLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniGetArticleLogic { | ||
| 19 | + return &MiniGetArticleLogic{ | ||
| 20 | + Logger: logx.WithContext(ctx), | ||
| 21 | + ctx: ctx, | ||
| 22 | + svcCtx: svcCtx, | ||
| 23 | + } | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +func (l *MiniGetArticleLogic) MiniGetArticle(req *types.MiniArticleGetRequest) (resp *types.MiniArticleGetResponse, err error) { | ||
| 27 | + // todo: add your logic here and delete this line | ||
| 28 | + | ||
| 29 | + return | ||
| 30 | +} |
| @@ -67,8 +67,8 @@ type User struct { | @@ -67,8 +67,8 @@ type User struct { | ||
| 67 | type TagCreateRequest struct { | 67 | type TagCreateRequest struct { |
| 68 | CompanyId int64 `json:"companyId"` | 68 | CompanyId int64 `json:"companyId"` |
| 69 | Image string `json:"image"` | 69 | Image string `json:"image"` |
| 70 | - Name string `json:"name"` // 标签名称 | ||
| 71 | - Group string `json:"group"` // 标签分类 | 70 | + Name string `json:"name"` // 标签名称 |
| 71 | + Group string `json:"group"` // 标签分类 | ||
| 72 | Remark string `json:"remark,optional"` // 备注 | 72 | Remark string `json:"remark,optional"` // 备注 |
| 73 | } | 73 | } |
| 74 | 74 | ||
| @@ -80,8 +80,8 @@ type TagEditRequest struct { | @@ -80,8 +80,8 @@ type TagEditRequest struct { | ||
| 80 | Id int64 `json:"id"` | 80 | Id int64 `json:"id"` |
| 81 | CompanyId int64 `json:"-"` | 81 | CompanyId int64 `json:"-"` |
| 82 | Image string `json:"image"` | 82 | Image string `json:"image"` |
| 83 | - Name string `json:"name"` // 标签名称 | ||
| 84 | - Group string `json:"group"` // 标签分类 | 83 | + Name string `json:"name"` // 标签名称 |
| 84 | + Group string `json:"group"` // 标签分类 | ||
| 85 | Remark string `json:"remark,optional"` // 备注 | 85 | Remark string `json:"remark,optional"` // 备注 |
| 86 | } | 86 | } |
| 87 | 87 | ||
| @@ -90,7 +90,7 @@ type TagEditResponse struct { | @@ -90,7 +90,7 @@ type TagEditResponse struct { | ||
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | type TagGetRequest struct { | 92 | type TagGetRequest struct { |
| 93 | - Id int64 `path:"id"` | 93 | + Id int64 `path:"id"` |
| 94 | CompanyId int64 `path:"-"` | 94 | CompanyId int64 `path:"-"` |
| 95 | } | 95 | } |
| 96 | 96 | ||
| @@ -103,16 +103,16 @@ type TagGetResponse struct { | @@ -103,16 +103,16 @@ type TagGetResponse struct { | ||
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | type TagListRequest struct { | 105 | type TagListRequest struct { |
| 106 | - Page int `json:"page"` | ||
| 107 | - Size int `json:"size"` | ||
| 108 | - CompanyId int64 `json:"-"` | ||
| 109 | - TagName string `json:"tagName,optional"` | ||
| 110 | - Group string `json:"group,optional"` | ||
| 111 | - Remark string `json:"remark,optional"` | 106 | + Page int `json:"page"` |
| 107 | + Size int `json:"size"` | ||
| 108 | + CompanyId int64 `json:"-"` | ||
| 109 | + TagName string `json:"tagName,optional"` | ||
| 110 | + Group string `json:"group,optional"` | ||
| 111 | + Remark string `json:"remark,optional"` | ||
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | type TagListResponse struct { | 114 | type TagListResponse struct { |
| 115 | - Total int64 `json:"total"` | 115 | + Total int64 `json:"total"` |
| 116 | List []TagItem `json:"list"` | 116 | List []TagItem `json:"list"` |
| 117 | } | 117 | } |
| 118 | 118 | ||
| @@ -126,7 +126,7 @@ type TagItem struct { | @@ -126,7 +126,7 @@ type TagItem struct { | ||
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | type TagDeleteRequest struct { | 128 | type TagDeleteRequest struct { |
| 129 | - Id int64 `path:"id"` | 129 | + Id int64 `path:"id"` |
| 130 | CompanyId int64 `path:"-"` | 130 | CompanyId int64 `path:"-"` |
| 131 | } | 131 | } |
| 132 | 132 | ||
| @@ -134,8 +134,6 @@ type TagDeleteResponse struct { | @@ -134,8 +134,6 @@ type TagDeleteResponse struct { | ||
| 134 | Id int64 `json:"id"` | 134 | Id int64 `json:"id"` |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | - | ||
| 138 | - | ||
| 139 | type MiniUserLoginRequest struct { | 137 | type MiniUserLoginRequest struct { |
| 140 | LoginType string `json:"loginType"` // 登录类型 wechat-login whchat-phone-login phone-password-login phone-smscode-login | 138 | LoginType string `json:"loginType"` // 登录类型 wechat-login whchat-phone-login phone-password-login phone-smscode-login |
| 141 | WechatAuthCode string `json:"wechatAuthcode,optional"` // 微信登录 授权码 | 139 | WechatAuthCode string `json:"wechatAuthcode,optional"` // 微信登录 授权码 |
| @@ -240,3 +238,50 @@ type Company struct { | @@ -240,3 +238,50 @@ type Company struct { | ||
| 240 | Code string `json:"code,omitempty"` // 编码(搜索使用,4位字母数字) | 238 | Code string `json:"code,omitempty"` // 编码(搜索使用,4位字母数字) |
| 241 | Logo string `json:"logo,omitempty"` // 公司LOGO | 239 | Logo string `json:"logo,omitempty"` // 公司LOGO |
| 242 | } | 240 | } |
| 241 | + | ||
| 242 | +type Location struct { | ||
| 243 | + Longitude float64 `json:"longitude,optional"` //经度 | ||
| 244 | + Latitude float64 `json:"latitude,optional"` //纬度 | ||
| 245 | + Descript string `json:"descript,optional"` //地点描述 | ||
| 246 | +} | ||
| 247 | + | ||
| 248 | +type Author struct { | ||
| 249 | + Id int64 `json:"id"` // 人员id | ||
| 250 | + Name string `json:"name"` // 人员的名字 | ||
| 251 | + Avatar string `json:"avatar"` // 人员头像URL | ||
| 252 | + Group string `json:"group"` // 人员的分组 | ||
| 253 | + Position string `json:"position"` // 职位 | ||
| 254 | +} | ||
| 255 | + | ||
| 256 | +type MiniArticleCreateRequest struct { | ||
| 257 | + Title string `json:"title"` //标题 | ||
| 258 | + Section []string `json:"section"` //文章的文本内容 | ||
| 259 | + AuthorId int `json:"authorId,optional"` //发布人id | ||
| 260 | + Images []string `json:"images,optional"` //图片 | ||
| 261 | + WhoRead []int64 `json:"whoRead,optional"` //谁可查看 | ||
| 262 | + WhoReview []int64 `json:"whoReview,optional"` //谁可评论 | ||
| 263 | + Location Location `json:"location,optional"` //定位坐标 | ||
| 264 | +} | ||
| 265 | + | ||
| 266 | +type MiniArticleCreateResponse struct { | ||
| 267 | + Id int64 `json:"id"` | ||
| 268 | +} | ||
| 269 | + | ||
| 270 | +type MiniArticleGetRequest struct { | ||
| 271 | + Id int64 `path:"id"` //id | ||
| 272 | +} | ||
| 273 | + | ||
| 274 | +type MiniArticleGetResponse struct { | ||
| 275 | + Title string `json:"title"` //标题 | ||
| 276 | + AuthorId int `json:"authorId"` //发布人id | ||
| 277 | + Author Author `json:"author"` //发布人 | ||
| 278 | + CreatedAt int64 `json:"createdAt"` //文章的发布时间 | ||
| 279 | + Section []string `json:"section"` //文章的文本内容 | ||
| 280 | + Images []string `json:"images"` //图片 | ||
| 281 | + WhoRead []int64 `json:"whoRead"` //谁可查看 | ||
| 282 | + WhoReview []int64 `json:"whoReview"` //谁可评论 | ||
| 283 | + Location Location `json:"location"` //定位坐标 | ||
| 284 | + CountLove int `json:"countLove"` // 点赞数量 | ||
| 285 | + CountComment int `json:"countComment"` // 评论数量 | ||
| 286 | + Show int `json:"showState"` // 评论的展示状态(0显示、1不显示) | ||
| 287 | +} |
-
请 注册 或 登录 后发表评论