作者 Administrator

合并分支 'test' 到 'master'

Test



查看合并请求 !1
正在显示 83 个修改的文件 包含 4537 行增加71 行删除

要显示太多修改。

为保证性能只显示 83 of 83+ 个文件。

... ... @@ -31,4 +31,4 @@ lastupdate.tmp
*.log
public/*
logs/
\ No newline at end of file
logs/
... ...
FROM golang:1.19-alpine as builder
# Define the project name | 定义项目名称
ARG PROJECT=core
WORKDIR /build
COPY . .
RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
RUN apk update --no-cache && apk add --no-cache tzdata
RUN go env -w GO111MODULE=on \
&& go env -w GOPROXY=https://goproxy.cn,direct \
&& go env -w CGO_ENABLED=0 \
&& go env \
&& go mod tidy \
&& cd cmd/discuss/api \
&& go build -ldflags="-s -w" -o /build/api/${PROJECT} ${PROJECT}.go
FROM alpine:latest
# Define the project name | 定义项目名称
ARG PROJECT=core
# Define the config file name | 定义配置文件名
ARG CONFIG_FILE=core.yaml
# Define the author | 定义作者
ARG AUTHOR=785409885@qq.com
LABEL org.opencontainers.image.authors=${AUTHOR}
WORKDIR /app
ENV PROJECT=${PROJECT}
ENV CONFIG_FILE=${CONFIG_FILE}
ENV TZ Asia/Shanghai
COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /usr/share/zoneinfo/Asia/Shanghai
COPY --from=builder /build/api/${PROJECT} ./
COPY --from=builder /build/cmd/discuss/api/etc/${CONFIG_FILE} ./etc/
EXPOSE 8081
ENTRYPOINT ./${PROJECT} -f etc/${CONFIG_FILE}
\ No newline at end of file
... ...
... ... @@ -4,7 +4,7 @@ model:
.PHONY: api
api:
goctl api go -api .\cmd\discuss\mini\dsl\core.api -dir cmd/discuss/api -style go_zero
goctl api go -api .\cmd\discuss\api\dsl\core.api -dir cmd/discuss/api -style go_zero
.PHONY: swagger
swagger:
... ...
# 说明
### 测试环境
服务端域名 http://sumifcc-discuss-test.sumifcc.com/
日志地址 https://sumifcc-discuss-test.sumifcc.com/v1/log/access
管理后台“易数家“前端入口:https://digital-front-platform-dev.fjmaimaimai.com/
跳转后的实际管理后台地址: https://sumifcc-x-front-test.sumifcc.com
样例账号 18860183050 密码 123456
### 可设置环境变量
- DataSource
数据库连接,样例
``` code
host=数据库IP地址 user=用户名 password=密码 dbname=数据库名 port=31543 sslmode=disable TimeZone=Asia/Shanghai
```
\ No newline at end of file
... ...
package main
import (
"context"
"flag"
"github.com/zeromicro/go-zero/core/logx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"net/http"
"strings"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
"github.com/golang-jwt/jwt/v4/request"
"github.com/zeromicro/go-zero/core/conf"
"github.com/zeromicro/go-zero/core/logx"
"github.com/zeromicro/go-zero/rest"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/config"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
)
var configFile = flag.String("f", "etc/core.yaml", "the config file")
var configFile = flag.String("f", "cmd/discuss/api/etc/core.yaml", "the config file")
func main() {
// 配置加载
flag.Parse()
var c config.Config
conf.MustLoad(*configFile, &c)
// 默认的token头 Authorization 修改未 x-token
request.AuthorizationHeaderExtractor = &request.PostExtractionFilter{
request.HeaderExtractor{"x-mmm-accesstoken"}, func(tok string) (string, error) {
// Should be a bearer token
if len(tok) > 6 && strings.ToUpper(tok[0:7]) == "BEARER " {
return tok[7:], nil
}
return tok, nil
},
}
// 初始化Domain里面的配置
domain.ProjectName = c.Name
// 系统设置
systemSetup(c)
// 服务初始化
opts := make([]rest.RunOption, 0)
// cors
opt := rest.WithCustomCors(func(header http.Header) {
opts = append(opts, rest.WithCustomCors(func(header http.Header) {
header.Set("Access-Control-Allow-Headers", "*")
}, func(writer http.ResponseWriter) {
})
opts = append(opts, opt)
}))
opts = append(opts, rest.WithUnauthorizedCallback(func(w http.ResponseWriter, r *http.Request, err error) {
if err != nil {
logx.Debugf("unauthorized: %s \n", err.Error())
}
}))
server := rest.MustNewServer(c.RestConf, opts...)
defer server.Stop()
ctx := svc.NewServiceContext(c)
handler.RegisterHandlers(server, ctx)
db.Migrate(ctx.DB)
// 数据迁移
if c.Migrate {
db.Migrate(ctx.DB)
}
// 服务启动
logx.Infof("Starting server at %s:%d... \n", c.Host, c.Port)
server.Start()
}
func systemSetup(c config.Config) {
// 初始化Domain里面的配置
domain.ProjectName = c.Name
// 默认的token头 Authorization 修改为 x-mmm-accesstoken
request.AuthorizationHeaderExtractor = &request.PostExtractionFilter{
Extractor: request.HeaderExtractor{"x-mmm-accesstoken"},
Filter: func(tok string) (string, error) {
// Should be a bearer token
if len(tok) > 6 && strings.ToUpper(tok[0:7]) == "BEARER " {
return tok[7:], nil
}
return tok, nil
},
}
// 系统错误应答包装
httpx.SetErrorHandlerCtx(func(ctx context.Context, err error) (int, any) {
return http.StatusOK, result.Error(xerr.ServerCommonError, err.Error())
})
// 系统成功应答包装
httpx.SetOkHandler(func(ctx context.Context, a any) any {
return result.Success(a)
})
}
... ...
import "core/test.api"
\ No newline at end of file
syntax = "v1"
import "core/common.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"
import "core/department.api"
\ No newline at end of file
... ...
syntax = "v1"
info(
title: "文章内容处理"
desc: "编辑处理文章内容"
author: "author"
email: "email"
version: "v1"
)
// 小程序接口
@server(
prefix: v1/mini
group: article
middleware: LogRequest
jwt: MiniAuth
)
service Core {
@doc "小程序创建发布内容"
@handler MiniCreateArticle
post /article (MiniArticleCreateRequest) returns (MiniArticleCreateResponse)
@doc "小程序获取文章内容详情"
@handler MiniGetArticle
get /article/:id (MiniArticleGetRequest) returns (MiniArticleGetResponse)
@doc "小程序获取文章的点赞人员列表"
@handler MiniUserLikeArticle
post /article/user_like/list (MiniUserLikeArticleRequest) returns (MiniUserLikeArticleResponse)
@doc "小程序人员操作点赞文章/评论"
@handler MiniSetUserLike
post /article/user_like/set (MiniSetUserLikeRequset) returns (MiniSetUserLikeResponse)
@doc "小程序标记当前人员查看的文章"
@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 (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)
@doc "小程序设置文章的定性标签"
@handler MiniArticleSetTag
post /article/set_tag (MiniArticleSetTagRequest) returns (MiniArticleSetTagResponse)
@doc "小程序所有的定性标签"
@handler MiniAllArticleTag
get /article_tag/list/all (MiniAllArticleTagRequest) returns (MiniAllArticleTagResponse)
@doc "小程序首页数据展示"
@handler MiniShowHomePage
get /show/home_page (MiniHomePageRequest) returns (MiniHomePageResponse)
@doc "小程序首页搜索文章"
@handler MiniSearchArticlePage
post /show/search_article (MiniSearchArticleRequest) returns (MiniSearchArticleResponse)
}
// 管理后台接口
@server(
prefix: v1/system
group: article
middleware: LoginStatusCheck,LogRequest
jwt: SystemAuth
)
service Core {
@doc "管理后台获取文章内容详情"
@handler SystemGetArticle
get /article/:id (SystemArticleGetRequest) returns (SystemArticleGetResponse)
@doc "管理后台获取文章列表"
@handler SystemSearchArticle
post /article/search (SystemArticleSearchRequest) returns (SystemArticleSearchResponse)
@doc "管理后台编辑帖子"
@handler SystemUpdateArticle
put /article (SystemArticleUpdateRequest) returns (SystemArticleUpdateResponse)
@doc "管理后台编辑历史"
@handler SystemHistoryArticle
post /article/history (SystemArticleHistoryRequest) returns (SystemArticleHistoryResponse)
@doc "管理后台帖子历史详情"
@handler SystemArticleGetHistory
get /article/history/:id (SystemArticleGetHistoryRequest) returns (SystemArticleGetHistoryResponse)
@doc "管理后台获取我发布的文章"
@handler SystemArticleSearchMe
post /article/search/me (SystemArticleSearchMeRequest) returns (SystemArticleSearchMeResponse)
@doc "管理后台文章恢复"
@handler SystemArticleRestore
post /article/restore (SystemArticleRestoreRequest) returns (SystemArticleRestoreResponse)
}
\ No newline at end of file
... ...
syntax = "v1"
info(
title: "后台编辑标签"
desc: "编辑处理标签信息"
author: "author"
email: "email"
version: "v1"
)
@server(
prefix: v1/system
group: tags
middleware: LoginStatusCheck,LogRequest
jwt: SystemAuth
)
service Core {
@doc "后台创建文章标签"
@handler CreateTag
post /article_tag (TagCreateRequest) returns (TagCreateResponse)
@doc "后台编辑文章标签"
@handler EditTag
put /article_tag (TagEditRequest) returns (TagEditResponse)
@doc "后台获取文章标签"
@handler GetTag
get /article_tag/:id (TagGetRequest) returns (TagGetResponse)
@doc "后台删除文章标签"
@handler DeleteTag
delete /article_tag/:id (TagDeleteRequest) returns (TagDeleteResponse)
@doc "后台搜索标签"
@handler SearchTag
post /article_tag/search (TagListRequest) returns (TagListResponse)
@doc "后台标签下拉列表"
@handler Options
get /article_tag/options (TagOptionsRequest) returns (TagOptionsResponse)
}
// 创建标签
type (
TagCreateRequest {
CompanyId int64 `json:",optional"`
Image string `json:"image"`
Name string `json:"name"` // 标签名称
Category string `json:"category"` // 标签分类
Remark string `json:"remark,optional"` // 备注
Other string `json:"other,optional"`
SortBy int `json:"sortBy,optional"` //排序
}
TagCreateResponse {
Id int64 `json:"id"`
}
)
// 编辑标签
type (
TagEditRequest {
Id int64 `json:"id"`
CompanyId int64 `json:",optional"`
Image string `json:"image"`
Name string `json:"name"` // 标签名称
Category string `json:"category"` // 标签分类
Remark string `json:"remark,optional"` // 备注
Other string `json:"other,optional"`
SortBy int `json:"sortBy,optional"` // 排序
}
TagEditResponse {
Id int64 `json:"id"`
}
)
// 获取标签详情
type (
TagGetRequest {
Id int64 `path:"id"`
CompanyId int64 `path:",optional"`
}
TagGetResponse {
Id int64 `json:"id"`
Image string `json:"image"`
Name string `json:"name"` // 标签名称
Category string `json:"category"` // 标签分类
Remark string `json:"remark"` // 备注
Other string `json:"other"`
SortBy int `json:"sortBy,optional"` // 排序
}
)
//标签列表
type (
TagListRequest {
Page int `json:"page"`
Size int `json:"size"`
CompanyId int64 `json:",optional"`
TagName string `json:"tagName,optional"`
Category string `json:"category,optional"`
Remark string `json:"remark,optional"`
}
TagListResponse {
Total int64 `json:"total"`
List []TagItem `json:"list"`
}
TagItem {
Id int64 `json:"id"`
Image string `json:"image"`
Name string `json:"name"` // 标签名称
Category string `json:"category"` // 标签分类
Remark string `json:"remark"` // 备注
CreatedAt int64 `json:"createdAt"`
SortBy int `json:"sortBy,optional"` // 排序
}
)
//删除标签
type (
TagDeleteRequest {
Id int64 `path:"id"`
CompanyId int64 `path:",optional"`
}
TagDeleteResponse {
Id int64 `json:"id"`
}
)
//标签下拉列表
type (
TagOptionsRequest {
CompanyId int64 `path:",optional"` // 公司ID
}
TagOptionsResponse {
Options []TagOptions `json:"options"`
}
TagOptions {
Label string `json:"label"` // 分组名称
Options []TagOptionValue `json:"options"`
}
TagOptionValue {
Label string `json:"label"` // 名称
Value int64 `json:"value"` // 标签ID
}
)
\ No newline at end of file
... ...
syntax = "v1"
// 坐标地点描述
type Location {
Longitude float64 `json:"longitude,optional"` //经度
Latitude float64 `json:"latitude,optional"` //纬度
Descript string `json:"descript,optional"` //地点描述
}
type Video {
Url string `json:"url"` //视频文件的地址
Cover string `json:"cover,optional"` //封面
Width int `json:"width,optional"` //封面图片宽
Height int `json:"height,optional"` //封面图片长
}
// 人员的简单展示信息
type ArticleAuthor {
Id int64 `json:"id"` // 人员id
Name string `json:"name"` // 人员的名字
Avatar string `json:"avatar"` // 人员头像URL
Position string `json:"position"` // 职位
Company string `json:"company"` // 公司
}
//小程序端创建发布文章
type (
MiniArticleCreateRequest {
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"` //定位坐标
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
}
MiniArticleCreateResponse {
Id int64 `json:"id"`
}
)
//小程序端查看文章的详情
type (
MiniArticleGetRequest {
Id int64 `path:"id"` //id
CompanyId int64 `path:",optional"` //当前公司
UserId int `path:",optional"` //当前用户
}
MiniArticleGetResponse {
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"` //图片
Videos []Video `json:"videos"` //视频
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"` // 评论的展示状态(1显示、2不显示)
Edit int `json:"edit"` // 文章是否存在变更记录 (0 不存在 1存在)
MeLoveFlag int `json:"meLoveFlag"` // 当前人员对文章的点赞标识 (0 没有点赞 1有点赞)
MeFollowFlag int `json:"meFollowFlag"` // 当前人员对作者的关注标识 (0 没有关注 1有关注)
Tags []string `json:"tags"` // 文章的标签
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
}
ArticleSection {
Id int64 `json:"id"` //段落id
Content string `json:"content"` // 文本内容
SortBy int `json:"sortBy"` // 排序
TotalComment int `json:"totalComment"` // 评论的数量
}
)
// 小程序获取我的发文章记录
type (
MiniArticleSearchMeRequest {
AuthorId int64 `json:",optional"`
CompanyId int64 `json:",optional"`
Page int `json:"page"`
Size int `json:"size"`
}
MiniArticleSearchMeResponse {
Total int `json:"total"`
List []ArticleSearchMe `json:"list"`
}
ArticleSearchMe {
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"` //评论数量
CountRead int `json:"countRead"` //浏览数量
Show int `json:"show"` //是否隐藏 [0显示、1不显示]
}
SystemArticleSearchMeRequest {
Page int `json:"page"`
Size int `json:"size"`
AuthorId int64 `json:"authorId"` // 用户
BeginTime int64 `json:"beginTime,optional"` // 开始时间
EndTime int64 `json:"endTime,optional"` // 结束时间
}
SystemArticleSearchMeResponse {
Total int `json:"total"`
List []ArticleSearchMe `json:"list"`
}
)
//小程序端获取文章有哪些人进行了点赞
type (
MiniUserLikeArticleRequest {
ArticleId int64 `json:"articleId"` // 文章id
CompanyId int64 `json:",optional"` //公司id
Page int `json:"page"` //分页,第几页
Size int `json:"size"` //分页,每页几条
}
MiniUserLikeArticleResponse {
Total int64 `json:"total"` //总数
List []WhichUserLikeArticle `json:"list"` //列表
}
WhichUserLikeArticle {
ArticleId int64 `json:"articleId"` // 文章id
UserId int64 `json:"userId"` // 人员id
Name string `json:"name"` // 人员名称
Avatar string `json:"avatar"` // 人员头像
Position string `json:"position"` // 职位
CreatedAt int64 `json:"createdAt"` // 点赞记录的时间
}
)
// 小程序端人员点赞文章/评论
type (
MiniSetUserLikeRequset {
ArticleId int64 `json:"articleId"` //文章id
CommentId int64 `json:"commentId,optional"` //评论id
UserId int64 `json:",optional"` //操作人
Flag int `json:"flag"` //点赞标志 1、点赞 2 、取消点赞
}
MiniSetUserLikeResponse {
ArticleId int64 `json:"articleId"` //文章id
CommentId int64 `json:"commentId"` //评论id
Count int `json:"count"` //现有的点赞数量
}
)
// 小程序端获取文章的编辑记录
type (
MiniArticleBackupSearchRequest {
Page int `json:"page"`
Size int `json:"size"`
ArticleId int `json:"articleId"`
CompanyId int64 `json:",optional"` // 服务端自动获取
}
MiniArticleBackupSearchResponse {
Total int64 `json:"total"`
List []MiniArticleBackupItem `json:"list"`
}
MiniArticleBackupItem {
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 {
UserId int64 `json:",optional"` // 当前操作人
CompanyId int64 `json:",optional"` // 当前公司
ArticleId int64 `json:"articleId"` // 文章id
}
MiniArticleMarkUserReadResponse {
Id int64 `json:"id"`
}
)
//小程序端创建文章到草稿箱
type (
MiniArticleDraftCreateRequest {
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"` // 坐标
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
}
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"` // 坐标
MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
}
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"`//
MatchUrl map[string]string `json:"matchUrl"` //匹配内容中的url文本
}
)
//小程序端获取我的草稿内容
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"` // 坐标
MatchUrl map[string]string `json:"matchUrl"` //
}
)
// 小程序端删除我的草稿内容
type (
MiniArticleDraftDeleteMeRequest {
CompanyId int64 `path:",optional"` // 公司id
AuthorId int64 `path:",optional"` // 发布人
Id int64 `path:"id"`
}
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 (
MiniArticleSetTagRequest {
CompanyId int64 `json:",optional"` // 公司id
UserId int64 `json:",optional"` // 公司id
ArticleId int64 `json:"articleId"` // 文章id
TagId []int64 `json:"tagId"` // 标签id
}
MiniArticleSetTagResponse {
Id []int64 `json:"id"`
}
)
//小程序端获取所有的定性标签
type (
MiniAllArticleTagRequest {
CompanyId int64 `json:",optional"` // 公司id
UserId int64 `json:",optional"` // 公司id
}
MiniAllArticleTagResponse {
TagGroup []ArticleTagGroup `json:"tagGroup"`
}
ArticleTagGroup {
Category string `json:"category"`
Tags []ArticleTagItem `json:"tags"`
}
ArticleTagItem {
Id int64 `json:"id"`
Category string `json:"category"`
Name string `json:"name"`
Image string `json:"image"`
SortBy int `json:"sortBy"`
}
)
//管理后台获取文章详情
type (
SystemArticleGetRequest {
Id int64 `path:"id"` //id
CompanyId int64 `path:",optional"`
}
UserShowName {
Id int `json:"id"`
Name string `json:"name"`
}
SystemArticleGetResponse {
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"` // 图片
Videos []Video `json:"videos"` // 视频
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不显示)
Tags []ArticleTagItem `json:"tags"` //标签
TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人]
}
)
//管理后台获取文章列表
type (
SystemArticleSearchRequest {
CompanyId int64 `json:"companyId,optional"`
Title string `json:"title,optional"` //标题
Author int64 `json:"author,optional"` //发布人
BeginTime int64 `json:"beginTime,optional"` //开始时间
EndTime int64 `json:"endTime,optional"` //结束时间
Tags []int64 `json:"tags,optional"` //标签
Page int `json:"page"` //页码
Size int `json:"size"` //每页行数
}
SystemArticleSearchResponse {
Total int `json:"total"`
List []SystemArticleSearch `json:"list"`
}
SystemArticleSearch {
Id int64 `json:"id"` //id
Title string `json:"title"` //标题
AuthorId int64 `json:"authorId"` //发布人ID
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 (
//编辑
SystemArticleUpdateRequest {
Id int64 `json:"id"`
CompanyId int64 `json:"companyId,optional"`
Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
Section []ArticleSection `json:"section"` // 填写的内容
Title string `json:"title"` // 标题
Images []string `json:"images"` // 图片
Videos []Video `json:"video"` // 视频
WhoRead []int64 `json:"whoRead"` // 谁可以看
WhoReview []int64 `json:"whoReview"` // 评论人
TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人]
Tags []int64 `json:"tags"` // 标签
AccessToken string `header:"x-mmm-accesstoken"` // 授权token
}
SystemArticleUpdateResponse {
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"` //点赞数量
Videos []Video `json:"video"` // 视频
CountComment int `json:"countComment"` //评论数量
Show int `json:"show"` //是否隐藏 [0显示、1不显示]
Tags []int64 `json:"tags"` //标签
TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人]
}
)
// 管理后台编辑历史列表
type (
//历史
SystemArticleHistoryRequest {
ArticleId int64 `json:"articleId"` //文章ID
Author string `json:"author,optional"` //发布人
BeginTime int64 `json:"beginTime,optional"` //开始时间
EndTime int64 `json:"endTime,optional"` //结束时间
Page int `json:"page"` //页码
Size int `json:"size"` //每页行数
}
SystemArticleHistoryResponse {
Total int `json:"total"`
List []SystemArticleHistory `json:"list"`
}
SystemArticleHistory {
Id int64 `json:"id"` //id
Author string `json:"author"` //编辑人
Action string `json:"action"` //编辑类型
UpdatedAt int64 `json:"updatedAt"` //编辑时间
}
)
// 管理后台历史记录详情
type (
SystemArticleGetHistoryRequest {
Id int64 `path:"id"` //id
CompanyId int64 `path:",optional"`
}
SystemArticleGetHistoryResponse {
Id int64 `json:"id"` // id
ArticleId int64 `json:"articleId"` // 文章ID
Title string `json:"title"` // 标题
CreatedAt int64 `json:"createdAt"` // 文章的发布时间
Section []ArticleSection `json:"section"` // 文章的文本内容
Images []string `json:"images"` // 图片
Videos []Video `json:"video"`
WhoRead []int64 `json:"whoRead"` // 谁可查看
WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看
WhoReview []int64 `json:"whoReview"` // 谁可评论
WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论
Location Location `json:"location"` // 定位坐标
TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人]
Tags []int64 `json:"tags"` // 标签
}
)
// 管理后台文章恢复
type (
SystemArticleRestoreRequest {
Id int64 `json:"id"` //ID
AccessToken string `header:"x-mmm-accesstoken"` // 授权token
}
SystemArticleRestoreResponse {
Id int64 `json:"id"` //ID
ArticleId int64 `json:"articleId"` //文章ID
}
)
//小程序端 首页数据展示
// 统计各标签下的文章数量,和已被人员阅读的数量
type (
MiniHomePageRequest {
CompanyId int64 `path:",optional"`
UserId int64 `path:",optional"`
}
MiniHomePageResponse {
TagCategory []string `json:"tagCategory"`
Tags []ArticleTagCount `json:"tags"`
}
ArticleTagCount {
TagCategory string `json:"tagCategory"` // 标签分组
TagId int64 `json:"tagId"` // 标签id
TagImage string `json:"tagImage"` // 对应的图标
TagName string `json:"tagName"` // 标签名称
TagRemark string `json:"tagRemark"` // 标签备注
TotalArticle int `json:"totalArticle"` // 总的文章数量
ReadArticle int `json:"readArticle"` // 已读的标签数量
SortBy int `json:"sortBy"` // 排序
}
)
//小程序首页搜索文章
type (
MiniSearchArticleRequest {
Page int `json:"page"`
Size int `json:"size"`
CompanyId int64 `json:",optional"`
UserId int64 `json:",optional"`
TagCategory string `json:"tagCategory,optional"`
TagId int64 `json:"tagId,optional"`
BeginTime int64 `json:"beginTime,optional"`
EndTime int64 `json:"endTime,optional"`
SearchWord string `json:"searchWord,optional"`
}
//
MiniSearchArticleResponse {
Total int `json:"total"`
List []MiniSearchArticleItem `json:"list"`
}
//
MiniSearchArticleItem{
ArticleId int64 `json:"articleId"`
Title string `json:"title"`
AuthorId int64 `json:"authorId"`
Author string `json:"author"` // 发布人
Avatar string `json:"avatar"`// 发布人的头像
Images []string `json:"images"`
CreatedAt int64 `json:"createdAt"`
MeReadFlag int `json:"meReadFlag"` //已读标识 [0:未读] [1:已读]
}
)
\ No newline at end of file
... ...
syntax = "v1"
info(
title: "评论相关"
desc: "编辑处理文章的评论"
author: "author"
email: "email"
version: "v1"
)
// 小程序接口
@server(
prefix: v1/mini
group: comment
middleware: LogRequest
jwt: MiniAuth
)
service Core {
@doc "小程序填写文章的评论"
@handler MiniCreateArticleComment
post /article_comment (MiniCreateArticleCommentRequest) returns (MiniCreateArticleCommentResponse)
@doc "小程序展示文章的评论列表"
@handler MiniListArticleComment
post /article_comment/list (MiniListArticleCommentRequest) returns (MiniListArticleCommentResponse)
@doc "小程序展示评论对应的一级回复列表"
@handler MiniListReplyArticleComment
post /article_comment/list_reply (MiniListReplyArticleCommentRequest) returns (MiniListReplyArticleCommentResponse)
@doc "小程序展示文章的评论列表TOP5"
@handler MiniTop5ArticleComment
post /article_comment/top5 (MiniTop5ArticleCommentRequest) returns (MiniTop5ArticleCommentResponse)
@doc "小程序展示单个文章的评论"
@handler MiniGetArticleComment
get /article_comment/:id (MiniGetArticleCommentRequest) returns (MiniGetArticleCommentResponse)
@doc "小程序展示删除文章评论"
@handler MiniDeleteArticleComment
delete /article_comment/:id (MiniDeleteArticleCommentRequest) returns (MiniDeleteArticleCommentResponse)
@doc "小程序展示评论时@人可选列表"
@handler MiniArticleCommentAtWho
post /article_comment/at_who/list (MiniArticleCommentAtWhoRequest) returns (MiniArticleCommentAtWhoResponse)
}
// 后台接口
@server(
prefix: v1/system
group: comment
middleware: LoginStatusCheck,LogRequest
jwt: SystemAuth
)
service Core {
@doc "小程序获取回复@人可选列表"
@handler SystemArticleCommentSearchMe
post /article_comment/search/me (SystemArticleCommentSearchMeRequest) returns (SystemArticleCommentSearchMeResponse)
@doc "管理后台文章评论列表"
@handler SystemArticleCommentSearch
post /article_comment/search (SystemArticleCommentSearchRequest) returns (SystemArticleCommentSearchResponse)
@doc "管理后台查看所有的评论"
@handler SystemListAticleComment
post /article_comment/list (SystemListCommentRequest)returns (SystemListCommentResponse)
@doc "管理后台评论的详情"
@handler SystemGetAticleComment
get /article_comment/:id (SystemGetCommentRequest)returns (SystemGetCommentResponse)
@doc "管理后台变更评论的显示状态"
@handler SystemEditAticleCommentShow
post /article_comment/edit_show (SystemEditCommentShowRequest)returns (SystemEditCommentShowResponse)
@doc "管理后台变更评论"
@handler SystemEditAticleComment
post /article_comment/edit (SystemEditCommentRequest)returns (SystemEditCommentResponse)
@doc "编辑评论的运营点赞数"
@handler SystemEditAticleCommentLove
post /article_comment/edit/love (SystemEditCommentLoveRequest)returns (SystemEditCommentLoveResponse)
}
//评论的填写人
type CommentAuthor {
Id int64 `json:"id"` // 人员id
Name string `json:"name"` // 人员的名字
Avatar string `json:"avatar,optional"` // 人员头像URL
Position string `json:"position,optional"` // 职位
Company string `json:"company,optional"` // 公司
}
// 小程序填写文章的评论
type (
MiniCreateArticleCommentRequest {
ArtitcleId int64 `json:"articleId"` // 文章id
SectionId int64 `json:"sectionId"` // 段落id
FromUserId int64 `json:",optional"` // 填写文章的人,服务端自动获取
CompanyId int64 `json:",optional"` // 服务端自动获取
Pid int64 `json:"pid,optional"` // 回复那个评论的id
Content string `json:"content"` // 评论的内容
AtWho []CommentAtWho `json:"atWho,optional"` // 填写评论时@的人
MatchUrl map[string]string `json:"matchUrl,optional"` // 评论内容中的url文本
}
CommentAtWho {
Id int64 `json:"id"`
Avatar string `json:"avatar,optional"` // 人员头像URL
Name string `json:"name,optional"`
FirstLetter string `json:"firstLetter,optional"`
}
MiniCreateArticleCommentResponse {
Id int64 `json:"id"`
Pid int64 `json:"pid"`
TopId int64 `json:"topId"`
ArtitcleId 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 []CommentAtWho `json:"atWho"` // 填写评论时@的人
MatchUrl map[string]string `json:"matchUrl"` // 评论内容中的url文本
CreatedAt int64 `json:"createdAt"` //
}
)
// 小程序获取文章的评论列表
type (
MiniListArticleCommentRequest {
Page int `json:"page"`
Size int `json:"size"`
CompanyId int64 `json:",optional"`
UserId int64 `json:",optional"`
ArticleId int64 `json:"articleId"`
SectionId int64 `json:"sectionId,optional"`
}
MiniListArticleCommentResponse {
Total int64 `json:"total"`
List []ArticleCommentAndReply `json:"list"`
}
ArticleCommentAndReply {
Comment ArticleCommentItem `json:"comment"` //评论
Reply []ArticleCommentItem `json:"reply"` //回复的评论
TotalReply int64 `json:"totalReply"` //回复的评论数量
}
ArticleCommentItem {
Id int64 `json:"id"`
Pid int64 `json:"pid"`
TopId int64 `json:"topId"`
ArtitcleId 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 []CommentAtWho `json:"atWho"` // 填写评论时@的人
MatchUrl map[string]string `json:"matchUrl"` // 评论内容中的url文本
CreatedAt int64 `json:"createdAt"` //
MeLoveFlag int `json:"meLoveFlag"` // 当前人员对评论的点赞标识 (0 没有点赞 1有点赞)
Content string `json:"content"` // 评论的内容
}
)
// 小程序获取单个文章的评论
type (
MiniGetArticleCommentRequest {
CommentId int64 `path:"id"`
CompanyId int64 `path:",optional"`
UserId int64 `path:",optional"`
}
MiniGetArticleCommentResponse {
ArticleCommentAndReply
}
)
// 小程序删除单个文章的评论
type (
MiniDeleteArticleCommentRequest {
CommentId int64 `path:"id"`
UserId int64 `path:",optional"`
CompanyId int64 `path:",optional"`
}
MiniDeleteArticleCommentResponse {
Id int64 `json:"id"`
}
)
// 热门前5的评论列表
type (
MiniTop5ArticleCommentRequest {
CompanyId int64 `json:",optional"`
UserId int64 `json:",optional"`
ArticleId int64 `json:"articleId"`
}
MiniTop5ArticleCommentResponse {
List []ArticleCommentItem `json:"list"`
}
)
// 填写评论时选择@人
type (
MiniArticleCommentAtWhoRequest {
CompanyId int64 `json:",optional"`
UserId int64 `json:",optional"`
ArticleId int64 `json:"articleId"`
}
MiniArticleCommentAtWhoResponse {
List []CommentAtWho `json:"list"`
}
)
// 获取评论的回复,只返回一级
type (
MiniListReplyArticleCommentRequest {
CommentId int64 `json:"commentId"`
UserId int64 `json:",optional"`
CompanyId int64 `json:",optional"`
Page int `json:"page"`
Size int `json:"size"`
}
MiniListReplyArticleCommentResponse {
Total int64 `json:"total"`
List []ArticleCommentItem `json:"list"`
}
)
type (
SystemArticleCommentSearchMeRequest {
Page int `json:"page"`
Size int `json:"size"`
AuthorId int64 `json:"authorId"` // 用户
BeginTime int64 `json:"beginTime,optional"` // 开始时间
EndTime int64 `json:"endTime,optional"` // 结束时间
}
SystemArticleCommentSearchMeResponse {
List []ArticleCommentItem `json:"list"`
Total int64 `json:"total"`
}
)
// 文章里的评论列表
type (
SystemArticleCommentSearchRequest {
Page int `json:"page"`
Size int `json:"size"`
ArticleId int64 `json:"articleId"` // 文章ID
TopId int64 `json:"topId,optional"` // 文章顶层ID
Author int64 `json:"author,optional"` // 用户
Show int `json:"show,optional"` // 显示状态
BeginTime int64 `json:"beginTime,optional"` // 开始时间
EndTime int64 `json:"endTime,optional"` // 结束时间
}
SystemArticleCommentSearchResponse {
Total int64 `json:"total"`
List []SystemArticleCommentSearchItem `json:"list"`
}
SystemArticleCommentSearchItem {
Id int64 `json:"id"`
Pid int64 `json:"pid"`
TopId int64 `json:"topId"`
ArtitcleId int64 `json:"articleId"` // 文章id
SectionId int64 `json:"sectionId"` // 段落id
FromUserId int64 `json:"fromUserId"` // 填写评论的人
FromUser CommentAuthor `json:"fromUser"` // 填写评论的人
CountReply int `json:"countReply"` // 回复数量
CountUserLove int `json:"countUserLove"` // 用户点赞数量
CountAdminLove int `json:"countAdminLove"` // 运营点赞数量
CreatedAt int64 `json:"createdAt"` // 评论时间
Content string `json:"content"` // 评论的内容
AtWho []CommentAtWho `json:"atWho"` // 填写评论时@的人
MatchUrl map[string]string `json:"matchUrl"` // 评论内容中的url文本
Show int `json:"show"` // 显示状态
}
)
// 管理后台 评论管理列表
type (
SystemListCommentRequest {
Page int `json:"page"`
Size int `json:"size"`
CompanyId int64 `json:",optional"` //
TopId int64 `json:"topId,optional"` // 评论的顶层ID
FromUserId int64 `json:"fromUserId,optional"` // 用户
Show int `json:"show,optional"` // 显示状态
BeginTime int64 `json:"beginTime,optional"` // 填写评论的开始时间
EndTime int64 `json:"endTime,optional"` // 填写评论的结束时间
ArticleTitle string `json:"articleTitle,optional"` //
Content string `json:"content,optional"` //
}
SystemListCommentResponse {
Total int `json:"total"`
List []SystemCommentItem `json:"list"`
}
SystemCommentItem {
Id int64 `json:"id"` //评论id
Pid int64 `json:"pid"` //
TopId int64 `json:"topId"` //
ArticleId int64 `json:"articleId"` //对应的文章id
ArticleTitle string `json:"articleTitle"` //文章标题
FromUserId int64 `json:"fromUserId"` //填写评论的人
FromUser CommentAuthor `json:"fromUser"` //填写评论的人
CreatedAt int64 `json:"createdAt"` //评论的填写时间
Content string `json:"content"` //评论的内容
Show int `json:"show"` //是否展示 [1显示] [2不显示]
CountReply int `json:"countReplay"` //回复数量
CountUserLove int `json:"countUserLove"` //用户点赞数量
CountAdminLove int `json:"countAdminLove"` //运营点赞数量
}
)
// 管理后台获取评论详情
type (
SystemGetCommentRequest {
CompanyId int64 `path:",optional"`
Id int64 `path:"id"`
}
SystemGetCommentResponse {
Id int64 `json:"id"` //评论id
Pid int64 `json:"pid"` //
TopId int64 `json:"topId"` //
ArticleId int64 `json:"articleId"` //对应的文章id
ArticleTitle string `json:"articleTitle"` //文章标题
FromUserId int64 `json:"fromUserId"` //填写评论的人
FromUser CommentAuthor `json:"fromUser"` //填写评论的人
CreatedAt int64 `json:"createdAt"` //评论的填写时间
SectionContent string `json:"sectionContent"` //引用的段落内容
Content string `json:"content"` // 评论的内容
Show int `json:"show"` //是否展示 [1显示] [2不显示]
CountReply int `json:"countReplay"` //回复数量
CountUserLove int `json:"countUserLove"` //用户点赞数量
CountAdminLove int `json:"countAdminLove"` //运营点赞数量
}
)
// 管理后台单独设置评论显示隐藏状态
type (
SystemEditCommentShowRequest {
CompanyId int64 `json:",optional"`
Id []int64 `json:"id"`
Show int `json:"show"` //[1 显示评论] [2: 隐藏评论]
}
SystemEditCommentShowResponse {
Id []int64 `json:"id"`
}
)
// 管理后台变更评论
type (
SystemEditCommentRequest {
CompanyId int64 `json:",optional"`
Id int64 `json:"id"`
Show int `json:"show"` //[1 显示评论] [2: 隐藏评论]
Content string `json:"content,optional"`
CountAdminLove int `json:"countAdminLove,optional"`
}
SystemEditCommentResponse {
Id int64 `json:"id"`
}
)
// 管理后台变更评论的运营点赞
type (
SystemEditCommentLoveRequest {
CompanyId int64 `json:",optional"`
ParamList []SystemEditLove `json:"paramList"`
}
SystemEditLove {
Id int64 `json:"id"`
CountAdminLove int `json:"countAdminLove,optional"`
}
SystemEditCommentLoveResponse {
ParamList []SystemEditLove `json:"paramList"`
}
)
\ No newline at end of file
... ...
syntax = "v1"
info(
title: "天联鹰蜓"
desc: "天联鹰蜓"
author: "email"
email: "email"
version: "v1"
)
// 通用接口
@server(
prefix: v1
group: common
)
service Core {
@doc "日志查询"
@handler commonGetLog
get /log/:module
}
// 通用接口
@server(
prefix: v1
middleware: LogRequest
group: common
)
service Core {
@doc "短信验证码"
@handler commonSmsCode
post /common/sms/code (CommonSmsCodeRequest) returns (CommonSmsCodeResposne)
@doc "微信二维码"
@handler miniQrcodeInvite
post /mini/qrcode (MiniQrCodeRequest)
@doc "清理缓存"
@handler commonGetClearCache
get /clear
}
// 短信验证码
type(
CommonSmsCodeRequest{
Phone string `json:"phone"`
}
CommonSmsCodeResposne{
}
)
type(
MiniQrCodeRequest{
Page string `json:"page"` // 微信页面入口
Scene string `json:"scene"` // 参数
}
)
\ No newline at end of file
... ...
syntax = "v1"
info(
title: "天联鹰蜓"
desc: "天联鹰蜓"
author: "email"
email: "email"
version: "v1"
)
// 小程序接口
@server(
prefix: v1
group: company
middleware: LogRequest
)
service Core {
@doc "公司搜索(公开的)"
@handler miniCompanySearch
post /mini/company/search(CompanySearchRequest) returns (CompanySearchResponse)
}
// 小程序接口
@server(
prefix: v1
group: company
middleware: LogRequest
jwt : MiniAuth
)
service Core {
@doc "搜索已加入的公司"
@handler miniCompanySearchJoined
post /mini/company/search-joined(CompanySearchRequest) returns (CompanySearchResponse)
}
// 后台接口
@server(
prefix: v1
group: company
middleware: LoginStatusCheck,LogRequest
jwt : SystemAuth
)
service Core {
@doc "公司搜索"
@handler systemCompanySearch
post /system/company/search(CompanySearchRequest) returns (CompanySearchResponse)
@doc "公司职位搜索"
@handler systemCompanyPositionsSearch
post /system/company/positions/search(CompanyPositionsSearchRequest) returns (CompanyPositionsSearchResponse)
}
type (
CompanySearchRequest {
Page int `json:"page,optional"`
Size int `json:"size,optional"`
Flag int `json:"flag,optional"` // 1:用户已加入的 2:用户未加入的公司
UserId int64 `json:"userId,optional"` // 按用户搜索(用户所加入的企业)
Code string `json:"code,optional"` // 按编码搜索
Content string `json:"content,optional"` // 按公司名/编码搜索
}
CompanySearchResponse {
List []Company `json:"list"`
Total int64 `json:"total"`
}
Company {
Id int64 `json:"id,string,omitempty"` // 唯一标识
Name string `json:"name,omitempty"` // 名称
Code string `json:"code,omitempty"` // 编码(搜索使用,4位字母数字)
Logo string `json:"logo,omitempty"` // 公司LOGO
JoinedFlag int `json:"joinedFlag"` // 已加入标识(1:已加入 其他:未加入)
}
)
// 公司职位搜索
type(
CompanyPositionsSearchRequest{
}
CompanyPositionsSearchResponse {
List []Position `json:"list"`
Total int64 `json:"total"`
}
Position{
Name string `json:"name"`
}
)
\ No newline at end of file
... ...
syntax = "v1"
info(
title: "部门分组"
desc: "部门分组"
author: "zz"
email: "email"
version: "v1"
)
@server(
prefix: v1
group: department
middleware: LoginStatusCheck,LogRequest
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)
@doc "部门-删除"
@handler systemDelete
delete /system/department/:id (DepartmentGetRequest) 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"`
Ids []int64 `json:"ids"` // 用户ID
}
DepartmentListRequest {
Page int `json:"page"`
Size int `json:"size"`
}
DepartmentListResponse {
List []Department `json:"list"`
Total int64 `json:"total"`
}
)
... ...
syntax = "v1"
info(
title: "消息中心"
desc: "消息中心"
author: "zz"
email: "email"
version: "v1"
)
@server(
prefix: v1
group: message
middleware: LogRequest
jwt: MiniAuth
)
service Core {
@doc "系统消息"
@handler miniSystem
post /mini/message/system (MessageRequest) returns (MessageSystemResponse)
@doc "评论消息"
@handler miniComment
post /mini/message/comment (MessageRequest) returns (MessageBusinessResponse)
@doc "点赞消息"
@handler miniLike
post /mini/message/like (MessageRequest) returns (MessageBusinessResponse)
}
type (
MessageRequest {
Page int `json:"page"`
Size int `json:"size"`
}
MessageSystemResponse {
List []MessageSystemItem `json:"list"`
Total int64 `json:"total"`
}
MessageSystemItem {
Id int64 `json:"id"` // ID
Type int `json:"type"` // 系统分类
Title string `json:"title"` // 标题
Content string `json:"content"` // 内容
CreatedAt int64 `json:"createdAt"` // 创建时间
}
MessageBusinessResponse {
List []MessageBusinessItem `json:"list"`
Total int64 `json:"total"`
}
MessageBusinessItem {
Id int64 `json:"id"`
Type int `json:"type"` // 分类 (1回复 2点赞 3被采纳)
OptType int `json:"optType"` // 操作类型(1针对文章或段落、2针对评论、3针对圆桌)
CompanyId int64 `json:"companyId"` // 操作人公司ID
UserId int64 `json:"userId"` // 操作人用户ID
RecipientId int64 `json:"recipientId"` // 接收者ID
ArticleId int64 `json:"articleId"` // 文章ID
// CommentId int64 `json:"commentId"` // 评论ID
// DiscussionId int64 `json:"discussionId"` // 圆桌ID
// DiscussionOpinionId int64 `json:"discussionOpinionId"` // 观点ID
// Content string `json:"content"` // 消息内容
CreatedAt int64 `json:"createdAt"` // 创建时间
User *SimpleUser `json:"user"` // 操作人
Article *SimpleArticle `json:"article"` // 文章
Comment *SimpleComment `json:"comment"` // 评论
CommentParent *SimpleComment `json:"commentParent"` // 被回复的评论
}
SimpleUser {
Id int64 `json:"id"`
CompanyId int64 `json:"companyId,omitempty"` // 公司ID
CompanyName string `json:"companyName,omitempty"` // 公司名称
Name string `json:"name"` // 名称
Avatar string `json:"avatar"` // 头像
Position string `json:"position"` // 职位
}
SimpleArticle {
Id int64 `json:"id"`
Title string `json:"title"` // 文章标题
Summary string `json:"summary"` // 文章概要
CountLove int `json:"countLove"` // 点赞数量
CountComment int `json:"countComment"` // 评论数量
Show int `json:"show"` // 文章的展示状态(0显示、1不显示)
}
)
... ...
syntax = "v1"
info(
title: "天联鹰蜓"
desc: "天联鹰蜓"
author: "email"
email: "email"
version: "v1"
)
@server(
prefix: v1
group: role
middleware: LoginStatusCheck,LogRequest
jwt: SystemAuth
)
service Core {
@doc "角色详情"
@handler systemGetRole
get /system/role/:id (RoleGetRequest) returns (RoleGetResponse)
@doc "角色新增"
@handler systemSaveRole
post /system/role (RoleSaveRequest) returns (RoleSaveResponse)
@doc "角色删除"
@handler systemDeleteRole
delete /system/role/:id (RoleDeleteRequest) returns (RoleDeleteResponse)
@doc "角色更新"
@handler systemUpdateRole
put /system/role/:id (RoleUpdateRequest) returns (RoleUpdateResponse)
@doc "角色列表搜索"
@handler systemSearchRole
post /system/role/search (RoleSearchRequest) returns (RoleSearchResponse)
@doc "角色权限列表"
@handler systemGetRoleAuths
get /system/role/auths
}
type (
RoleGetRequest {
Id int64 `path:"id"`
}
RoleGetResponse {
Role RoleItem `json:"role"`
AuthList []Auth `json:"authList"`
}
RoleSaveRequest {
Role RoleItem `json:"role"`
}
RoleSaveResponse struct{}
RoleDeleteRequest {
Id int64 `path:"id"`
}
RoleDeleteResponse struct{}
RoleUpdateRequest {
Id int64 `path:"id"`
Role RoleItem `json:"role"`
}
RoleUpdateResponse struct{}
RoleSearchRequest {
Page int `json:"page,optional"`
Size int `json:"size,optional"`
Style string `json:"style,options=[simple,,full]"` // simple:只返回角色ID名称 full:所有字段都返回
}
RoleSearchResponse {
List []RoleItem `json:"list"`
Total int64 `json:"total"`
}
RoleItem {
Id int64 `json:"id,optional"` // 角色ID
CompanyId int64 `json:"companyId,optional,string,omitempty"` // 公司ID
Name string `json:"name"` // 角色名称
AuthIds []int64 `json:"authIds,optional,omitempty"` // 角色权限列表
AuthsDesc string `json:"authsDesc,optional,omitempty"` // 权限列表描述
UsersDesc string `json:"usersDesc,optional,omitempty"` // 用户列表描述
Remark string `json:"remark,optional,omitempty"` // 备注
Users []RoleUser `json:"users,optional,omitempty"` // 绑定的用户
UpdatedAt int64 `json:"updatedAt,optional,omitempty"` // 更新时间
}
RoleUser {
Id int64 `json:"id"`
Name string `json:"name"`
}
Auth {
Id int64 `json:"id"` // ID
Name string `json:"name"` // 名称
Code string `json:"code"` // 编码
}
)
\ No newline at end of file
... ...
syntax = "v1"
info(
title: "天联鹰蜓"
desc: "天联鹰蜓"
author: "小火箭"
email: "email"
version: "v1"
)
@server(
prefix: v1
group: tool
)
service Core {
@doc "健康"
@handler miniHealth
get /health (MiniHealthRequest) returns (MiniHealthResposne)
}
type(
MiniHealthRequest struct{
}
MiniHealthResposne struct{
Ok bool `json:"ok"`
}
)
\ No newline at end of file
syntax = "v1"
info(
title: "天联鹰蜓"
desc: "天联鹰蜓"
author: "email"
email: "email"
version: "v1"
)
// 小程序接口
@server(
prefix: v1
group: user
)
service Core {
@doc "用户申请加入公司"
@handler miniUserApplyJoinCompany
post /mini/user/apply_join_company(MiniUserApplyJoinCompanyRequest) returns (MiniUserApplyJoinCompanyResponse)
@doc "用户登录"
@handler miniUserLogin
post /mini/user/login (MiniUserLoginRequest) returns (MiniUserLoginResponse)
}
@server(
prefix: v1
group: user
middleware: LogRequest
jwt: MiniAuth
)
service Core {
@doc "切换账号"
@handler miniUserSwitchAccount
post /mini/user/switch_account (MiniUserSwitchAccountRequest) returns (MiniUserLoginResponse)
@doc "用户信息"
@handler miniUserInfo
post /mini/user/info (MiniUserInfoRequest) returns (MiniUserInfoResponse)
@doc "编辑用户信息"
@handler miniEditUserInfo
post /mini/user/info/edit (MiniEditUserInfoRequest) returns (MiniEditUserInfoResponse)
@doc "用户统计"
@handler miniUserStatistics
post /mini/user/statistics (UserStatisticsRequest) returns (UserStatisticsResponse)
@doc "用户审核列表"
@handler miniUserAuditList
post /mini/user/audit_list (UserSearchRequest)returns(UserSearchResponse)
@doc "用户审核"
@handler miniUserAudit
post /mini/user/audit (MiniUserAuditRequest)
@doc "部门用户列表"
@handler miniUserDepartmentUsers
post /mini/user/department_users (MiniUserDepartmentUsersRequest)
@doc "用户列表"
@handler miniUsersList
post /mini/user/user_list (MiniUsersListRequest)
@doc "用户快讯"
@handler miniUserNews
post /mini/user/news (MiniUserNewsRequest)returns(MiniUserNewsResposne)
@doc "我关注人发布的信息"
@handler miniUserMyFollowingNews
post /mini/user/my_following_news (MiniUserNewsRequest)returns(MiniUserNewsResposne)
@doc "关注我的人"
@handler miniUserFollower
post /mini/user/follower (MiniUserFollowedSearchRequest)returns(MiniUserFollowedSearchResponse)
@doc "我关注的人"
@handler miniUserFollowing
post /mini/user/following (MiniUserFollowedSearchRequest)returns(MiniUserFollowedSearchResponse)
@doc "我关注的人-最新未读列表(未读标红)"
@handler miniUserFollowingLatestUnreadList
post /mini/user/following/latest_unread_list (MiniUserFollowedSearchRequest)returns(MiniUserFollowedSearchResponse)
@doc "我关注的人-标记已读"
@handler miniUserFollowingMarkRead
post /mini/user/following/mark_read (MiniUserFollowingMarkReadRequest)
@doc "关注"
@handler miniUserFollow
post /mini/user/follow (FollowRequest)
@doc "取消关注"
@handler miniUserUnFollow
post /mini/user/unfollow (FollowRequest)
@doc "我点赞的-文章或评论列表"
@handler miniMyLike
post /mini/user/mylike (MiniMyLikeRequest)returns (MiniMyLikeResponse)
@doc "我被点赞-文章或评论列表"
@handler miniMyBeLiked
post /mini/user/mybeliked (MiniBeLikedRequest)returns (MiniBeLikedResponse)
}
type(
MiniEditUserInfoRequest{
Avatar *string `json:"avatar"`
}
MiniEditUserInfoResponse{
}
)
type(
MiniUserLoginRequest {
LoginType string `json:"loginType"` // 登录类型 wechat-login whchat-phone-login phone-password-login phone-smscode-login
WechatAuthCode string `json:"wechatAuthcode,optional"` // 微信登录 授权码
WechatEncryptedData string `json:"wechatEncryptedData,optional"` // 微信登录 加密数据
WechatIV string `json:"wechatIV,optional"` // 微信登录 加密算法初始向量
Phone string `json:"phone,optional"` // 手机号
Password string `json:"password,optional"` // 密码
SmsCode string `json:"smsCode,optional"` // 短信验证码
}
MiniUserLoginResponse {
Token string `json:"token"` // x-token
Phone string `json:"phone"` // 手机号
Message string `json:"message"` // 失败消息(审核中,注册成功等待审核)
Success bool `json:"success"` // 成功标识
}
MiniUserSwitchAccountRequest{
CompanyId int64 `json:"companyId,string"`
}
MiniUserInfoRequest {
//MyStatisticsFlag bool `json:"myStatisticsFlag"` // true:返回统计信息 false;统计信息不返回
}
MiniUserInfoResponse {
User *UserItem `json:"user,omitempty"` // 用户信息
Accounts []Account `json:"accounts"` // 公司账号
Auths []Auth `json:"auths"` // 权限列表
}
MiniUserApplyJoinCompanyRequest{
Phone string `json:"phone"`
Code string `json:"code"`
IsFromQr bool `json:"isFromQr,optional"` // true:扫码添加 false:手动查找添加
}
MiniUserApplyJoinCompanyResponse{
Token string `json:"token"` // x-token
}
MiniUserAuditRequest{
UserId int64 `json:"userId"` // 用户ID
Status int `json:"status"` // 审核状态 1:审核通过 2:拒绝
}
MiniUserDepartmentUsersRequest{
}
MiniUserDepartmentUsersResponse{
Departments []*Department `json:"departments"`
Users []*UserItem `json:"users"`
}
MiniUsersListRequest{
ArticleId int64 `json:"articleId,optional"` // 按文章ID(返回文章可见的用户)
RoleId int64 `json:"roleId,optional"` // 按角色角色关联的用户
}
MiniUserNewsRequest{
AuthorId int64 `json:"authorId,optional"` // 特定作者ID
LastArticleId int64 `json:"lastArticleId,optional"`// 最后文章ID
Size int `json:"size"` // 数量
}
MiniUserNewsResposne{
List []UserNewsItem `json:"list"`
LastArticleId int64 `json:"lastArticleId"`// 最后文章ID
}
UserNewsItem{
NewsId int64 `json:"newsId"` // 快讯ID
Type string `json:"type"` // 快讯类型 文章:Article 讨论:Discuss ...
Title string `json:"title"` // 标题
Summary string `json:"summary"` // 快讯概要
Time int64 `json:"time"` // 时间
ReadFlag bool `json:"readFlag"` // 已读标识 true:已读 false:未读
Images []string `json:"images"` // 图片列表
Author UserItem `json:"author"` // 作者
}
MiniUserFollowedSearchRequest{
Page int `json:"page,optional"`
Size int `json:"size,optional"`
Name string `json:"name,optional"`
}
MiniUserFollowedSearchResponse{
List []*UserFollowItem `json:"users"`
Total int64 `json:"total"`
}
MiniUserFollowingMarkReadRequest{
UserId int64 `json:"userId"`
}
UserItem {
Id int64 `json:"id,omitempty"` // 用户ID
CompanyId int64 `json:"companyId,string,omitempty"` // 公司ID
CompanyName string `json:"companyName,omitempty"` // 公司名称
CompanyCode string `json:"companyCode,omitempty"` // 公司编码(邀请码)
CompanyLogo *string `json:"companyLogo,omitempty"` // 公司LOGO
//DepartmentId int64 `json:"departmentId,omitempty"` // 部门ID
//Roles []int64 `json:"roleId,omitempty"` // 角色
Flag int `json:"flag,omitempty"` // 标识 1:管理员 2:普通用户 (有绑定角色是管理员)
Name string `json:"name,omitempty"` // 名称
Avatar *string `json:"avatar,omitempty"` // 头像
Phone string `json:"phone,omitempty"` // 手机号 唯一
Position string `json:"position,omitempty"` // 职位
Enable int `json:"enable,omitempty"` // 启用状态 1:启用 2:禁用
AuditStatus *int `json:"auditStatus,omitempty"` // 审核状态 0:待审核 1:审核通过 2:拒绝
AuditAt int64 `json:"auditAt,omitempty"` // 审核时间
Follower []int64 `json:"followers,omitempty"` // 关注我的人 (冗余)
Following []int64 `json:"following,omitempty"` // 我关注的人 (冗余)
Departments []int64 `json:"departments,omitempty"` // 所属部门
AccountFrom string `json:"accountFrom,omitempty"` // 账号来源 后台新增、扫码注册
}
Account {
CompanyId int64 `json:"companyId,string"` // 公司ID
CompanyName string `json:"companyName"` // 公司名称
Logo string `json:"logo"` // 公司图标
UserId int64 `json:"userId"` // 用户ID
Name string `json:"name"` // 名称
Position string `json:"position"`// 职位
}
Department struct {
Id int64 `json:"id,omitempty"` // 部门ID
CompanyId int64 `json:"companyId"` // 公司ID
ParentId int64 `json:"parentId"` // 父级ID
Name string `json:"name"` // 部门名称
UserIds []int64 `json:"userIds"` // 部门下的用户
}
UserSearchRequest{
Page int `json:"page,optional"`
Size int `json:"size,optional"`
AuditFlag *int `json:"auditFlag,optional"` // 按审核状态 0:待审核 1:审核通过 2:拒绝
}
UserSearchResponse{
List []*UserItem `json:"list"`
Total int64 `json:"total"`
}
FollowRequest{
UserId int64 `json:"userId"`
}
UserFollowItem struct {
Id int64 `json:"id"` // 用户ID
Name string `json:"name"` // 名称
CompanyName string `json:"companyName"` // 公司名称
Avatar string `json:"avatar"` // 头像
Position string `json:"position"` // 职位
Followed bool `json:"followed"` // 关注
MutualFollowed bool `json:"mutualFollowed"` // 互相关注标识
ReadFlag bool `json:"readFlag"` // 已读标识 true:已读 false:未读(小红点)
}
)
// 1.我点赞的文章或评论 2.我的文章或评论被点赞
type (
MiniMyLikeRequest{
Page int `json:"page"`
Size int `json:"size"`
}
MiniMyLikeResponse {
List []MyLikeItem `json:"list"`
Total int64 `json:"total"`
}
MyLikeItem {
UserId int64 `json:"userId"` // 发布人id
ArticleId int64 `json:"articleId"` // 文章id
CommentId int64 `json:"commentId"` // 评论id
CreatedAt int64 `json:"createdAt"` // 创建时间
User *SimpleUser `json:"user"` // 发布人
Article *SimpleArticle `json:"article"` // 文章
Comment *SimpleComment `json:"comment"` // 评论
}
SimpleComment {
Id int64 `json:"id"`
Content string `json:"content"` // 评论内容
Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
AtWho []CommentAtWho `json:"atWho"` // 填写评论时@的人
MatchUrl map[string]string `json:"matchUrl"` // 评论内容中的url文本
CountReply int `json:"countReply"` // 用户回复数量
CountUserLove int `json:"countUserLove"` // 用户点赞数量
}
MiniBeLikedRequest{
Page int `json:"page"`
Size int `json:"size"`
}
MiniBeLikedResponse {
List []MyBeLikedItem `json:"list"`
Total int64 `json:"total"`
}
MyBeLikedItem {
UserId int64 `json:"userId"` // 点赞人id
ArticleId int64 `json:"articleId"` // 文章id
CommentId int64 `json:"commentId"` // 评论id
CreatedAt int64 `json:"createdAt"` // 创建时间
User *SimpleUser `json:"user"` // 点赞人
Article *SimpleArticle `json:"article"` // 文章
Comment *SimpleComment `json:"comment"` // 评论
}
)
// 后台接口
@server(
prefix: v1
group: user
middleware: LoginStatusCheck,LogRequest
jwt: SystemAuth
)
service Core {
@doc "系统用户信息"
@handler systemUserInfo
post /system/user/info(SystemUserInfoRequest) returns (SystemUserInfoResponse)
@doc "用户统计"
@handler systemUserStatistics
post /system/user/statistics (UserStatisticsRequest) returns (UserStatisticsResponse)
@doc "用户列表"
@handler systemUsersList
post /system/user/user_list (MiniUsersListRequest)
@doc "用户详情"
@handler systemUserGet
get /system/user/:id (SystemUserGetRequest) returns (SystemUserGetResponse)
@doc "更新用户"
@handler systemUserUpdate
put /system/user/:id (SystemUserUpdateRequest) returns (SystemUserUpdateResponse)
@doc "搜索用户"
@handler systemUserSearch
post /system/user/search (SystemUserSearchRequest) returns (SystemUserSearchResponse)
@doc "系统账号详情"
@handler systemUserAccountGet
get /system/account/:id (SystemUserAccountGetRequest) returns (SystemUserAccountGetResponse)
@doc "系统新增账号"
@handler systemUserAccountSave
post /system/account (SystemUserAccountSaveRequest) returns (SystemUserAccountSaveResponse)
@doc "系统启用/禁用账号"
@handler systemUserAccountEnable
post /system/account/enable (SystemUserAccountEnableRequest) returns (SystemUserAccountEnableResponse)
@doc "系统更新账号"
@handler systemUserAccountUpdate
put /system/account/:id (SystemUserAccountUpdateRequest) returns (SystemUserAccountUpdateResponse)
@doc "系统搜索账号"
@handler systemUserAccountSearch
post /system/account/search (SystemUserAccountSearchRequest) returns (SystemUserAccountSearchResponse)
}
type(
SystemUserInfoRequest{
Token string `header:"x-mmm-accesstoken"`
}
SystemUserInfoResponse{
UserId int64 `json:"userId"`
UserName string `json:"userName"`
Avatar string `json:"avatar"`
CompanyId int64 `json:"companyId"`
CompanyName string `json:"companyName"`
Code string `json:"code"`
}
UserStatisticsRequest{
UserId int64 `json:"userId,optional"`
ItemFlag int `json:"itemFlag"` //0:默认查询所有 1:他的帖子 2:他的评论/回复 4:他收到的赞 8:TA的圆桌讨论 16:被采纳
}
UserStatisticsResponse{
TotalArticle int `json:"totalArticle"` // 累计发布文章
TotalComment int `json:"totalComment"` // 累计发布评论
TotalLoved int `json:"totalLoved"` // 累计赞别人
TotalBeLoved int `json:"totalBeLoved"` // 累计收到的赞
}
StatisticsItem{
ItemFlag int `json:"itemFlag"` // 1:他的帖子 2:他的评论/回复 4:他收到的赞 8:TA的圆桌讨论 16:被采纳
Value float64 `json:"value"` // 统计值
}
SystemUserGetRequest {
Id int64 `path:"id"`
}
SystemUserGetResponse struct{
User SystemUser `json:"user"`
}
SystemUser struct{
Id int64 `json:"id"` // 用户ID
Name string `json:"name"` // 名称
Avatar string `json:"avatar"` // 头像
Phone string `json:"phone"` // 手机号 唯一
Position string `json:"position"` // 职位
Enable int `json:"enable"` // 启用状态 1:启用 2:禁用
Departments []int64 `json:"departments"` // 所属部门
AccountFrom string `json:"accountFrom"` // 账号来源 后台新增、扫码注册
CreatedAt int64 `json:"createdAt"` // 注册时间
Roles []int64 `json:"roles"` // 角色
RolesDesc string `json:"rolesDesc"` // 角色描述
DepartmentsDesc string `json:"departmentsDesc"` // 部门描述
}
SystemUserUpdateRequest struct{
Id int64 `path:"id"`
Avatar string `json:"avatar,optional"` // 头像
Position string `json:"position"` // 职位
Departments []int64 `json:"departments"` // 所属部门
}
SystemUserUpdateResponse struct{}
SystemUserSearchRequest struct{
Page int `json:"page"`
Size int `json:"size"`
Name string `json:"name,optional"` // 名称
Phone string `json:"phone,optional"` // 手机号 唯一
Position string `json:"position,optional"` // 职位
Enable int `json:"enable,optional"` // 启用状态 1:启用 2:禁用
DepartmentId int64 `json:"departmentId,optional"` // 所属部门
}
SystemUserSearchResponse{
List []SystemUser `json:"list"`
Total int64 `json:"total"`
}
SystemUserAccountGetRequest {
Id int64 `path:"id"`
}
SystemUserAccountGetResponse struct{
User SystemUser `json:"user"`
}
SystemUserAccountSaveRequest struct{
Name string `json:"name"` // 名称
Phone string `json:"phone"` // 手机号 唯一
Enable int `json:"enable"` // 启用状态 1:启用 2:禁用
Roles []int64 `json:"roles"` // 角色
}
SystemUserAccountSaveResponse struct{
}
SystemUserAccountEnableRequest struct{
UserIds []int64 `json:"userIds"` // 用户ID列表
Status int `json:"status"` // 状态 1:启用 2:禁用
}
SystemUserAccountEnableResponse struct{
}
SystemUserAccountUpdateRequest struct{
Id int64 `path:"id"`
Name string `json:"name"` // 姓名
Roles []int64 `json:"roles"` // 权限角色
Status int `json:"enable"` // 状态 1:启用 2:禁用
}
SystemUserAccountUpdateResponse struct{}
SystemUserAccountSearchRequest struct{
Page int `json:"page"`
Size int `json:"size"`
Name string `json:"name,optional"` // 名称
Phone string `json:"phone,optional"` // 手机号 唯一
RoleId int64 `json:"roleId,optional"` // 角色权限
Enable int `json:"enable,optional"` // 启用状态 1:启用 2:禁用
BeginTime int64 `json:"beginTime,optional"` // 注册日期-开始
EndTime int64 `json:"endTime,optional"` // 注册日期-结束
}
SystemUserAccountSearchResponse{
List []SystemUser `json:"list"`
Total int64 `json:"total"`
}
)
\ No newline at end of file
... ...
Name: discuss
Host: 0.0.0.0
Port: 8081
Verbose: true
Verbose: false
Migrate: false
Timeout: 30000
# CertFile: ./key/fjmaimaimai.com_bundle.crt
# KeyFile: ./key/fjmaimaimai.com.key
LogRequest: true # 记录详细请求日志
Log:
#Mode: file
Mode: file
Encoding: plain
Level: debug # info
MaxSize: 1 # 2MB
TimeFormat: 2006-01-02 15:04:05.000
TimeFormat: 2006-01-02 15:04:05
Rotation: size
MaxContentLength: 10240
JwtAuth:
SystemAuth:
AccessSecret: digital-platform
Expire: 360000
AccessExpire: 360000
MiniAuth:
AccessSecret: discuss-secret
AccessExpire: 360000
Redis:
Host: 192.168.0.247:30379
Type: node
Pass:
DB:
DataSource: host=114.55.200.59 user=postgres password=eagle1010 dbname=sumifcc-discuss-dev port=31543 sslmode=disable TimeZone=Asia/Shanghai
\ No newline at end of file
DataSource: host=114.55.200.59 user=postgres password=eagle1010 dbname=sumifcc-discuss-dev port=31543 sslmode=disable TimeZone=Asia/Shanghai
ApiAuth:
Name: ApiAuth
Host: http://digital-platform-dev.fjmaimaimai.com
Timeout: 0s
Wechat:
AppID: wxae5b305849343ec8
AppSecret: f584adb68f7d784425b60e1ebb2ffd4b
... ...
... ... @@ -4,10 +4,23 @@ import (
"github.com/zeromicro/go-zero/core/stores/redis"
"github.com/zeromicro/go-zero/rest"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/config"
"time"
)
type Config struct {
rest.RestConf
config.Config
Redis redis.RedisConf `json:",optional"`
Redis redis.RedisConf `json:",optional"`
SystemAuth config.Auth
MiniAuth config.Auth
Migrate bool `json:",optional,default=true"`
ApiAuth ApiService
DebugSmsCode string `json:",optional,default=999512"`
LogRequest bool `json:",optional,default=true"`
}
type ApiService struct {
Name string
Host string
Timeout time.Duration
}
... ...
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 MiniAllArticleTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniAllArticleTagRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := article.NewMiniAllArticleTagLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.CompanyId = token.CompanyId
req.UserId = token.UserId
resp, err := l.MiniAllArticleTag(&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 MiniArticleBackupSearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniArticleBackupSearchRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
token := contextdata.GetUserTokenFromCtx(r.Context())
req.CompanyId = token.CompanyId
l := article.NewMiniArticleBackupSearchLogic(r.Context(), svcCtx)
resp, err := l.MiniArticleBackupSearch(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package article
import (
"net/http"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
"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 {
result.HttpResult(r, w, nil, err)
return
}
l := article.NewMiniArticleMarkListLogic(r.Context(), svcCtx)
resp, err := l.MiniArticleMarkList(&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 MiniArticleMarkUserReadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniArticleMarkUserReadRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := article.NewMiniArticleMarkUserReadLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.CompanyId = token.CompanyId
req.UserId = token.UserId
resp, err := l.MiniArticleMarkUserRead(&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 MiniArticleSearchMeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniArticleSearchMeRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := article.NewMiniArticleSearchMeLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.AuthorId = token.UserId
req.CompanyId = token.CompanyId
resp, err := l.MiniArticleSearchMe(&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 MiniArticleSetTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniArticleSetTagRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := article.NewMiniArticleSetTagLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.UserId = token.UserId
req.CompanyId = token.CompanyId
resp, err := l.MiniArticleSetTag(&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 MiniCreateArticleDraftHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniArticleDraftCreateRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, 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)
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 MiniCreateArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniArticleCreateRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
token := contextdata.GetUserTokenFromCtx(r.Context())
l := article.NewMiniCreateArticleLogic(r.Context(), svcCtx)
req.AuthorId = token.UserId
resp, err := l.MiniCreateArticle(&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 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 {
result.HttpResult(r, w, nil, 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"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
)
// 获取我的文章草稿内容
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 {
result.HttpResult(r, w, nil, err)
return
}
l := article.NewMiniGetArticleDraftMeLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.AuthorId = token.UserId
req.CompanyId = token.CompanyId
resp, err := l.MiniGetArticleDraftMe(&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 MiniGetArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniArticleGetRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := article.NewMiniGetArticleLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.CompanyId = token.CompanyId
req.UserId = int(token.UserId)
resp, err := l.MiniGetArticle(&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 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 {
result.HttpResult(r, w, nil, 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 MiniSearchArticlePageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniSearchArticleRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := article.NewMiniSearchArticlePageLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.UserId = token.UserId
req.CompanyId = token.CompanyId
resp, err := l.MiniSearchArticlePage(&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 MiniSetUserLikeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniSetUserLikeRequset
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := article.NewMiniSetUserLikeLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.UserId = token.UserId
resp, err := l.MiniSetUserLike(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package article
import (
"net/http"
"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 MiniShowHomePageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniHomePageRequest
// if err := httpx.Parse(r, &req); err != nil {
// httpx.ErrorCtx(r.Context(), w, err)
// return
// }
l := article.NewMiniShowHomePageLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.UserId = token.UserId
req.CompanyId = token.CompanyId
resp, err := l.MiniShowHomePage(&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 {
result.HttpResult(r, w, nil, 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)
}
}
... ...
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 MiniUserLikeArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniUserLikeArticleRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := article.NewMiniUserLikeArticleLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.CompanyId = token.CompanyId
resp, err := l.MiniUserLikeArticle(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
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 SystemArticleGetHistoryHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemArticleGetHistoryRequest
if err := httpx.Parse(r, &req); err != nil {
result.ParamErrorResult(r, w, err)
return
}
l := article.NewSystemArticleGetHistoryLogic(r.Context(), svcCtx)
resp, err := l.SystemArticleGetHistory(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
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 SystemArticleRestoreHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemArticleRestoreRequest
if err := httpx.Parse(r, &req); err != nil {
result.ParamErrorResult(r, w, err)
return
}
l := article.NewSystemArticleRestoreLogic(r.Context(), svcCtx)
resp, err := l.SystemArticleRestore(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
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 SystemArticleSearchMeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemArticleSearchMeRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := article.NewSystemArticleSearchMeLogic(r.Context(), svcCtx)
resp, err := l.SystemArticleSearchMe(&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 SystemGetArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemArticleGetRequest
if err := httpx.Parse(r, &req); err != nil {
result.ParamErrorResult(r, w, err)
return
}
l := article.NewSystemGetArticleLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.CompanyId = token.CompanyId
resp, err := l.SystemGetArticle(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
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 SystemHistoryArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemArticleHistoryRequest
if err := httpx.Parse(r, &req); err != nil {
result.ParamErrorResult(r, w, err)
return
}
l := article.NewSystemHistoryArticleLogic(r.Context(), svcCtx)
resp, err := l.SystemHistoryArticle(&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 SystemSearchArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemArticleSearchRequest
if err := httpx.Parse(r, &req); err != nil {
result.ParamErrorResult(r, w, err)
return
}
l := article.NewSystemSearchArticleLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.CompanyId = token.CompanyId
resp, err := l.SystemSearchArticle(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
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 SystemUpdateArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemArticleUpdateRequest
if err := httpx.Parse(r, &req); err != nil {
result.ParamErrorResult(r, w, err)
return
}
l := article.NewSystemUpdateArticleLogic(r.Context(), svcCtx)
resp, err := l.SystemUpdateArticle(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package comment
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
"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 MiniArticleCommentAtWhoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniArticleCommentAtWhoRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := comment.NewMiniArticleCommentAtWhoLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.CompanyId = token.CompanyId
req.UserId = token.UserId
resp, err := l.MiniArticleCommentAtWho(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package comment
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
"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 MiniCreateArticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniCreateArticleCommentRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := comment.NewMiniCreateArticleCommentLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.CompanyId = token.CompanyId
req.FromUserId = token.UserId
resp, err := l.MiniCreateArticleComment(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package comment
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
"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 MiniDeleteArticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniDeleteArticleCommentRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := comment.NewMiniDeleteArticleCommentLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.CompanyId = token.CompanyId
req.UserId = token.UserId
resp, err := l.MiniDeleteArticleComment(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package comment
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
"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 MiniGetArticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniGetArticleCommentRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := comment.NewMiniGetArticleCommentLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.CompanyId = token.CompanyId
req.UserId = token.UserId
resp, err := l.MiniGetArticleComment(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package comment
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
"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"
)
// 小程序端获取 根据文章id 获取评论列表
func MiniListArticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniListArticleCommentRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := comment.NewMiniListArticleCommentLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.CompanyId = token.CompanyId
req.UserId = token.UserId
resp, err := l.MiniListArticleComment(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package comment
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
"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 MiniListReplyArticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniListReplyArticleCommentRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := comment.NewMiniListReplyArticleCommentLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.CompanyId = token.CompanyId
req.UserId = token.UserId
resp, err := l.MiniListReplyArticleComment(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package comment
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
"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"
)
// 获取前5的评论
func MiniTop5ArticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniTop5ArticleCommentRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := comment.NewMiniTop5ArticleCommentLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.CompanyId = token.CompanyId
req.UserId = token.UserId
resp, err := l.MiniTop5ArticleComment(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package comment
import (
"net/http"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
"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 SystemArticleCommentSearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemArticleCommentSearchRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := comment.NewSystemArticleCommentSearchLogic(r.Context(), svcCtx)
resp, err := l.SystemArticleCommentSearch(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package comment
import (
"net/http"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
"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 SystemArticleCommentSearchMeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemArticleCommentSearchMeRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := comment.NewSystemArticleCommentSearchMeLogic(r.Context(), svcCtx)
resp, err := l.SystemArticleCommentSearchMe(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package comment
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
"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 SystemEditAticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemEditCommentRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := comment.NewSystemEditAticleCommentLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.CompanyId = token.CompanyId
resp, err := l.SystemEditAticleComment(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package comment
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
"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 SystemEditAticleCommentLoveHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemEditCommentLoveRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
token := contextdata.GetUserTokenFromCtx(r.Context())
req.CompanyId = token.CompanyId
l := comment.NewSystemEditAticleCommentLoveLogic(r.Context(), svcCtx)
resp, err := l.SystemEditAticleCommentLove(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package comment
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
"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 SystemEditAticleCommentShowHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemEditCommentShowRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := comment.NewSystemEditAticleCommentShowLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.CompanyId = token.CompanyId
resp, err := l.SystemEditAticleCommentShow(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package comment
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
"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 SystemGetAticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemGetCommentRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := comment.NewSystemGetAticleCommentLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.CompanyId = token.CompanyId
resp, err := l.SystemGetAticleComment(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package comment
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
"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 SystemListAticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.SystemListCommentRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := comment.NewSystemListAticleCommentLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.CompanyId = token.CompanyId
resp, err := l.SystemListAticleComment(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package common
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/common"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
)
func CommonGetClearCacheHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := common.NewCommonGetClearCacheLogic(r.Context(), svcCtx)
err := l.CommonGetClearCache()
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.Ok(w)
}
}
}
... ...
package common
import (
"net/http"
"path/filepath"
"strings"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
)
func CommonGetLogHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req struct {
Module string `path:"module"`
}
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
path := svcCtx.Config.Log.Path
if svcCtx.Config.Log.Mode != "file" {
return
}
if path == "" {
path = "logs"
}
if !strings.HasSuffix(req.Module, ".log") {
req.Module += ".log"
}
handler := http.FileServer(http.Dir(path))
r.URL.Path = filepath.Join(req.Module)
handler.ServeHTTP(w, r)
}
}
... ...
package tool
package common
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/tool"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/common"
"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 MiniHealthHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
func CommonSmsCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniHealthRequest
var req types.CommonSmsCodeRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := tool.NewMiniHealthLogic(r.Context(), svcCtx)
resp, err := l.MiniHealth(&req)
l := common.NewCommonSmsCodeLogic(r.Context(), svcCtx)
resp, err := l.CommonSmsCode(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package common
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/common"
"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 MiniQrcodeInviteHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MiniQrCodeRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := common.NewMiniQrcodeInviteLogic(r.Context(), svcCtx)
resp, err := l.MiniQrcodeInvite(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package company
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/company"
"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 MiniCompanySearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CompanySearchRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := company.NewMiniCompanySearchLogic(r.Context(), svcCtx)
resp, err := l.MiniCompanySearch(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package company
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/company"
"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 MiniCompanySearchJoinedHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CompanySearchRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := company.NewMiniCompanySearchJoinedLogic(r.Context(), svcCtx)
resp, err := l.MiniCompanySearchJoined(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package company
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/company"
"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 SystemCompanyPositionsSearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CompanyPositionsSearchRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := company.NewSystemCompanyPositionsSearchLogic(r.Context(), svcCtx)
resp, err := l.SystemCompanyPositionsSearch(&req)
if err != nil {
httpx.ErrorCtx(r.Context(), w, err)
} else {
httpx.OkJsonCtx(r.Context(), w, resp)
}
}
}
... ...
package company
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/company"
"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 SystemCompanySearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CompanySearchRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := company.NewSystemCompanySearchLogic(r.Context(), svcCtx)
resp, err := l.SystemCompanySearch(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package department
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/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 {
result.ParamErrorResult(r, w, err)
return
}
l := department.NewSystemAddLogic(r.Context(), svcCtx)
resp, err := l.SystemAdd(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package department
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/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 SystemDeleteHandler(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 {
result.ParamErrorResult(r, w, err)
return
}
l := department.NewSystemDeleteLogic(r.Context(), svcCtx)
resp, err := l.SystemDelete(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package department
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/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 {
result.ParamErrorResult(r, w, err)
return
}
l := department.NewSystemGetLogic(r.Context(), svcCtx)
resp, err := l.SystemGet(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package department
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/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 {
result.ParamErrorResult(r, w, err)
return
}
l := department.NewSystemListLogic(r.Context(), svcCtx)
resp, err := l.SystemList(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package department
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/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 {
result.ParamErrorResult(r, w, err)
return
}
l := department.NewSystemUpdateLogic(r.Context(), svcCtx)
resp, err := l.SystemUpdate(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package message
import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"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/message"
"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 MiniCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MessageRequest
if err := httpx.Parse(r, &req); err != nil {
result.ParamErrorResult(r, w, err)
return
}
l := message.NewMiniBusinessLogic(r.Context(), svcCtx)
resp, err := l.MiniBusiness(&req, domain.MsgTypeReply)
result.HttpResult(r, w, resp, err)
}
}
... ...
package message
import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
"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/message"
"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 MiniLikeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MessageRequest
if err := httpx.Parse(r, &req); err != nil {
result.ParamErrorResult(r, w, err)
return
}
l := message.NewMiniBusinessLogic(r.Context(), svcCtx)
resp, err := l.MiniBusiness(&req, domain.MsgTypeLike)
result.HttpResult(r, w, resp, err)
}
}
... ...
package message
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/message"
"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 MiniSystemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.MessageRequest
if err := httpx.Parse(r, &req); err != nil {
result.ParamErrorResult(r, w, err)
return
}
l := message.NewMiniSystemLogic(r.Context(), svcCtx)
resp, err := l.MiniSystem(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package role
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/role"
"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 SystemDeleteRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RoleDeleteRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := role.NewSystemDeleteRoleLogic(r.Context(), svcCtx)
resp, err := l.SystemDeleteRole(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package role
import (
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
"net/http"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/role"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
)
func SystemGetRoleAuthsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
l := role.NewSystemGetRoleAuthsLogic(r.Context(), svcCtx)
resp, err := l.SystemGetRoleAuths()
result.HttpResult(r, w, resp, err)
}
}
... ...
package role
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/role"
"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 SystemGetRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RoleGetRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := role.NewSystemGetRoleLogic(r.Context(), svcCtx)
resp, err := l.SystemGetRole(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package role
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/role"
"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 SystemSaveRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RoleSaveRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := role.NewSystemSaveRoleLogic(r.Context(), svcCtx)
resp, err := l.SystemSaveRole(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package role
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/role"
"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 SystemSearchRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RoleSearchRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := role.NewSystemSearchRoleLogic(r.Context(), svcCtx)
resp, err := l.SystemSearchRole(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package role
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/role"
"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 SystemUpdateRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.RoleUpdateRequest
if err := httpx.Parse(r, &req); err != nil {
httpx.ErrorCtx(r.Context(), w, err)
return
}
l := role.NewSystemUpdateRoleLogic(r.Context(), svcCtx)
resp, err := l.SystemUpdateRole(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
... ... @@ -4,7 +4,15 @@ package handler
import (
"net/http"
tool "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/tool"
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"
common "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/common"
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"
user "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/user"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
"github.com/zeromicro/go-zero/rest"
... ... @@ -15,10 +23,634 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
[]rest.Route{
{
Method: http.MethodGet,
Path: "/health",
Handler: tool.MiniHealthHandler(serverCtx),
Path: "/log/:module",
Handler: common.CommonGetLogHandler(serverCtx),
},
},
rest.WithPrefix("/v1"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.LogRequest},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/common/sms/code",
Handler: common.CommonSmsCodeHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/qrcode",
Handler: common.MiniQrcodeInviteHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/clear",
Handler: common.CommonGetClearCacheHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.LogRequest},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/article_comment",
Handler: comment.MiniCreateArticleCommentHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article_comment/list",
Handler: comment.MiniListArticleCommentHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article_comment/list_reply",
Handler: comment.MiniListReplyArticleCommentHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article_comment/top5",
Handler: comment.MiniTop5ArticleCommentHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/article_comment/:id",
Handler: comment.MiniGetArticleCommentHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/article_comment/:id",
Handler: comment.MiniDeleteArticleCommentHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article_comment/at_who/list",
Handler: comment.MiniArticleCommentAtWhoHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
rest.WithPrefix("/v1/mini"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/article_comment/search/me",
Handler: comment.SystemArticleCommentSearchMeHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article_comment/search",
Handler: comment.SystemArticleCommentSearchHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article_comment/list",
Handler: comment.SystemListAticleCommentHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/article_comment/:id",
Handler: comment.SystemGetAticleCommentHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article_comment/edit_show",
Handler: comment.SystemEditAticleCommentShowHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article_comment/edit",
Handler: comment.SystemEditAticleCommentHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article_comment/edit/love",
Handler: comment.SystemEditAticleCommentLoveHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
rest.WithPrefix("/v1/system"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.LogRequest},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/mini/message/system",
Handler: message.MiniSystemHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/message/comment",
Handler: message.MiniCommentHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/message/like",
Handler: message.MiniLikeHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
rest.WithPrefix("/v1"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/article_tag",
Handler: tags.CreateTagHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/article_tag",
Handler: tags.EditTagHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/article_tag/:id",
Handler: tags.GetTagHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/article_tag/:id",
Handler: tags.DeleteTagHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article_tag/search",
Handler: tags.SearchTagHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/article_tag/options",
Handler: tags.OptionsHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
rest.WithPrefix("/v1/system"),
)
server.AddRoutes(
[]rest.Route{
{
Method: http.MethodPost,
Path: "/mini/user/apply_join_company",
Handler: user.MiniUserApplyJoinCompanyHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/login",
Handler: user.MiniUserLoginHandler(serverCtx),
},
},
rest.WithPrefix("/v1"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.LogRequest},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/mini/user/switch_account",
Handler: user.MiniUserSwitchAccountHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/info",
Handler: user.MiniUserInfoHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/info/edit",
Handler: user.MiniEditUserInfoHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/statistics",
Handler: user.MiniUserStatisticsHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/audit_list",
Handler: user.MiniUserAuditListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/audit",
Handler: user.MiniUserAuditHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/department_users",
Handler: user.MiniUserDepartmentUsersHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/user_list",
Handler: user.MiniUsersListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/news",
Handler: user.MiniUserNewsHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/my_following_news",
Handler: user.MiniUserMyFollowingNewsHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/follower",
Handler: user.MiniUserFollowerHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/following",
Handler: user.MiniUserFollowingHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/following/latest_unread_list",
Handler: user.MiniUserFollowingLatestUnreadListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/following/mark_read",
Handler: user.MiniUserFollowingMarkReadHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/follow",
Handler: user.MiniUserFollowHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/unfollow",
Handler: user.MiniUserUnFollowHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/mylike",
Handler: user.MiniMyLikeHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/mini/user/mybeliked",
Handler: user.MiniMyBeLikedHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
rest.WithPrefix("/v1"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/system/user/info",
Handler: user.SystemUserInfoHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/system/user/statistics",
Handler: user.SystemUserStatisticsHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/system/user/user_list",
Handler: user.SystemUsersListHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/system/user/:id",
Handler: user.SystemUserGetHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/system/user/:id",
Handler: user.SystemUserUpdateHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/system/user/search",
Handler: user.SystemUserSearchHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/system/account/:id",
Handler: user.SystemUserAccountGetHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/system/account",
Handler: user.SystemUserAccountSaveHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/system/account/enable",
Handler: user.SystemUserAccountEnableHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/system/account/:id",
Handler: user.SystemUserAccountUpdateHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/system/account/search",
Handler: user.SystemUserAccountSearchHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
rest.WithPrefix("/v1"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.LogRequest},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/mini/company/search",
Handler: company.MiniCompanySearchHandler(serverCtx),
},
}...,
),
rest.WithPrefix("/v1"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.LogRequest},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/mini/company/search-joined",
Handler: company.MiniCompanySearchJoinedHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
rest.WithPrefix("/v1"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/system/company/search",
Handler: company.SystemCompanySearchHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/system/company/positions/search",
Handler: company.SystemCompanyPositionsSearchHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
rest.WithPrefix("/v1"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.LogRequest},
[]rest.Route{
{
Method: http.MethodPost,
Path: "/article",
Handler: article.MiniCreateArticleHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/article/:id",
Handler: article.MiniGetArticleHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article/user_like/list",
Handler: article.MiniUserLikeArticleHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article/user_like/set",
Handler: article.MiniSetUserLikeHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article/mark/user_read",
Handler: article.MiniArticleMarkUserReadHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article/mark/list",
Handler: article.MiniArticleMarkListHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article/search/me",
Handler: article.MiniArticleSearchMeHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article_draft",
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),
},
{
Method: http.MethodPost,
Path: "/article/set_tag",
Handler: article.MiniArticleSetTagHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/article_tag/list/all",
Handler: article.MiniAllArticleTagHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/show/home_page",
Handler: article.MiniShowHomePageHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/show/search_article",
Handler: article.MiniSearchArticlePageHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
rest.WithPrefix("/v1/mini"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest},
[]rest.Route{
{
Method: http.MethodGet,
Path: "/article/:id",
Handler: article.SystemGetArticleHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article/search",
Handler: article.SystemSearchArticleHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/article",
Handler: article.SystemUpdateArticleHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article/history",
Handler: article.SystemHistoryArticleHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/article/history/:id",
Handler: article.SystemArticleGetHistoryHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article/search/me",
Handler: article.SystemArticleSearchMeHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/article/restore",
Handler: article.SystemArticleRestoreHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
rest.WithPrefix("/v1/system"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest},
[]rest.Route{
{
Method: http.MethodGet,
Path: "/system/role/:id",
Handler: role.SystemGetRoleHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/system/role",
Handler: role.SystemSaveRoleHandler(serverCtx),
},
{
Method: http.MethodDelete,
Path: "/system/role/:id",
Handler: role.SystemDeleteRoleHandler(serverCtx),
},
{
Method: http.MethodPut,
Path: "/system/role/:id",
Handler: role.SystemUpdateRoleHandler(serverCtx),
},
{
Method: http.MethodPost,
Path: "/system/role/search",
Handler: role.SystemSearchRoleHandler(serverCtx),
},
{
Method: http.MethodGet,
Path: "/system/role/auths",
Handler: role.SystemGetRoleAuthsHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
rest.WithPrefix("/v1"),
)
server.AddRoutes(
rest.WithMiddlewares(
[]rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest},
[]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),
},
{
Method: http.MethodDelete,
Path: "/system/department/:id",
Handler: department.SystemDeleteHandler(serverCtx),
},
}...,
),
rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
rest.WithPrefix("/v1"),
)
}
... ...
package tags
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags"
"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 CreateTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.TagCreateRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := tags.NewCreateTagLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.CompanyId = token.CompanyId
resp, err := l.CreateTag(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...
package tags
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags"
"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 DeleteTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.TagDeleteRequest
if err := httpx.Parse(r, &req); err != nil {
result.HttpResult(r, w, nil, err)
return
}
l := tags.NewDeleteTagLogic(r.Context(), svcCtx)
token := contextdata.GetUserTokenFromCtx(r.Context())
req.CompanyId = token.CompanyId
resp, err := l.DeleteTag(&req)
result.HttpResult(r, w, resp, err)
}
}
... ...