作者 Administrator

合并分支 'test' 到 'master'

Test



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

要显示太多修改。

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

@@ -31,4 +31,4 @@ lastupdate.tmp @@ -31,4 +31,4 @@ lastupdate.tmp
31 *.log 31 *.log
32 32
33 public/* 33 public/*
34 -logs/  
  34 +logs/
  1 +FROM golang:1.19-alpine as builder
  2 +
  3 +# Define the project name | 定义项目名称
  4 +ARG PROJECT=core
  5 +
  6 +WORKDIR /build
  7 +COPY . .
  8 +
  9 +RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories
  10 +RUN apk update --no-cache && apk add --no-cache tzdata
  11 +RUN go env -w GO111MODULE=on \
  12 + && go env -w GOPROXY=https://goproxy.cn,direct \
  13 + && go env -w CGO_ENABLED=0 \
  14 + && go env \
  15 + && go mod tidy \
  16 + && cd cmd/discuss/api \
  17 + && go build -ldflags="-s -w" -o /build/api/${PROJECT} ${PROJECT}.go
  18 +
  19 +FROM alpine:latest
  20 +
  21 +# Define the project name | 定义项目名称
  22 +ARG PROJECT=core
  23 +# Define the config file name | 定义配置文件名
  24 +ARG CONFIG_FILE=core.yaml
  25 +# Define the author | 定义作者
  26 +ARG AUTHOR=785409885@qq.com
  27 +
  28 +LABEL org.opencontainers.image.authors=${AUTHOR}
  29 +
  30 +WORKDIR /app
  31 +ENV PROJECT=${PROJECT}
  32 +ENV CONFIG_FILE=${CONFIG_FILE}
  33 +ENV TZ Asia/Shanghai
  34 +
  35 +COPY --from=builder /usr/share/zoneinfo/Asia/Shanghai /usr/share/zoneinfo/Asia/Shanghai
  36 +COPY --from=builder /build/api/${PROJECT} ./
  37 +COPY --from=builder /build/cmd/discuss/api/etc/${CONFIG_FILE} ./etc/
  38 +
  39 +EXPOSE 8081
  40 +ENTRYPOINT ./${PROJECT} -f etc/${CONFIG_FILE}
@@ -4,7 +4,7 @@ model: @@ -4,7 +4,7 @@ model:
4 4
5 .PHONY: api 5 .PHONY: api
6 api: 6 api:
7 - goctl api go -api .\cmd\discuss\mini\dsl\core.api -dir cmd/discuss/api -style go_zero 7 + goctl api go -api .\cmd\discuss\api\dsl\core.api -dir cmd/discuss/api -style go_zero
8 8
9 .PHONY: swagger 9 .PHONY: swagger
10 swagger: 10 swagger:
  1 +# 说明
  2 +
  3 +### 测试环境
  4 +
  5 + 服务端域名 http://sumifcc-discuss-test.sumifcc.com/
  6 + 日志地址 https://sumifcc-discuss-test.sumifcc.com/v1/log/access
  7 + 管理后台“易数家“前端入口:https://digital-front-platform-dev.fjmaimaimai.com/
  8 + 跳转后的实际管理后台地址: https://sumifcc-x-front-test.sumifcc.com
  9 +
  10 + 样例账号 18860183050 密码 123456
  11 +
  12 +
  13 +### 可设置环境变量
  14 +- DataSource
  15 + 数据库连接,样例
  16 + ``` code
  17 + host=数据库IP地址 user=用户名 password=密码 dbname=数据库名 port=31543 sslmode=disable TimeZone=Asia/Shanghai
  18 + ```
  19 +
1 package main 1 package main
2 2
3 import ( 3 import (
  4 + "context"
4 "flag" 5 "flag"
5 - "github.com/zeromicro/go-zero/core/logx"  
6 - "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db"  
7 - "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"  
8 "net/http" 6 "net/http"
9 "strings" 7 "strings"
10 8
  9 + "github.com/zeromicro/go-zero/rest/httpx"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
  12 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  13 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/xerr"
  14 +
11 "github.com/golang-jwt/jwt/v4/request" 15 "github.com/golang-jwt/jwt/v4/request"
12 "github.com/zeromicro/go-zero/core/conf" 16 "github.com/zeromicro/go-zero/core/conf"
  17 + "github.com/zeromicro/go-zero/core/logx"
13 "github.com/zeromicro/go-zero/rest" 18 "github.com/zeromicro/go-zero/rest"
14 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/config" 19 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/config"
15 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler" 20 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler"
16 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 21 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
17 ) 22 )
18 23
19 -var configFile = flag.String("f", "etc/core.yaml", "the config file") 24 +var configFile = flag.String("f", "cmd/discuss/api/etc/core.yaml", "the config file")
20 25
21 func main() { 26 func main() {
  27 + // 配置加载
22 flag.Parse() 28 flag.Parse()
23 -  
24 var c config.Config 29 var c config.Config
25 conf.MustLoad(*configFile, &c) 30 conf.MustLoad(*configFile, &c)
26 31
27 - // 默认的token头 Authorization 修改未 x-token  
28 - request.AuthorizationHeaderExtractor = &request.PostExtractionFilter{  
29 - request.HeaderExtractor{"x-mmm-accesstoken"}, func(tok string) (string, error) {  
30 - // Should be a bearer token  
31 - if len(tok) > 6 && strings.ToUpper(tok[0:7]) == "BEARER " {  
32 - return tok[7:], nil  
33 - }  
34 - return tok, nil  
35 - },  
36 - }  
37 -  
38 - // 初始化Domain里面的配置  
39 - domain.ProjectName = c.Name 32 + // 系统设置
  33 + systemSetup(c)
40 34
  35 + // 服务初始化
41 opts := make([]rest.RunOption, 0) 36 opts := make([]rest.RunOption, 0)
42 - // cors  
43 - opt := rest.WithCustomCors(func(header http.Header) { 37 + opts = append(opts, rest.WithCustomCors(func(header http.Header) {
44 header.Set("Access-Control-Allow-Headers", "*") 38 header.Set("Access-Control-Allow-Headers", "*")
45 }, func(writer http.ResponseWriter) { 39 }, func(writer http.ResponseWriter) {
46 40
47 - })  
48 - opts = append(opts, opt) 41 + }))
  42 + opts = append(opts, rest.WithUnauthorizedCallback(func(w http.ResponseWriter, r *http.Request, err error) {
  43 + if err != nil {
  44 + logx.Debugf("unauthorized: %s \n", err.Error())
  45 + }
  46 + }))
49 47
50 server := rest.MustNewServer(c.RestConf, opts...) 48 server := rest.MustNewServer(c.RestConf, opts...)
51 defer server.Stop() 49 defer server.Stop()
52 -  
53 ctx := svc.NewServiceContext(c) 50 ctx := svc.NewServiceContext(c)
54 handler.RegisterHandlers(server, ctx) 51 handler.RegisterHandlers(server, ctx)
55 52
56 - db.Migrate(ctx.DB) 53 + // 数据迁移
  54 + if c.Migrate {
  55 + db.Migrate(ctx.DB)
  56 + }
57 57
  58 + // 服务启动
58 logx.Infof("Starting server at %s:%d... \n", c.Host, c.Port) 59 logx.Infof("Starting server at %s:%d... \n", c.Host, c.Port)
59 server.Start() 60 server.Start()
60 } 61 }
  62 +
  63 +func systemSetup(c config.Config) {
  64 + // 初始化Domain里面的配置
  65 + domain.ProjectName = c.Name
  66 +
  67 + // 默认的token头 Authorization 修改为 x-mmm-accesstoken
  68 + request.AuthorizationHeaderExtractor = &request.PostExtractionFilter{
  69 + Extractor: request.HeaderExtractor{"x-mmm-accesstoken"},
  70 + Filter: func(tok string) (string, error) {
  71 + // Should be a bearer token
  72 + if len(tok) > 6 && strings.ToUpper(tok[0:7]) == "BEARER " {
  73 + return tok[7:], nil
  74 + }
  75 + return tok, nil
  76 + },
  77 + }
  78 +
  79 + // 系统错误应答包装
  80 + httpx.SetErrorHandlerCtx(func(ctx context.Context, err error) (int, any) {
  81 + return http.StatusOK, result.Error(xerr.ServerCommonError, err.Error())
  82 + })
  83 +
  84 + // 系统成功应答包装
  85 + httpx.SetOkHandler(func(ctx context.Context, a any) any {
  86 + return result.Success(a)
  87 + })
  88 +}
1 -import "core/test.api"  
  1 +syntax = "v1"
  2 +
  3 +import "core/common.api"
  4 +import "core/comment.api"
  5 +import "core/message.api"
  6 +import "core/article_tag.api"
  7 +import "core/user.api"
  8 +import "core/company.api"
  9 +import "core/article_type.api"
  10 +import "core/article.api"
  11 +import "core/role.api"
  12 +import "core/department.api"
  1 +syntax = "v1"
  2 +
  3 +info(
  4 + title: "文章内容处理"
  5 + desc: "编辑处理文章内容"
  6 + author: "author"
  7 + email: "email"
  8 + version: "v1"
  9 +)
  10 +
  11 +// 小程序接口
  12 +@server(
  13 + prefix: v1/mini
  14 + group: article
  15 + middleware: LogRequest
  16 + jwt: MiniAuth
  17 +)
  18 +service Core {
  19 + @doc "小程序创建发布内容"
  20 + @handler MiniCreateArticle
  21 + post /article (MiniArticleCreateRequest) returns (MiniArticleCreateResponse)
  22 + @doc "小程序获取文章内容详情"
  23 + @handler MiniGetArticle
  24 + get /article/:id (MiniArticleGetRequest) returns (MiniArticleGetResponse)
  25 + @doc "小程序获取文章的点赞人员列表"
  26 + @handler MiniUserLikeArticle
  27 + post /article/user_like/list (MiniUserLikeArticleRequest) returns (MiniUserLikeArticleResponse)
  28 + @doc "小程序人员操作点赞文章/评论"
  29 + @handler MiniSetUserLike
  30 + post /article/user_like/set (MiniSetUserLikeRequset) returns (MiniSetUserLikeResponse)
  31 +
  32 + @doc "小程序标记当前人员查看的文章"
  33 + @handler MiniArticleMarkUserRead
  34 + post /article/mark/user_read (MiniArticleMarkUserReadRequest) returns (MiniArticleMarkUserReadResponse)
  35 +
  36 + @doc "小程序获取文章浏览记录"
  37 + @handler MiniArticleMarkList
  38 + post /article/mark/list (MiniArticleMarkListRequest) returns (MiniArticleMarkListResponse)
  39 +
  40 + @doc "小程序获取我发布的文章"
  41 + @handler MiniArticleSearchMe
  42 + post /article/search/me (MiniArticleSearchMeRequest) returns (MiniArticleSearchMeResponse)
  43 +
  44 + @doc "小程序创建文章进草稿箱"
  45 + @handler MiniCreateArticleDraft
  46 + post /article_draft (MiniArticleDraftCreateRequest) returns (MiniArticleDraftCreateResponse)
  47 +
  48 + @doc "小程序更新文章草稿"
  49 + @handler MiniUpdateArticleDraft
  50 + put /article_draft (MiniArticleDraftUpdateRequest) returns (MiniArticleDraftUpdateResponse)
  51 +
  52 + @doc "小程序获取我的草稿箱列表"
  53 + @handler MiniSearchArticleDraftMe
  54 + post /article_draft/search/me (MiniArticleDraftSearchMeRequest) returns (MiniArticleDraftSearchMeResponse)
  55 +
  56 + @doc "小程序获取我的草稿内容"
  57 + @handler MiniGetArticleDraftMe
  58 + get /article_draft/me/:id (MiniArticleDraftGetMeRequest) returns (MiniArticleDraftGetMeResponse)
  59 +
  60 + @doc "小程序删除我的草稿内容"
  61 + @handler MiniDeleteArticleDraftMe
  62 + delete /article_draft/me/:id (MiniArticleDraftDeleteMeRequest) returns (MiniArticleDraftDeleteMeResponse)
  63 +
  64 + @doc "小程序获取文章的编辑记录"
  65 + @handler MiniArticleBackupSearch
  66 + post /article_backup/search (MiniArticleBackupSearchRequest) returns (MiniArticleBackupSearchResponse)
  67 +
  68 +
  69 + @doc "小程序设置文章的定性标签"
  70 + @handler MiniArticleSetTag
  71 + post /article/set_tag (MiniArticleSetTagRequest) returns (MiniArticleSetTagResponse)
  72 +
  73 + @doc "小程序所有的定性标签"
  74 + @handler MiniAllArticleTag
  75 + get /article_tag/list/all (MiniAllArticleTagRequest) returns (MiniAllArticleTagResponse)
  76 +
  77 + @doc "小程序首页数据展示"
  78 + @handler MiniShowHomePage
  79 + get /show/home_page (MiniHomePageRequest) returns (MiniHomePageResponse)
  80 +
  81 + @doc "小程序首页搜索文章"
  82 + @handler MiniSearchArticlePage
  83 + post /show/search_article (MiniSearchArticleRequest) returns (MiniSearchArticleResponse)
  84 +}
  85 +
  86 +// 管理后台接口
  87 +@server(
  88 + prefix: v1/system
  89 + group: article
  90 + middleware: LoginStatusCheck,LogRequest
  91 + jwt: SystemAuth
  92 +)
  93 +service Core {
  94 + @doc "管理后台获取文章内容详情"
  95 + @handler SystemGetArticle
  96 + get /article/:id (SystemArticleGetRequest) returns (SystemArticleGetResponse)
  97 +
  98 + @doc "管理后台获取文章列表"
  99 + @handler SystemSearchArticle
  100 + post /article/search (SystemArticleSearchRequest) returns (SystemArticleSearchResponse)
  101 +
  102 + @doc "管理后台编辑帖子"
  103 + @handler SystemUpdateArticle
  104 + put /article (SystemArticleUpdateRequest) returns (SystemArticleUpdateResponse)
  105 +
  106 + @doc "管理后台编辑历史"
  107 + @handler SystemHistoryArticle
  108 + post /article/history (SystemArticleHistoryRequest) returns (SystemArticleHistoryResponse)
  109 +
  110 + @doc "管理后台帖子历史详情"
  111 + @handler SystemArticleGetHistory
  112 + get /article/history/:id (SystemArticleGetHistoryRequest) returns (SystemArticleGetHistoryResponse)
  113 +
  114 + @doc "管理后台获取我发布的文章"
  115 + @handler SystemArticleSearchMe
  116 + post /article/search/me (SystemArticleSearchMeRequest) returns (SystemArticleSearchMeResponse)
  117 +
  118 + @doc "管理后台文章恢复"
  119 + @handler SystemArticleRestore
  120 + post /article/restore (SystemArticleRestoreRequest) returns (SystemArticleRestoreResponse)
  121 +}
  1 +syntax = "v1"
  2 +
  3 +info(
  4 + title: "后台编辑标签"
  5 + desc: "编辑处理标签信息"
  6 + author: "author"
  7 + email: "email"
  8 + version: "v1"
  9 +)
  10 +
  11 +@server(
  12 + prefix: v1/system
  13 + group: tags
  14 + middleware: LoginStatusCheck,LogRequest
  15 + jwt: SystemAuth
  16 +)
  17 +service Core {
  18 + @doc "后台创建文章标签"
  19 + @handler CreateTag
  20 + post /article_tag (TagCreateRequest) returns (TagCreateResponse)
  21 +
  22 + @doc "后台编辑文章标签"
  23 + @handler EditTag
  24 + put /article_tag (TagEditRequest) returns (TagEditResponse)
  25 +
  26 + @doc "后台获取文章标签"
  27 + @handler GetTag
  28 + get /article_tag/:id (TagGetRequest) returns (TagGetResponse)
  29 +
  30 + @doc "后台删除文章标签"
  31 + @handler DeleteTag
  32 + delete /article_tag/:id (TagDeleteRequest) returns (TagDeleteResponse)
  33 +
  34 + @doc "后台搜索标签"
  35 + @handler SearchTag
  36 + post /article_tag/search (TagListRequest) returns (TagListResponse)
  37 +
  38 + @doc "后台标签下拉列表"
  39 + @handler Options
  40 + get /article_tag/options (TagOptionsRequest) returns (TagOptionsResponse)
  41 +}
  42 +
  43 +// 创建标签
  44 +type (
  45 + TagCreateRequest {
  46 + CompanyId int64 `json:",optional"`
  47 + Image string `json:"image"`
  48 + Name string `json:"name"` // 标签名称
  49 + Category string `json:"category"` // 标签分类
  50 + Remark string `json:"remark,optional"` // 备注
  51 + Other string `json:"other,optional"`
  52 + SortBy int `json:"sortBy,optional"` //排序
  53 + }
  54 +
  55 + TagCreateResponse {
  56 + Id int64 `json:"id"`
  57 + }
  58 +)
  59 +
  60 +// 编辑标签
  61 +type (
  62 + TagEditRequest {
  63 + Id int64 `json:"id"`
  64 + CompanyId int64 `json:",optional"`
  65 + Image string `json:"image"`
  66 + Name string `json:"name"` // 标签名称
  67 + Category string `json:"category"` // 标签分类
  68 + Remark string `json:"remark,optional"` // 备注
  69 + Other string `json:"other,optional"`
  70 + SortBy int `json:"sortBy,optional"` // 排序
  71 + }
  72 +
  73 + TagEditResponse {
  74 + Id int64 `json:"id"`
  75 + }
  76 +)
  77 +
  78 +// 获取标签详情
  79 +type (
  80 + TagGetRequest {
  81 + Id int64 `path:"id"`
  82 + CompanyId int64 `path:",optional"`
  83 + }
  84 + TagGetResponse {
  85 + Id int64 `json:"id"`
  86 + Image string `json:"image"`
  87 + Name string `json:"name"` // 标签名称
  88 + Category string `json:"category"` // 标签分类
  89 + Remark string `json:"remark"` // 备注
  90 + Other string `json:"other"`
  91 + SortBy int `json:"sortBy,optional"` // 排序
  92 + }
  93 +)
  94 +
  95 +//标签列表
  96 +type (
  97 + TagListRequest {
  98 + Page int `json:"page"`
  99 + Size int `json:"size"`
  100 + CompanyId int64 `json:",optional"`
  101 + TagName string `json:"tagName,optional"`
  102 + Category string `json:"category,optional"`
  103 + Remark string `json:"remark,optional"`
  104 + }
  105 + TagListResponse {
  106 + Total int64 `json:"total"`
  107 + List []TagItem `json:"list"`
  108 + }
  109 + TagItem {
  110 + Id int64 `json:"id"`
  111 + Image string `json:"image"`
  112 + Name string `json:"name"` // 标签名称
  113 + Category string `json:"category"` // 标签分类
  114 + Remark string `json:"remark"` // 备注
  115 + CreatedAt int64 `json:"createdAt"`
  116 + SortBy int `json:"sortBy,optional"` // 排序
  117 + }
  118 +)
  119 +
  120 +//删除标签
  121 +type (
  122 + TagDeleteRequest {
  123 + Id int64 `path:"id"`
  124 + CompanyId int64 `path:",optional"`
  125 + }
  126 + TagDeleteResponse {
  127 + Id int64 `json:"id"`
  128 + }
  129 +)
  130 +
  131 +//标签下拉列表
  132 +type (
  133 + TagOptionsRequest {
  134 + CompanyId int64 `path:",optional"` // 公司ID
  135 + }
  136 + TagOptionsResponse {
  137 + Options []TagOptions `json:"options"`
  138 + }
  139 + TagOptions {
  140 + Label string `json:"label"` // 分组名称
  141 + Options []TagOptionValue `json:"options"`
  142 + }
  143 + TagOptionValue {
  144 + Label string `json:"label"` // 名称
  145 + Value int64 `json:"value"` // 标签ID
  146 + }
  147 +)
  1 +syntax = "v1"
  2 +
  3 +// 坐标地点描述
  4 +type Location {
  5 + Longitude float64 `json:"longitude,optional"` //经度
  6 + Latitude float64 `json:"latitude,optional"` //纬度
  7 + Descript string `json:"descript,optional"` //地点描述
  8 +}
  9 +
  10 +
  11 +type Video {
  12 + Url string `json:"url"` //视频文件的地址
  13 + Cover string `json:"cover,optional"` //封面
  14 + Width int `json:"width,optional"` //封面图片宽
  15 + Height int `json:"height,optional"` //封面图片长
  16 +}
  17 +
  18 +
  19 +// 人员的简单展示信息
  20 +type ArticleAuthor {
  21 + Id int64 `json:"id"` // 人员id
  22 + Name string `json:"name"` // 人员的名字
  23 + Avatar string `json:"avatar"` // 人员头像URL
  24 + Position string `json:"position"` // 职位
  25 + Company string `json:"company"` // 公司
  26 +}
  27 +
  28 +//小程序端创建发布文章
  29 +type (
  30 + MiniArticleCreateRequest {
  31 + Title string `json:"title"` //标题
  32 + Section []string `json:"section"` //文章的文本内容
  33 + AuthorId int64 `json:"authorId,optional"` //发布人id
  34 + Images []string `json:"images,optional"` //图片
  35 + WhoRead []int64 `json:"whoRead,optional"` //谁可查看
  36 + WhoReview []int64 `json:"whoReview,optional"` //谁可评论
  37 + Location Location `json:"location,optional"` //定位坐标
  38 + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
  39 + }
  40 + MiniArticleCreateResponse {
  41 + Id int64 `json:"id"`
  42 + }
  43 +)
  44 +
  45 +//小程序端查看文章的详情
  46 +type (
  47 + MiniArticleGetRequest {
  48 + Id int64 `path:"id"` //id
  49 + CompanyId int64 `path:",optional"` //当前公司
  50 + UserId int `path:",optional"` //当前用户
  51 + }
  52 + MiniArticleGetResponse {
  53 + Id int64 `json:"id"` //id
  54 + Title string `json:"title"` //标题
  55 + AuthorId int64 `json:"authorId"` //发布人id
  56 + Author ArticleAuthor `json:"author"` //发布人
  57 + CreatedAt int64 `json:"createdAt"` //文章的发布时间
  58 + Section []ArticleSection `json:"section"` //文章的文本内容
  59 + Images []string `json:"images"` //图片
  60 + Videos []Video `json:"videos"` //视频
  61 + WhoRead []int64 `json:"whoRead"` //谁可查看
  62 + WhoReview []int64 `json:"whoReview"` //谁可评论
  63 + Location Location `json:"location"` //定位坐标
  64 + CountLove int `json:"countLove"` // 点赞数量
  65 + CountComment int `json:"countComment"` // 评论数量
  66 + CountRead int `json:"countRead"` // 浏览数量
  67 + Show int `json:"show"` // 评论的展示状态(1显示、2不显示)
  68 + Edit int `json:"edit"` // 文章是否存在变更记录 (0 不存在 1存在)
  69 + MeLoveFlag int `json:"meLoveFlag"` // 当前人员对文章的点赞标识 (0 没有点赞 1有点赞)
  70 + MeFollowFlag int `json:"meFollowFlag"` // 当前人员对作者的关注标识 (0 没有关注 1有关注)
  71 + Tags []string `json:"tags"` // 文章的标签
  72 + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
  73 + }
  74 + ArticleSection {
  75 + Id int64 `json:"id"` //段落id
  76 + Content string `json:"content"` // 文本内容
  77 + SortBy int `json:"sortBy"` // 排序
  78 + TotalComment int `json:"totalComment"` // 评论的数量
  79 + }
  80 +)
  81 +
  82 +// 小程序获取我的发文章记录
  83 +type (
  84 + MiniArticleSearchMeRequest {
  85 + AuthorId int64 `json:",optional"`
  86 + CompanyId int64 `json:",optional"`
  87 + Page int `json:"page"`
  88 + Size int `json:"size"`
  89 + }
  90 +
  91 + MiniArticleSearchMeResponse {
  92 + Total int `json:"total"`
  93 + List []ArticleSearchMe `json:"list"`
  94 + }
  95 +
  96 + ArticleSearchMe {
  97 + Id int64 `json:"id"` //id
  98 + Title string `json:"title"` //标题
  99 + Images []string `json:"images"` //图片
  100 + CreatedAt int64 `json:"createdAt"` //文章的创建日期
  101 + CountLove int `json:"countLove"` //点赞数量
  102 + CountComment int `json:"countComment"` //评论数量
  103 + CountRead int `json:"countRead"` //浏览数量
  104 + Show int `json:"show"` //是否隐藏 [0显示、1不显示]
  105 + }
  106 +
  107 + SystemArticleSearchMeRequest {
  108 + Page int `json:"page"`
  109 + Size int `json:"size"`
  110 + AuthorId int64 `json:"authorId"` // 用户
  111 + BeginTime int64 `json:"beginTime,optional"` // 开始时间
  112 + EndTime int64 `json:"endTime,optional"` // 结束时间
  113 + }
  114 + SystemArticleSearchMeResponse {
  115 + Total int `json:"total"`
  116 + List []ArticleSearchMe `json:"list"`
  117 + }
  118 +)
  119 +
  120 +//小程序端获取文章有哪些人进行了点赞
  121 +type (
  122 + MiniUserLikeArticleRequest {
  123 + ArticleId int64 `json:"articleId"` // 文章id
  124 + CompanyId int64 `json:",optional"` //公司id
  125 + Page int `json:"page"` //分页,第几页
  126 + Size int `json:"size"` //分页,每页几条
  127 + }
  128 + MiniUserLikeArticleResponse {
  129 + Total int64 `json:"total"` //总数
  130 + List []WhichUserLikeArticle `json:"list"` //列表
  131 + }
  132 + WhichUserLikeArticle {
  133 + ArticleId int64 `json:"articleId"` // 文章id
  134 + UserId int64 `json:"userId"` // 人员id
  135 + Name string `json:"name"` // 人员名称
  136 + Avatar string `json:"avatar"` // 人员头像
  137 + Position string `json:"position"` // 职位
  138 + CreatedAt int64 `json:"createdAt"` // 点赞记录的时间
  139 + }
  140 +)
  141 +
  142 +// 小程序端人员点赞文章/评论
  143 +type (
  144 + MiniSetUserLikeRequset {
  145 + ArticleId int64 `json:"articleId"` //文章id
  146 + CommentId int64 `json:"commentId,optional"` //评论id
  147 + UserId int64 `json:",optional"` //操作人
  148 + Flag int `json:"flag"` //点赞标志 1、点赞 2 、取消点赞
  149 + }
  150 + MiniSetUserLikeResponse {
  151 + ArticleId int64 `json:"articleId"` //文章id
  152 + CommentId int64 `json:"commentId"` //评论id
  153 + Count int `json:"count"` //现有的点赞数量
  154 + }
  155 +)
  156 +
  157 +// 小程序端获取文章的编辑记录
  158 +
  159 +type (
  160 + MiniArticleBackupSearchRequest {
  161 + Page int `json:"page"`
  162 + Size int `json:"size"`
  163 + ArticleId int `json:"articleId"`
  164 + CompanyId int64 `json:",optional"` // 服务端自动获取
  165 + }
  166 + MiniArticleBackupSearchResponse {
  167 + Total int64 `json:"total"`
  168 + List []MiniArticleBackupItem `json:"list"`
  169 + }
  170 + MiniArticleBackupItem {
  171 + Id int64 `json:"id"`
  172 + Title string `json:"title"`
  173 + Content string `json:"content"`
  174 + Images []string `json:"images"`
  175 + CreatedAt int64 `json:"createdAt"`
  176 + Location Location `json:"location"`
  177 + }
  178 +)
  179 +// 标记人员浏览了那个文章
  180 +type (
  181 + MiniArticleMarkUserReadRequest {
  182 + UserId int64 `json:",optional"` // 当前操作人
  183 + CompanyId int64 `json:",optional"` // 当前公司
  184 + ArticleId int64 `json:"articleId"` // 文章id
  185 + }
  186 +
  187 + MiniArticleMarkUserReadResponse {
  188 + Id int64 `json:"id"`
  189 + }
  190 +)
  191 +
  192 +//小程序端创建文章到草稿箱
  193 +type (
  194 + MiniArticleDraftCreateRequest {
  195 + CompanyId int64 `json:",optional"`
  196 + AuthorId int64 `json:",optional"` // 发布人
  197 + Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
  198 + Section []string `json:"section"` // 填写的内容
  199 + Title string `json:"title"` // 标题
  200 + Images []string `json:"images"` // 图片
  201 + WhoRead []int64 `json:"whoRead"` // 谁可以看
  202 + WhoReview []int64 `json:"whoReview"` // 评论人
  203 + Location Location `json:"location"` // 坐标
  204 + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
  205 + }
  206 +
  207 + MiniArticleDraftCreateResponse {
  208 + Id int64 `json:"id"`
  209 + }
  210 +)
  211 +
  212 +//小程序端更新文章草稿
  213 +type (
  214 + MiniArticleDraftUpdateRequest {
  215 + Id int64 `json:"id"`
  216 + CompanyId int64 `json:",optional"`
  217 + AuthorId int64 `json:",optional"` // 发布人
  218 + Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
  219 + Section []string `json:"section"` // 填写的内容
  220 + Title string `json:"title"` // 标题
  221 + Images []string `json:"images"` // 图片
  222 + WhoRead []int64 `json:"whoRead"` // 谁可以看
  223 + WhoReview []int64 `json:"whoReview"` // 评论人
  224 + Location Location `json:"location"` // 坐标
  225 + MatchUrl map[string]string `json:"matchUrl"` // 匹配文章内容中的url文本
  226 + }
  227 +
  228 + MiniArticleDraftUpdateResponse {
  229 + Id int64 `json:"id"`
  230 + }
  231 +)
  232 +
  233 +//小程序端获取我的草稿列表
  234 +type (
  235 + MiniArticleDraftSearchMeRequest {
  236 + CompanyId int64 `json:",optional"` // 公司id
  237 + AuthorId int64 `json:",optional"` // 发布人
  238 + Page int `json:"page"`
  239 + Size int `json:"size"`
  240 + }
  241 +
  242 + MiniArticleDraftSearchMeResponse {
  243 + Total int64 `json:"total"`
  244 + List []MiniArticleDraftItem `json:"list"`
  245 + }
  246 + MiniArticleDraftItem {
  247 + Id int64 `json:"id"`
  248 + Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
  249 + Section []string `json:"section"` // 填写的内容
  250 + Title string `json:"title"` // 标题
  251 + Images []string `json:"images"` // 图片
  252 + CreatedAt int64 `json:"createdAt"`//
  253 + MatchUrl map[string]string `json:"matchUrl"` //匹配内容中的url文本
  254 + }
  255 +)
  256 +
  257 +//小程序端获取我的草稿内容
  258 +type (
  259 + MiniArticleDraftGetMeRequest {
  260 + CompanyId int64 `path:",optional"` // 公司id
  261 + AuthorId int64 `path:",optional"` // 发布人
  262 + Id int64 `path:"id"`
  263 + }
  264 +
  265 + MiniArticleDraftGetMeResponse {
  266 + Id int64 `json:"id"` //
  267 + Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
  268 + Section []string `json:"section"` // 填写的内容
  269 + Title string `json:"title"` // 标题
  270 + Images []string `json:"images"` // 图片
  271 + WhoRead []int64 `json:"whoRead"` // 谁可以看
  272 + WhoReview []int64 `json:"whoReview"` // 评论人
  273 + Location Location `json:"location"` // 坐标
  274 + MatchUrl map[string]string `json:"matchUrl"` //
  275 + }
  276 +)
  277 +
  278 +// 小程序端删除我的草稿内容
  279 +type (
  280 + MiniArticleDraftDeleteMeRequest {
  281 + CompanyId int64 `path:",optional"` // 公司id
  282 + AuthorId int64 `path:",optional"` // 发布人
  283 + Id int64 `path:"id"`
  284 + }
  285 +
  286 + MiniArticleDraftDeleteMeResponse {
  287 + Id int64 `json:"id"` //
  288 + }
  289 +)
  290 +// 小程序端获取我的浏览记录
  291 +type (
  292 + MiniArticleMarkListRequest {
  293 + Page int `json:"page"`
  294 + Size int `json:"size"`
  295 + }
  296 +
  297 + MiniArticleMarkListResponse {
  298 + Total int64 `json:"total"`
  299 + List []MiniArticleMarkItem `json:"list"`
  300 + }
  301 +
  302 + MiniArticleMarkItem {
  303 + Id int64 `json:"id"`
  304 + CompanyId int64 `json:"companyId"`
  305 + UserId int64 `json:"userId"`
  306 + ArticleId int64 `json:"articleId"`
  307 + Title string `json:"title"`
  308 + Author SimpleUser `json:"author"` // 发布人
  309 + UpdatedAt int64 `json:"updatedAt"`
  310 + }
  311 +)
  312 +
  313 +//小程序端设置文章的定性标签
  314 +type (
  315 + MiniArticleSetTagRequest {
  316 + CompanyId int64 `json:",optional"` // 公司id
  317 + UserId int64 `json:",optional"` // 公司id
  318 + ArticleId int64 `json:"articleId"` // 文章id
  319 + TagId []int64 `json:"tagId"` // 标签id
  320 + }
  321 + MiniArticleSetTagResponse {
  322 + Id []int64 `json:"id"`
  323 + }
  324 +)
  325 +
  326 +//小程序端获取所有的定性标签
  327 +type (
  328 + MiniAllArticleTagRequest {
  329 + CompanyId int64 `json:",optional"` // 公司id
  330 + UserId int64 `json:",optional"` // 公司id
  331 + }
  332 + MiniAllArticleTagResponse {
  333 + TagGroup []ArticleTagGroup `json:"tagGroup"`
  334 + }
  335 + ArticleTagGroup {
  336 + Category string `json:"category"`
  337 + Tags []ArticleTagItem `json:"tags"`
  338 + }
  339 + ArticleTagItem {
  340 + Id int64 `json:"id"`
  341 + Category string `json:"category"`
  342 + Name string `json:"name"`
  343 + Image string `json:"image"`
  344 + SortBy int `json:"sortBy"`
  345 + }
  346 +)
  347 +
  348 +//管理后台获取文章详情
  349 +type (
  350 + SystemArticleGetRequest {
  351 + Id int64 `path:"id"` //id
  352 + CompanyId int64 `path:",optional"`
  353 + }
  354 +
  355 + UserShowName {
  356 + Id int `json:"id"`
  357 + Name string `json:"name"`
  358 + }
  359 +
  360 + SystemArticleGetResponse {
  361 + Id int64 `json:"id"` // id
  362 + Title string `json:"title"` // 标题
  363 + AuthorId int64 `json:"authorId"` // 发布人id
  364 + Author ArticleAuthor `json:"author"` // 发布人
  365 + CreatedAt int64 `json:"createdAt"` // 文章的发布时间
  366 + Section []ArticleSection `json:"section"` // 文章的文本内容
  367 + Images []string `json:"images"` // 图片
  368 + Videos []Video `json:"videos"` // 视频
  369 + WhoRead []int64 `json:"whoRead"` // 谁可查看
  370 + WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看
  371 + WhoReview []int64 `json:"whoReview"` // 谁可评论
  372 + WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论
  373 + Location Location `json:"location"` // 定位坐标
  374 + CountLove int `json:"countLove"` // 点赞数量
  375 + CountComment int `json:"countComment"` // 评论数量
  376 + CountRead int `json:"countRead"` // 浏览数量
  377 + Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
  378 + Tags []ArticleTagItem `json:"tags"` //标签
  379 + TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人]
  380 + }
  381 +)
  382 +
  383 +//管理后台获取文章列表
  384 +type (
  385 + SystemArticleSearchRequest {
  386 + CompanyId int64 `json:"companyId,optional"`
  387 + Title string `json:"title,optional"` //标题
  388 + Author int64 `json:"author,optional"` //发布人
  389 + BeginTime int64 `json:"beginTime,optional"` //开始时间
  390 + EndTime int64 `json:"endTime,optional"` //结束时间
  391 + Tags []int64 `json:"tags,optional"` //标签
  392 + Page int `json:"page"` //页码
  393 + Size int `json:"size"` //每页行数
  394 + }
  395 +
  396 + SystemArticleSearchResponse {
  397 + Total int `json:"total"`
  398 + List []SystemArticleSearch `json:"list"`
  399 + }
  400 + SystemArticleSearch {
  401 + Id int64 `json:"id"` //id
  402 + Title string `json:"title"` //标题
  403 + AuthorId int64 `json:"authorId"` //发布人ID
  404 + Author string `json:"author"` //发布人
  405 + Images []string `json:"images"` //图片
  406 + CreatedAt int64 `json:"createdAt"` //文章的创建日期
  407 + CountLove int `json:"countLove"` //点赞数量
  408 + CountComment int `json:"countComment"` //评论数量
  409 + Show int `json:"show"` //是否隐藏 [0显示、1不显示]
  410 + Tags []string `json:"tags"` //标签
  411 + TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人]
  412 + }
  413 +)
  414 +// 管理后台编辑文章
  415 +type (
  416 + //编辑
  417 + SystemArticleUpdateRequest {
  418 + Id int64 `json:"id"`
  419 + CompanyId int64 `json:"companyId,optional"`
  420 + Template int `json:"template"` // 使用哪个模板进行编辑 0、无 1、演绎式 2、归纳式
  421 + Section []ArticleSection `json:"section"` // 填写的内容
  422 + Title string `json:"title"` // 标题
  423 + Images []string `json:"images"` // 图片
  424 + Videos []Video `json:"video"` // 视频
  425 + WhoRead []int64 `json:"whoRead"` // 谁可以看
  426 + WhoReview []int64 `json:"whoReview"` // 评论人
  427 + TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人]
  428 + Tags []int64 `json:"tags"` // 标签
  429 + AccessToken string `header:"x-mmm-accesstoken"` // 授权token
  430 + }
  431 + SystemArticleUpdateResponse {
  432 + Id int64 `json:"id"` //id
  433 + Title string `json:"title"` //标题
  434 + Author string `json:"author"` //发布人
  435 + Images []string `json:"images"` //图片
  436 + CreatedAt int64 `json:"createdAt"` //文章的创建日期
  437 + CountLove int `json:"countLove"` //点赞数量
  438 + Videos []Video `json:"video"` // 视频
  439 + CountComment int `json:"countComment"` //评论数量
  440 + Show int `json:"show"` //是否隐藏 [0显示、1不显示]
  441 + Tags []int64 `json:"tags"` //标签
  442 + TargetUser int `json:"targetUser"` //分发方式 [0分发给所有人、1分发给指定的人]
  443 + }
  444 +)
  445 +// 管理后台编辑历史列表
  446 +type (
  447 + //历史
  448 + SystemArticleHistoryRequest {
  449 + ArticleId int64 `json:"articleId"` //文章ID
  450 + Author string `json:"author,optional"` //发布人
  451 + BeginTime int64 `json:"beginTime,optional"` //开始时间
  452 + EndTime int64 `json:"endTime,optional"` //结束时间
  453 + Page int `json:"page"` //页码
  454 + Size int `json:"size"` //每页行数
  455 + }
  456 + SystemArticleHistoryResponse {
  457 + Total int `json:"total"`
  458 + List []SystemArticleHistory `json:"list"`
  459 + }
  460 + SystemArticleHistory {
  461 + Id int64 `json:"id"` //id
  462 + Author string `json:"author"` //编辑人
  463 + Action string `json:"action"` //编辑类型
  464 + UpdatedAt int64 `json:"updatedAt"` //编辑时间
  465 + }
  466 +)
  467 +// 管理后台历史记录详情
  468 +type (
  469 + SystemArticleGetHistoryRequest {
  470 + Id int64 `path:"id"` //id
  471 + CompanyId int64 `path:",optional"`
  472 + }
  473 + SystemArticleGetHistoryResponse {
  474 + Id int64 `json:"id"` // id
  475 + ArticleId int64 `json:"articleId"` // 文章ID
  476 + Title string `json:"title"` // 标题
  477 + CreatedAt int64 `json:"createdAt"` // 文章的发布时间
  478 + Section []ArticleSection `json:"section"` // 文章的文本内容
  479 + Images []string `json:"images"` // 图片
  480 + Videos []Video `json:"video"`
  481 + WhoRead []int64 `json:"whoRead"` // 谁可查看
  482 + WhoReadInfo []UserShowName `json:"whoReadInfo"` // 谁可查看
  483 + WhoReview []int64 `json:"whoReview"` // 谁可评论
  484 + WhoReviewInfo []UserShowName `json:"whoReviewInfo"` // 谁可评论
  485 + Location Location `json:"location"` // 定位坐标
  486 + TargetUser int `json:"targetUser"` // 分发方式 [0分发给所有人、1分发给指定的人]
  487 + Tags []int64 `json:"tags"` // 标签
  488 + }
  489 +)
  490 +// 管理后台文章恢复
  491 +type (
  492 + SystemArticleRestoreRequest {
  493 + Id int64 `json:"id"` //ID
  494 + AccessToken string `header:"x-mmm-accesstoken"` // 授权token
  495 + }
  496 + SystemArticleRestoreResponse {
  497 + Id int64 `json:"id"` //ID
  498 + ArticleId int64 `json:"articleId"` //文章ID
  499 + }
  500 +)
  501 +
  502 +//小程序端 首页数据展示
  503 +// 统计各标签下的文章数量,和已被人员阅读的数量
  504 +type (
  505 + MiniHomePageRequest {
  506 + CompanyId int64 `path:",optional"`
  507 + UserId int64 `path:",optional"`
  508 + }
  509 + MiniHomePageResponse {
  510 + TagCategory []string `json:"tagCategory"`
  511 + Tags []ArticleTagCount `json:"tags"`
  512 + }
  513 + ArticleTagCount {
  514 + TagCategory string `json:"tagCategory"` // 标签分组
  515 + TagId int64 `json:"tagId"` // 标签id
  516 + TagImage string `json:"tagImage"` // 对应的图标
  517 + TagName string `json:"tagName"` // 标签名称
  518 + TagRemark string `json:"tagRemark"` // 标签备注
  519 + TotalArticle int `json:"totalArticle"` // 总的文章数量
  520 + ReadArticle int `json:"readArticle"` // 已读的标签数量
  521 + SortBy int `json:"sortBy"` // 排序
  522 + }
  523 +)
  524 +
  525 +//小程序首页搜索文章
  526 +type (
  527 + MiniSearchArticleRequest {
  528 + Page int `json:"page"`
  529 + Size int `json:"size"`
  530 + CompanyId int64 `json:",optional"`
  531 + UserId int64 `json:",optional"`
  532 + TagCategory string `json:"tagCategory,optional"`
  533 + TagId int64 `json:"tagId,optional"`
  534 + BeginTime int64 `json:"beginTime,optional"`
  535 + EndTime int64 `json:"endTime,optional"`
  536 + SearchWord string `json:"searchWord,optional"`
  537 + }
  538 + //
  539 + MiniSearchArticleResponse {
  540 + Total int `json:"total"`
  541 + List []MiniSearchArticleItem `json:"list"`
  542 + }
  543 + //
  544 + MiniSearchArticleItem{
  545 + ArticleId int64 `json:"articleId"`
  546 + Title string `json:"title"`
  547 + AuthorId int64 `json:"authorId"`
  548 + Author string `json:"author"` // 发布人
  549 + Avatar string `json:"avatar"`// 发布人的头像
  550 + Images []string `json:"images"`
  551 + CreatedAt int64 `json:"createdAt"`
  552 + MeReadFlag int `json:"meReadFlag"` //已读标识 [0:未读] [1:已读]
  553 + }
  554 +)
  1 +syntax = "v1"
  2 +
  3 +info(
  4 + title: "评论相关"
  5 + desc: "编辑处理文章的评论"
  6 + author: "author"
  7 + email: "email"
  8 + version: "v1"
  9 +)
  10 +
  11 +// 小程序接口
  12 +@server(
  13 + prefix: v1/mini
  14 + group: comment
  15 + middleware: LogRequest
  16 + jwt: MiniAuth
  17 +)
  18 +service Core {
  19 + @doc "小程序填写文章的评论"
  20 + @handler MiniCreateArticleComment
  21 + post /article_comment (MiniCreateArticleCommentRequest) returns (MiniCreateArticleCommentResponse)
  22 +
  23 + @doc "小程序展示文章的评论列表"
  24 + @handler MiniListArticleComment
  25 + post /article_comment/list (MiniListArticleCommentRequest) returns (MiniListArticleCommentResponse)
  26 +
  27 + @doc "小程序展示评论对应的一级回复列表"
  28 + @handler MiniListReplyArticleComment
  29 + post /article_comment/list_reply (MiniListReplyArticleCommentRequest) returns (MiniListReplyArticleCommentResponse)
  30 +
  31 + @doc "小程序展示文章的评论列表TOP5"
  32 + @handler MiniTop5ArticleComment
  33 + post /article_comment/top5 (MiniTop5ArticleCommentRequest) returns (MiniTop5ArticleCommentResponse)
  34 +
  35 + @doc "小程序展示单个文章的评论"
  36 + @handler MiniGetArticleComment
  37 + get /article_comment/:id (MiniGetArticleCommentRequest) returns (MiniGetArticleCommentResponse)
  38 +
  39 + @doc "小程序展示删除文章评论"
  40 + @handler MiniDeleteArticleComment
  41 + delete /article_comment/:id (MiniDeleteArticleCommentRequest) returns (MiniDeleteArticleCommentResponse)
  42 +
  43 + @doc "小程序展示评论时@人可选列表"
  44 + @handler MiniArticleCommentAtWho
  45 + post /article_comment/at_who/list (MiniArticleCommentAtWhoRequest) returns (MiniArticleCommentAtWhoResponse)
  46 +}
  47 +
  48 +// 后台接口
  49 +@server(
  50 + prefix: v1/system
  51 + group: comment
  52 + middleware: LoginStatusCheck,LogRequest
  53 + jwt: SystemAuth
  54 +)
  55 +service Core {
  56 + @doc "小程序获取回复@人可选列表"
  57 + @handler SystemArticleCommentSearchMe
  58 + post /article_comment/search/me (SystemArticleCommentSearchMeRequest) returns (SystemArticleCommentSearchMeResponse)
  59 +
  60 + @doc "管理后台文章评论列表"
  61 + @handler SystemArticleCommentSearch
  62 + post /article_comment/search (SystemArticleCommentSearchRequest) returns (SystemArticleCommentSearchResponse)
  63 +
  64 + @doc "管理后台查看所有的评论"
  65 + @handler SystemListAticleComment
  66 + post /article_comment/list (SystemListCommentRequest)returns (SystemListCommentResponse)
  67 +
  68 + @doc "管理后台评论的详情"
  69 + @handler SystemGetAticleComment
  70 + get /article_comment/:id (SystemGetCommentRequest)returns (SystemGetCommentResponse)
  71 +
  72 + @doc "管理后台变更评论的显示状态"
  73 + @handler SystemEditAticleCommentShow
  74 + post /article_comment/edit_show (SystemEditCommentShowRequest)returns (SystemEditCommentShowResponse)
  75 +
  76 + @doc "管理后台变更评论"
  77 + @handler SystemEditAticleComment
  78 + post /article_comment/edit (SystemEditCommentRequest)returns (SystemEditCommentResponse)
  79 +
  80 + @doc "编辑评论的运营点赞数"
  81 + @handler SystemEditAticleCommentLove
  82 + post /article_comment/edit/love (SystemEditCommentLoveRequest)returns (SystemEditCommentLoveResponse)
  83 +}
  84 +
  85 +//评论的填写人
  86 +type CommentAuthor {
  87 + Id int64 `json:"id"` // 人员id
  88 + Name string `json:"name"` // 人员的名字
  89 + Avatar string `json:"avatar,optional"` // 人员头像URL
  90 + Position string `json:"position,optional"` // 职位
  91 + Company string `json:"company,optional"` // 公司
  92 +}
  93 +
  94 +// 小程序填写文章的评论
  95 +type (
  96 + MiniCreateArticleCommentRequest {
  97 + ArtitcleId int64 `json:"articleId"` // 文章id
  98 + SectionId int64 `json:"sectionId"` // 段落id
  99 + FromUserId int64 `json:",optional"` // 填写文章的人,服务端自动获取
  100 + CompanyId int64 `json:",optional"` // 服务端自动获取
  101 + Pid int64 `json:"pid,optional"` // 回复那个评论的id
  102 + Content string `json:"content"` // 评论的内容
  103 + AtWho []CommentAtWho `json:"atWho,optional"` // 填写评论时@的人
  104 + MatchUrl map[string]string `json:"matchUrl,optional"` // 评论内容中的url文本
  105 + }
  106 +
  107 + CommentAtWho {
  108 + Id int64 `json:"id"`
  109 + Avatar string `json:"avatar,optional"` // 人员头像URL
  110 + Name string `json:"name,optional"`
  111 + FirstLetter string `json:"firstLetter,optional"`
  112 + }
  113 + MiniCreateArticleCommentResponse {
  114 + Id int64 `json:"id"`
  115 + Pid int64 `json:"pid"`
  116 + TopId int64 `json:"topId"`
  117 + ArtitcleId int64 `json:"articleId"` // 文章id
  118 + SectionId int64 `json:"sectionId"` // 段落id
  119 + FromUserId int64 `json:"fromUserId"` // 填写评论的人
  120 + FromUser CommentAuthor `json:"fromUser"` // 填写评论的人
  121 + ToUserId int64 `json:"toUserId"` // 回复哪个人
  122 + ToUser CommentAuthor `json:"toUser"` // 回复哪个人
  123 + SectionContent string `json:"sectionContent"` // 引用的文章内容文本
  124 + CountReply int `json:"countReply"` // 回复数量
  125 + CountUserLove int `json:"countUserLove"` // 用户点赞数量
  126 + CountAdminLove int `json:"countAdminLove"` // 运营点赞数量
  127 + AtWho []CommentAtWho `json:"atWho"` // 填写评论时@的人
  128 + MatchUrl map[string]string `json:"matchUrl"` // 评论内容中的url文本
  129 + CreatedAt int64 `json:"createdAt"` //
  130 + }
  131 +)
  132 +
  133 +// 小程序获取文章的评论列表
  134 +type (
  135 + MiniListArticleCommentRequest {
  136 + Page int `json:"page"`
  137 + Size int `json:"size"`
  138 + CompanyId int64 `json:",optional"`
  139 + UserId int64 `json:",optional"`
  140 + ArticleId int64 `json:"articleId"`
  141 + SectionId int64 `json:"sectionId,optional"`
  142 + }
  143 + MiniListArticleCommentResponse {
  144 + Total int64 `json:"total"`
  145 + List []ArticleCommentAndReply `json:"list"`
  146 + }
  147 +
  148 + ArticleCommentAndReply {
  149 + Comment ArticleCommentItem `json:"comment"` //评论
  150 + Reply []ArticleCommentItem `json:"reply"` //回复的评论
  151 + TotalReply int64 `json:"totalReply"` //回复的评论数量
  152 + }
  153 +
  154 + ArticleCommentItem {
  155 + Id int64 `json:"id"`
  156 + Pid int64 `json:"pid"`
  157 + TopId int64 `json:"topId"`
  158 + ArtitcleId int64 `json:"articleId"` // 文章id
  159 + SectionId int64 `json:"sectionId"` // 段落id
  160 + FromUserId int64 `json:"fromUserId"` // 填写评论的人
  161 + FromUser CommentAuthor `json:"fromUser"` // 填写评论的人
  162 + ToUserId int64 `json:"toUserId"` // 回复哪个人
  163 + ToUser CommentAuthor `json:"toUser"` // 回复哪个人
  164 + SectionContent string `json:"sectionContent"` // 引用的文章内容文本
  165 + CountReply int `json:"countReply"` // 回复数量
  166 + CountUserLove int `json:"countUserLove"` // 用户点赞数量
  167 + CountAdminLove int `json:"countAdminLove"` // 运营点赞数量
  168 + AtWho []CommentAtWho `json:"atWho"` // 填写评论时@的人
  169 + MatchUrl map[string]string `json:"matchUrl"` // 评论内容中的url文本
  170 + CreatedAt int64 `json:"createdAt"` //
  171 + MeLoveFlag int `json:"meLoveFlag"` // 当前人员对评论的点赞标识 (0 没有点赞 1有点赞)
  172 + Content string `json:"content"` // 评论的内容
  173 + }
  174 +)
  175 +
  176 +// 小程序获取单个文章的评论
  177 +type (
  178 + MiniGetArticleCommentRequest {
  179 + CommentId int64 `path:"id"`
  180 + CompanyId int64 `path:",optional"`
  181 + UserId int64 `path:",optional"`
  182 + }
  183 + MiniGetArticleCommentResponse {
  184 + ArticleCommentAndReply
  185 + }
  186 +)
  187 +
  188 +// 小程序删除单个文章的评论
  189 +type (
  190 + MiniDeleteArticleCommentRequest {
  191 + CommentId int64 `path:"id"`
  192 + UserId int64 `path:",optional"`
  193 + CompanyId int64 `path:",optional"`
  194 + }
  195 + MiniDeleteArticleCommentResponse {
  196 + Id int64 `json:"id"`
  197 + }
  198 +)
  199 +
  200 +// 热门前5的评论列表
  201 +type (
  202 + MiniTop5ArticleCommentRequest {
  203 + CompanyId int64 `json:",optional"`
  204 + UserId int64 `json:",optional"`
  205 + ArticleId int64 `json:"articleId"`
  206 + }
  207 +
  208 + MiniTop5ArticleCommentResponse {
  209 + List []ArticleCommentItem `json:"list"`
  210 + }
  211 +)
  212 +
  213 +// 填写评论时选择@人
  214 +type (
  215 + MiniArticleCommentAtWhoRequest {
  216 + CompanyId int64 `json:",optional"`
  217 + UserId int64 `json:",optional"`
  218 + ArticleId int64 `json:"articleId"`
  219 + }
  220 +
  221 + MiniArticleCommentAtWhoResponse {
  222 + List []CommentAtWho `json:"list"`
  223 + }
  224 +)
  225 +
  226 +// 获取评论的回复,只返回一级
  227 +type (
  228 + MiniListReplyArticleCommentRequest {
  229 + CommentId int64 `json:"commentId"`
  230 + UserId int64 `json:",optional"`
  231 + CompanyId int64 `json:",optional"`
  232 + Page int `json:"page"`
  233 + Size int `json:"size"`
  234 + }
  235 +
  236 + MiniListReplyArticleCommentResponse {
  237 + Total int64 `json:"total"`
  238 + List []ArticleCommentItem `json:"list"`
  239 + }
  240 +)
  241 +
  242 +type (
  243 + SystemArticleCommentSearchMeRequest {
  244 + Page int `json:"page"`
  245 + Size int `json:"size"`
  246 + AuthorId int64 `json:"authorId"` // 用户
  247 + BeginTime int64 `json:"beginTime,optional"` // 开始时间
  248 + EndTime int64 `json:"endTime,optional"` // 结束时间
  249 + }
  250 + SystemArticleCommentSearchMeResponse {
  251 + List []ArticleCommentItem `json:"list"`
  252 + Total int64 `json:"total"`
  253 + }
  254 +)
  255 +// 文章里的评论列表
  256 +type (
  257 + SystemArticleCommentSearchRequest {
  258 + Page int `json:"page"`
  259 + Size int `json:"size"`
  260 + ArticleId int64 `json:"articleId"` // 文章ID
  261 + TopId int64 `json:"topId,optional"` // 文章顶层ID
  262 + Author int64 `json:"author,optional"` // 用户
  263 + Show int `json:"show,optional"` // 显示状态
  264 + BeginTime int64 `json:"beginTime,optional"` // 开始时间
  265 + EndTime int64 `json:"endTime,optional"` // 结束时间
  266 + }
  267 + SystemArticleCommentSearchResponse {
  268 + Total int64 `json:"total"`
  269 + List []SystemArticleCommentSearchItem `json:"list"`
  270 + }
  271 + SystemArticleCommentSearchItem {
  272 + Id int64 `json:"id"`
  273 + Pid int64 `json:"pid"`
  274 + TopId int64 `json:"topId"`
  275 + ArtitcleId int64 `json:"articleId"` // 文章id
  276 + SectionId int64 `json:"sectionId"` // 段落id
  277 + FromUserId int64 `json:"fromUserId"` // 填写评论的人
  278 + FromUser CommentAuthor `json:"fromUser"` // 填写评论的人
  279 + CountReply int `json:"countReply"` // 回复数量
  280 + CountUserLove int `json:"countUserLove"` // 用户点赞数量
  281 + CountAdminLove int `json:"countAdminLove"` // 运营点赞数量
  282 + CreatedAt int64 `json:"createdAt"` // 评论时间
  283 + Content string `json:"content"` // 评论的内容
  284 + AtWho []CommentAtWho `json:"atWho"` // 填写评论时@的人
  285 + MatchUrl map[string]string `json:"matchUrl"` // 评论内容中的url文本
  286 + Show int `json:"show"` // 显示状态
  287 + }
  288 +)
  289 +
  290 +// 管理后台 评论管理列表
  291 +type (
  292 + SystemListCommentRequest {
  293 + Page int `json:"page"`
  294 + Size int `json:"size"`
  295 + CompanyId int64 `json:",optional"` //
  296 + TopId int64 `json:"topId,optional"` // 评论的顶层ID
  297 + FromUserId int64 `json:"fromUserId,optional"` // 用户
  298 + Show int `json:"show,optional"` // 显示状态
  299 + BeginTime int64 `json:"beginTime,optional"` // 填写评论的开始时间
  300 + EndTime int64 `json:"endTime,optional"` // 填写评论的结束时间
  301 + ArticleTitle string `json:"articleTitle,optional"` //
  302 + Content string `json:"content,optional"` //
  303 + }
  304 + SystemListCommentResponse {
  305 + Total int `json:"total"`
  306 + List []SystemCommentItem `json:"list"`
  307 + }
  308 + SystemCommentItem {
  309 + Id int64 `json:"id"` //评论id
  310 + Pid int64 `json:"pid"` //
  311 + TopId int64 `json:"topId"` //
  312 + ArticleId int64 `json:"articleId"` //对应的文章id
  313 + ArticleTitle string `json:"articleTitle"` //文章标题
  314 + FromUserId int64 `json:"fromUserId"` //填写评论的人
  315 + FromUser CommentAuthor `json:"fromUser"` //填写评论的人
  316 + CreatedAt int64 `json:"createdAt"` //评论的填写时间
  317 + Content string `json:"content"` //评论的内容
  318 + Show int `json:"show"` //是否展示 [1显示] [2不显示]
  319 + CountReply int `json:"countReplay"` //回复数量
  320 + CountUserLove int `json:"countUserLove"` //用户点赞数量
  321 + CountAdminLove int `json:"countAdminLove"` //运营点赞数量
  322 + }
  323 +)
  324 +
  325 +// 管理后台获取评论详情
  326 +type (
  327 + SystemGetCommentRequest {
  328 + CompanyId int64 `path:",optional"`
  329 + Id int64 `path:"id"`
  330 + }
  331 +
  332 + SystemGetCommentResponse {
  333 + Id int64 `json:"id"` //评论id
  334 + Pid int64 `json:"pid"` //
  335 + TopId int64 `json:"topId"` //
  336 + ArticleId int64 `json:"articleId"` //对应的文章id
  337 + ArticleTitle string `json:"articleTitle"` //文章标题
  338 + FromUserId int64 `json:"fromUserId"` //填写评论的人
  339 + FromUser CommentAuthor `json:"fromUser"` //填写评论的人
  340 + CreatedAt int64 `json:"createdAt"` //评论的填写时间
  341 + SectionContent string `json:"sectionContent"` //引用的段落内容
  342 + Content string `json:"content"` // 评论的内容
  343 + Show int `json:"show"` //是否展示 [1显示] [2不显示]
  344 + CountReply int `json:"countReplay"` //回复数量
  345 + CountUserLove int `json:"countUserLove"` //用户点赞数量
  346 + CountAdminLove int `json:"countAdminLove"` //运营点赞数量
  347 + }
  348 +)
  349 +
  350 +// 管理后台单独设置评论显示隐藏状态
  351 +type (
  352 + SystemEditCommentShowRequest {
  353 + CompanyId int64 `json:",optional"`
  354 + Id []int64 `json:"id"`
  355 + Show int `json:"show"` //[1 显示评论] [2: 隐藏评论]
  356 + }
  357 +
  358 + SystemEditCommentShowResponse {
  359 + Id []int64 `json:"id"`
  360 + }
  361 +)
  362 +
  363 +// 管理后台变更评论
  364 +type (
  365 + SystemEditCommentRequest {
  366 + CompanyId int64 `json:",optional"`
  367 + Id int64 `json:"id"`
  368 + Show int `json:"show"` //[1 显示评论] [2: 隐藏评论]
  369 + Content string `json:"content,optional"`
  370 + CountAdminLove int `json:"countAdminLove,optional"`
  371 + }
  372 +
  373 + SystemEditCommentResponse {
  374 + Id int64 `json:"id"`
  375 + }
  376 +)
  377 +
  378 +// 管理后台变更评论的运营点赞
  379 +type (
  380 + SystemEditCommentLoveRequest {
  381 + CompanyId int64 `json:",optional"`
  382 + ParamList []SystemEditLove `json:"paramList"`
  383 + }
  384 + SystemEditLove {
  385 + Id int64 `json:"id"`
  386 + CountAdminLove int `json:"countAdminLove,optional"`
  387 + }
  388 + SystemEditCommentLoveResponse {
  389 + ParamList []SystemEditLove `json:"paramList"`
  390 + }
  391 +)
  1 +syntax = "v1"
  2 +
  3 +info(
  4 + title: "天联鹰蜓"
  5 + desc: "天联鹰蜓"
  6 + author: "email"
  7 + email: "email"
  8 + version: "v1"
  9 +)
  10 +
  11 +// 通用接口
  12 +@server(
  13 + prefix: v1
  14 + group: common
  15 +)
  16 +service Core {
  17 + @doc "日志查询"
  18 + @handler commonGetLog
  19 + get /log/:module
  20 +}
  21 +
  22 +// 通用接口
  23 +@server(
  24 + prefix: v1
  25 + middleware: LogRequest
  26 + group: common
  27 +)
  28 +service Core {
  29 + @doc "短信验证码"
  30 + @handler commonSmsCode
  31 + post /common/sms/code (CommonSmsCodeRequest) returns (CommonSmsCodeResposne)
  32 +
  33 + @doc "微信二维码"
  34 + @handler miniQrcodeInvite
  35 + post /mini/qrcode (MiniQrCodeRequest)
  36 +
  37 + @doc "清理缓存"
  38 + @handler commonGetClearCache
  39 + get /clear
  40 +}
  41 +
  42 +// 短信验证码
  43 +type(
  44 + CommonSmsCodeRequest{
  45 + Phone string `json:"phone"`
  46 + }
  47 + CommonSmsCodeResposne{
  48 +
  49 + }
  50 +)
  51 +
  52 +type(
  53 + MiniQrCodeRequest{
  54 + Page string `json:"page"` // 微信页面入口
  55 + Scene string `json:"scene"` // 参数
  56 + }
  57 +)
  1 +syntax = "v1"
  2 +
  3 +info(
  4 + title: "天联鹰蜓"
  5 + desc: "天联鹰蜓"
  6 + author: "email"
  7 + email: "email"
  8 + version: "v1"
  9 +)
  10 +
  11 +// 小程序接口
  12 +@server(
  13 + prefix: v1
  14 + group: company
  15 + middleware: LogRequest
  16 +)
  17 +service Core {
  18 + @doc "公司搜索(公开的)"
  19 + @handler miniCompanySearch
  20 + post /mini/company/search(CompanySearchRequest) returns (CompanySearchResponse)
  21 +}
  22 +
  23 +// 小程序接口
  24 +@server(
  25 + prefix: v1
  26 + group: company
  27 + middleware: LogRequest
  28 + jwt : MiniAuth
  29 +)
  30 +service Core {
  31 + @doc "搜索已加入的公司"
  32 + @handler miniCompanySearchJoined
  33 + post /mini/company/search-joined(CompanySearchRequest) returns (CompanySearchResponse)
  34 +}
  35 +
  36 +// 后台接口
  37 +@server(
  38 + prefix: v1
  39 + group: company
  40 + middleware: LoginStatusCheck,LogRequest
  41 + jwt : SystemAuth
  42 +)
  43 +service Core {
  44 + @doc "公司搜索"
  45 + @handler systemCompanySearch
  46 + post /system/company/search(CompanySearchRequest) returns (CompanySearchResponse)
  47 +
  48 + @doc "公司职位搜索"
  49 + @handler systemCompanyPositionsSearch
  50 + post /system/company/positions/search(CompanyPositionsSearchRequest) returns (CompanyPositionsSearchResponse)
  51 +}
  52 +
  53 +type (
  54 + CompanySearchRequest {
  55 + Page int `json:"page,optional"`
  56 + Size int `json:"size,optional"`
  57 + Flag int `json:"flag,optional"` // 1:用户已加入的 2:用户未加入的公司
  58 + UserId int64 `json:"userId,optional"` // 按用户搜索(用户所加入的企业)
  59 + Code string `json:"code,optional"` // 按编码搜索
  60 + Content string `json:"content,optional"` // 按公司名/编码搜索
  61 + }
  62 + CompanySearchResponse {
  63 + List []Company `json:"list"`
  64 + Total int64 `json:"total"`
  65 + }
  66 + Company {
  67 + Id int64 `json:"id,string,omitempty"` // 唯一标识
  68 + Name string `json:"name,omitempty"` // 名称
  69 + Code string `json:"code,omitempty"` // 编码(搜索使用,4位字母数字)
  70 + Logo string `json:"logo,omitempty"` // 公司LOGO
  71 + JoinedFlag int `json:"joinedFlag"` // 已加入标识(1:已加入 其他:未加入)
  72 + }
  73 +)
  74 +
  75 +// 公司职位搜索
  76 +type(
  77 + CompanyPositionsSearchRequest{
  78 +
  79 + }
  80 + CompanyPositionsSearchResponse {
  81 + List []Position `json:"list"`
  82 + Total int64 `json:"total"`
  83 + }
  84 + Position{
  85 + Name string `json:"name"`
  86 + }
  87 +)
  1 +syntax = "v1"
  2 +
  3 +info(
  4 + title: "部门分组"
  5 + desc: "部门分组"
  6 + author: "zz"
  7 + email: "email"
  8 + version: "v1"
  9 +)
  10 +
  11 +@server(
  12 + prefix: v1
  13 + group: department
  14 + middleware: LoginStatusCheck,LogRequest
  15 + jwt: SystemAuth
  16 +)
  17 +service Core {
  18 + @doc "部门列表"
  19 + @handler systemList
  20 + post /system/department/list (DepartmentListRequest) returns (DepartmentListResponse)
  21 +
  22 + @doc "部门-新增"
  23 + @handler systemAdd
  24 + post /system/department/add (DepartmentAddRequest) returns (DepartmentGetResponse)
  25 +
  26 + @doc "部门-详情"
  27 + @handler systemGet
  28 + get /system/department/:id (DepartmentGetRequest) returns (DepartmentGetResponse)
  29 +
  30 + @doc "部门-更新"
  31 + @handler systemUpdate
  32 + put /system/department/:id (DepartmentUpdateRequest) returns (DepartmentGetResponse)
  33 +
  34 + @doc "部门-删除"
  35 + @handler systemDelete
  36 + delete /system/department/:id (DepartmentGetRequest) returns (DepartmentGetResponse)
  37 +}
  38 +
  39 +type (
  40 + DepartmentAddRequest {
  41 + Name string `json:"name"` // 分组名称
  42 + Ids []int64 `json:"ids"` // 用户ID
  43 + }
  44 +
  45 + DepartmentGetRequest {
  46 + Id int64 `path:"id"`
  47 + }
  48 +
  49 + DepartmentGetResponse struct{
  50 + Department Department `json:"department"`
  51 + }
  52 +
  53 + DepartmentUpdateRequest {
  54 + Id int64 `path:"id"`
  55 + Name string `json:"name"`
  56 + Ids []int64 `json:"ids"` // 用户ID
  57 + }
  58 +
  59 + DepartmentListRequest {
  60 + Page int `json:"page"`
  61 + Size int `json:"size"`
  62 + }
  63 +
  64 + DepartmentListResponse {
  65 + List []Department `json:"list"`
  66 + Total int64 `json:"total"`
  67 + }
  68 +
  69 +)
  1 +syntax = "v1"
  2 +
  3 +info(
  4 + title: "消息中心"
  5 + desc: "消息中心"
  6 + author: "zz"
  7 + email: "email"
  8 + version: "v1"
  9 +)
  10 +
  11 +@server(
  12 + prefix: v1
  13 + group: message
  14 + middleware: LogRequest
  15 + jwt: MiniAuth
  16 +)
  17 +service Core {
  18 + @doc "系统消息"
  19 + @handler miniSystem
  20 + post /mini/message/system (MessageRequest) returns (MessageSystemResponse)
  21 +
  22 + @doc "评论消息"
  23 + @handler miniComment
  24 + post /mini/message/comment (MessageRequest) returns (MessageBusinessResponse)
  25 +
  26 + @doc "点赞消息"
  27 + @handler miniLike
  28 + post /mini/message/like (MessageRequest) returns (MessageBusinessResponse)
  29 +}
  30 +
  31 +type (
  32 + MessageRequest {
  33 + Page int `json:"page"`
  34 + Size int `json:"size"`
  35 + }
  36 + MessageSystemResponse {
  37 + List []MessageSystemItem `json:"list"`
  38 + Total int64 `json:"total"`
  39 + }
  40 + MessageSystemItem {
  41 + Id int64 `json:"id"` // ID
  42 + Type int `json:"type"` // 系统分类
  43 + Title string `json:"title"` // 标题
  44 + Content string `json:"content"` // 内容
  45 + CreatedAt int64 `json:"createdAt"` // 创建时间
  46 + }
  47 +
  48 + MessageBusinessResponse {
  49 + List []MessageBusinessItem `json:"list"`
  50 + Total int64 `json:"total"`
  51 + }
  52 + MessageBusinessItem {
  53 + Id int64 `json:"id"`
  54 + Type int `json:"type"` // 分类 (1回复 2点赞 3被采纳)
  55 + OptType int `json:"optType"` // 操作类型(1针对文章或段落、2针对评论、3针对圆桌)
  56 + CompanyId int64 `json:"companyId"` // 操作人公司ID
  57 + UserId int64 `json:"userId"` // 操作人用户ID
  58 + RecipientId int64 `json:"recipientId"` // 接收者ID
  59 + ArticleId int64 `json:"articleId"` // 文章ID
  60 +// CommentId int64 `json:"commentId"` // 评论ID
  61 +// DiscussionId int64 `json:"discussionId"` // 圆桌ID
  62 +// DiscussionOpinionId int64 `json:"discussionOpinionId"` // 观点ID
  63 +// Content string `json:"content"` // 消息内容
  64 + CreatedAt int64 `json:"createdAt"` // 创建时间
  65 + User *SimpleUser `json:"user"` // 操作人
  66 + Article *SimpleArticle `json:"article"` // 文章
  67 + Comment *SimpleComment `json:"comment"` // 评论
  68 + CommentParent *SimpleComment `json:"commentParent"` // 被回复的评论
  69 + }
  70 +
  71 + SimpleUser {
  72 + Id int64 `json:"id"`
  73 + CompanyId int64 `json:"companyId,omitempty"` // 公司ID
  74 + CompanyName string `json:"companyName,omitempty"` // 公司名称
  75 + Name string `json:"name"` // 名称
  76 + Avatar string `json:"avatar"` // 头像
  77 + Position string `json:"position"` // 职位
  78 + }
  79 +
  80 +
  81 + SimpleArticle {
  82 + Id int64 `json:"id"`
  83 + Title string `json:"title"` // 文章标题
  84 + Summary string `json:"summary"` // 文章概要
  85 + CountLove int `json:"countLove"` // 点赞数量
  86 + CountComment int `json:"countComment"` // 评论数量
  87 + Show int `json:"show"` // 文章的展示状态(0显示、1不显示)
  88 + }
  89 +)
  1 +syntax = "v1"
  2 +
  3 +info(
  4 + title: "天联鹰蜓"
  5 + desc: "天联鹰蜓"
  6 + author: "email"
  7 + email: "email"
  8 + version: "v1"
  9 +)
  10 +
  11 +@server(
  12 + prefix: v1
  13 + group: role
  14 + middleware: LoginStatusCheck,LogRequest
  15 + jwt: SystemAuth
  16 +)
  17 +service Core {
  18 + @doc "角色详情"
  19 + @handler systemGetRole
  20 + get /system/role/:id (RoleGetRequest) returns (RoleGetResponse)
  21 + @doc "角色新增"
  22 + @handler systemSaveRole
  23 + post /system/role (RoleSaveRequest) returns (RoleSaveResponse)
  24 + @doc "角色删除"
  25 + @handler systemDeleteRole
  26 + delete /system/role/:id (RoleDeleteRequest) returns (RoleDeleteResponse)
  27 + @doc "角色更新"
  28 + @handler systemUpdateRole
  29 + put /system/role/:id (RoleUpdateRequest) returns (RoleUpdateResponse)
  30 + @doc "角色列表搜索"
  31 + @handler systemSearchRole
  32 + post /system/role/search (RoleSearchRequest) returns (RoleSearchResponse)
  33 + @doc "角色权限列表"
  34 + @handler systemGetRoleAuths
  35 + get /system/role/auths
  36 +}
  37 +
  38 +type (
  39 + RoleGetRequest {
  40 + Id int64 `path:"id"`
  41 + }
  42 + RoleGetResponse {
  43 + Role RoleItem `json:"role"`
  44 + AuthList []Auth `json:"authList"`
  45 + }
  46 +
  47 + RoleSaveRequest {
  48 + Role RoleItem `json:"role"`
  49 + }
  50 + RoleSaveResponse struct{}
  51 +
  52 + RoleDeleteRequest {
  53 + Id int64 `path:"id"`
  54 + }
  55 + RoleDeleteResponse struct{}
  56 +
  57 + RoleUpdateRequest {
  58 + Id int64 `path:"id"`
  59 + Role RoleItem `json:"role"`
  60 + }
  61 + RoleUpdateResponse struct{}
  62 +
  63 + RoleSearchRequest {
  64 + Page int `json:"page,optional"`
  65 + Size int `json:"size,optional"`
  66 + Style string `json:"style,options=[simple,,full]"` // simple:只返回角色ID名称 full:所有字段都返回
  67 + }
  68 + RoleSearchResponse {
  69 + List []RoleItem `json:"list"`
  70 + Total int64 `json:"total"`
  71 + }
  72 + RoleItem {
  73 + Id int64 `json:"id,optional"` // 角色ID
  74 + CompanyId int64 `json:"companyId,optional,string,omitempty"` // 公司ID
  75 + Name string `json:"name"` // 角色名称
  76 + AuthIds []int64 `json:"authIds,optional,omitempty"` // 角色权限列表
  77 + AuthsDesc string `json:"authsDesc,optional,omitempty"` // 权限列表描述
  78 + UsersDesc string `json:"usersDesc,optional,omitempty"` // 用户列表描述
  79 + Remark string `json:"remark,optional,omitempty"` // 备注
  80 + Users []RoleUser `json:"users,optional,omitempty"` // 绑定的用户
  81 + UpdatedAt int64 `json:"updatedAt,optional,omitempty"` // 更新时间
  82 + }
  83 + RoleUser {
  84 + Id int64 `json:"id"`
  85 + Name string `json:"name"`
  86 + }
  87 + Auth {
  88 + Id int64 `json:"id"` // ID
  89 + Name string `json:"name"` // 名称
  90 + Code string `json:"code"` // 编码
  91 + }
  92 +)
1 -syntax = "v1"  
2 -  
3 -info(  
4 - title: "天联鹰蜓"  
5 - desc: "天联鹰蜓"  
6 - author: "小火箭"  
7 - email: "email"  
8 - version: "v1"  
9 -)  
10 -  
11 -@server(  
12 - prefix: v1  
13 - group: tool  
14 -)  
15 -service Core {  
16 - @doc "健康"  
17 - @handler miniHealth  
18 - get /health (MiniHealthRequest) returns (MiniHealthResposne)  
19 -}  
20 -  
21 -type(  
22 - MiniHealthRequest struct{  
23 -  
24 - }  
25 - MiniHealthResposne struct{  
26 - Ok bool `json:"ok"`  
27 - }  
28 -)  
  1 +syntax = "v1"
  2 +
  3 +info(
  4 + title: "天联鹰蜓"
  5 + desc: "天联鹰蜓"
  6 + author: "email"
  7 + email: "email"
  8 + version: "v1"
  9 +)
  10 +
  11 +// 小程序接口
  12 +@server(
  13 + prefix: v1
  14 + group: user
  15 +)
  16 +service Core {
  17 + @doc "用户申请加入公司"
  18 + @handler miniUserApplyJoinCompany
  19 + post /mini/user/apply_join_company(MiniUserApplyJoinCompanyRequest) returns (MiniUserApplyJoinCompanyResponse)
  20 + @doc "用户登录"
  21 + @handler miniUserLogin
  22 + post /mini/user/login (MiniUserLoginRequest) returns (MiniUserLoginResponse)
  23 +}
  24 +@server(
  25 + prefix: v1
  26 + group: user
  27 + middleware: LogRequest
  28 + jwt: MiniAuth
  29 +)
  30 +service Core {
  31 + @doc "切换账号"
  32 + @handler miniUserSwitchAccount
  33 + post /mini/user/switch_account (MiniUserSwitchAccountRequest) returns (MiniUserLoginResponse)
  34 + @doc "用户信息"
  35 + @handler miniUserInfo
  36 + post /mini/user/info (MiniUserInfoRequest) returns (MiniUserInfoResponse)
  37 + @doc "编辑用户信息"
  38 + @handler miniEditUserInfo
  39 + post /mini/user/info/edit (MiniEditUserInfoRequest) returns (MiniEditUserInfoResponse)
  40 + @doc "用户统计"
  41 + @handler miniUserStatistics
  42 + post /mini/user/statistics (UserStatisticsRequest) returns (UserStatisticsResponse)
  43 + @doc "用户审核列表"
  44 + @handler miniUserAuditList
  45 + post /mini/user/audit_list (UserSearchRequest)returns(UserSearchResponse)
  46 + @doc "用户审核"
  47 + @handler miniUserAudit
  48 + post /mini/user/audit (MiniUserAuditRequest)
  49 + @doc "部门用户列表"
  50 + @handler miniUserDepartmentUsers
  51 + post /mini/user/department_users (MiniUserDepartmentUsersRequest)
  52 + @doc "用户列表"
  53 + @handler miniUsersList
  54 + post /mini/user/user_list (MiniUsersListRequest)
  55 + @doc "用户快讯"
  56 + @handler miniUserNews
  57 + post /mini/user/news (MiniUserNewsRequest)returns(MiniUserNewsResposne)
  58 + @doc "我关注人发布的信息"
  59 + @handler miniUserMyFollowingNews
  60 + post /mini/user/my_following_news (MiniUserNewsRequest)returns(MiniUserNewsResposne)
  61 + @doc "关注我的人"
  62 + @handler miniUserFollower
  63 + post /mini/user/follower (MiniUserFollowedSearchRequest)returns(MiniUserFollowedSearchResponse)
  64 + @doc "我关注的人"
  65 + @handler miniUserFollowing
  66 + post /mini/user/following (MiniUserFollowedSearchRequest)returns(MiniUserFollowedSearchResponse)
  67 + @doc "我关注的人-最新未读列表(未读标红)"
  68 + @handler miniUserFollowingLatestUnreadList
  69 + post /mini/user/following/latest_unread_list (MiniUserFollowedSearchRequest)returns(MiniUserFollowedSearchResponse)
  70 + @doc "我关注的人-标记已读"
  71 + @handler miniUserFollowingMarkRead
  72 + post /mini/user/following/mark_read (MiniUserFollowingMarkReadRequest)
  73 + @doc "关注"
  74 + @handler miniUserFollow
  75 + post /mini/user/follow (FollowRequest)
  76 + @doc "取消关注"
  77 + @handler miniUserUnFollow
  78 + post /mini/user/unfollow (FollowRequest)
  79 + @doc "我点赞的-文章或评论列表"
  80 + @handler miniMyLike
  81 + post /mini/user/mylike (MiniMyLikeRequest)returns (MiniMyLikeResponse)
  82 + @doc "我被点赞-文章或评论列表"
  83 + @handler miniMyBeLiked
  84 + post /mini/user/mybeliked (MiniBeLikedRequest)returns (MiniBeLikedResponse)
  85 +}
  86 +
  87 +type(
  88 + MiniEditUserInfoRequest{
  89 + Avatar *string `json:"avatar"`
  90 + }
  91 + MiniEditUserInfoResponse{
  92 +
  93 + }
  94 +)
  95 +
  96 +type(
  97 + MiniUserLoginRequest {
  98 + LoginType string `json:"loginType"` // 登录类型 wechat-login whchat-phone-login phone-password-login phone-smscode-login
  99 + WechatAuthCode string `json:"wechatAuthcode,optional"` // 微信登录 授权码
  100 + WechatEncryptedData string `json:"wechatEncryptedData,optional"` // 微信登录 加密数据
  101 + WechatIV string `json:"wechatIV,optional"` // 微信登录 加密算法初始向量
  102 + Phone string `json:"phone,optional"` // 手机号
  103 + Password string `json:"password,optional"` // 密码
  104 + SmsCode string `json:"smsCode,optional"` // 短信验证码
  105 + }
  106 + MiniUserLoginResponse {
  107 + Token string `json:"token"` // x-token
  108 + Phone string `json:"phone"` // 手机号
  109 + Message string `json:"message"` // 失败消息(审核中,注册成功等待审核)
  110 + Success bool `json:"success"` // 成功标识
  111 + }
  112 + MiniUserSwitchAccountRequest{
  113 + CompanyId int64 `json:"companyId,string"`
  114 + }
  115 +
  116 + MiniUserInfoRequest {
  117 + //MyStatisticsFlag bool `json:"myStatisticsFlag"` // true:返回统计信息 false;统计信息不返回
  118 + }
  119 + MiniUserInfoResponse {
  120 + User *UserItem `json:"user,omitempty"` // 用户信息
  121 + Accounts []Account `json:"accounts"` // 公司账号
  122 + Auths []Auth `json:"auths"` // 权限列表
  123 + }
  124 + MiniUserApplyJoinCompanyRequest{
  125 + Phone string `json:"phone"`
  126 + Code string `json:"code"`
  127 + IsFromQr bool `json:"isFromQr,optional"` // true:扫码添加 false:手动查找添加
  128 + }
  129 + MiniUserApplyJoinCompanyResponse{
  130 + Token string `json:"token"` // x-token
  131 + }
  132 + MiniUserAuditRequest{
  133 + UserId int64 `json:"userId"` // 用户ID
  134 + Status int `json:"status"` // 审核状态 1:审核通过 2:拒绝
  135 + }
  136 + MiniUserDepartmentUsersRequest{
  137 +
  138 + }
  139 + MiniUserDepartmentUsersResponse{
  140 + Departments []*Department `json:"departments"`
  141 + Users []*UserItem `json:"users"`
  142 + }
  143 + MiniUsersListRequest{
  144 + ArticleId int64 `json:"articleId,optional"` // 按文章ID(返回文章可见的用户)
  145 + RoleId int64 `json:"roleId,optional"` // 按角色角色关联的用户
  146 + }
  147 + MiniUserNewsRequest{
  148 + AuthorId int64 `json:"authorId,optional"` // 特定作者ID
  149 + LastArticleId int64 `json:"lastArticleId,optional"`// 最后文章ID
  150 + Size int `json:"size"` // 数量
  151 + }
  152 + MiniUserNewsResposne{
  153 + List []UserNewsItem `json:"list"`
  154 + LastArticleId int64 `json:"lastArticleId"`// 最后文章ID
  155 + }
  156 + UserNewsItem{
  157 + NewsId int64 `json:"newsId"` // 快讯ID
  158 + Type string `json:"type"` // 快讯类型 文章:Article 讨论:Discuss ...
  159 + Title string `json:"title"` // 标题
  160 + Summary string `json:"summary"` // 快讯概要
  161 + Time int64 `json:"time"` // 时间
  162 + ReadFlag bool `json:"readFlag"` // 已读标识 true:已读 false:未读
  163 + Images []string `json:"images"` // 图片列表
  164 + Author UserItem `json:"author"` // 作者
  165 + }
  166 + MiniUserFollowedSearchRequest{
  167 + Page int `json:"page,optional"`
  168 + Size int `json:"size,optional"`
  169 + Name string `json:"name,optional"`
  170 + }
  171 + MiniUserFollowedSearchResponse{
  172 + List []*UserFollowItem `json:"users"`
  173 + Total int64 `json:"total"`
  174 + }
  175 +
  176 + MiniUserFollowingMarkReadRequest{
  177 + UserId int64 `json:"userId"`
  178 + }
  179 +
  180 + UserItem {
  181 + Id int64 `json:"id,omitempty"` // 用户ID
  182 + CompanyId int64 `json:"companyId,string,omitempty"` // 公司ID
  183 + CompanyName string `json:"companyName,omitempty"` // 公司名称
  184 + CompanyCode string `json:"companyCode,omitempty"` // 公司编码(邀请码)
  185 + CompanyLogo *string `json:"companyLogo,omitempty"` // 公司LOGO
  186 + //DepartmentId int64 `json:"departmentId,omitempty"` // 部门ID
  187 + //Roles []int64 `json:"roleId,omitempty"` // 角色
  188 + Flag int `json:"flag,omitempty"` // 标识 1:管理员 2:普通用户 (有绑定角色是管理员)
  189 + Name string `json:"name,omitempty"` // 名称
  190 + Avatar *string `json:"avatar,omitempty"` // 头像
  191 + Phone string `json:"phone,omitempty"` // 手机号 唯一
  192 + Position string `json:"position,omitempty"` // 职位
  193 + Enable int `json:"enable,omitempty"` // 启用状态 1:启用 2:禁用
  194 + AuditStatus *int `json:"auditStatus,omitempty"` // 审核状态 0:待审核 1:审核通过 2:拒绝
  195 + AuditAt int64 `json:"auditAt,omitempty"` // 审核时间
  196 + Follower []int64 `json:"followers,omitempty"` // 关注我的人 (冗余)
  197 + Following []int64 `json:"following,omitempty"` // 我关注的人 (冗余)
  198 + Departments []int64 `json:"departments,omitempty"` // 所属部门
  199 + AccountFrom string `json:"accountFrom,omitempty"` // 账号来源 后台新增、扫码注册
  200 + }
  201 + Account {
  202 + CompanyId int64 `json:"companyId,string"` // 公司ID
  203 + CompanyName string `json:"companyName"` // 公司名称
  204 + Logo string `json:"logo"` // 公司图标
  205 + UserId int64 `json:"userId"` // 用户ID
  206 + Name string `json:"name"` // 名称
  207 + Position string `json:"position"`// 职位
  208 + }
  209 + Department struct {
  210 + Id int64 `json:"id,omitempty"` // 部门ID
  211 + CompanyId int64 `json:"companyId"` // 公司ID
  212 + ParentId int64 `json:"parentId"` // 父级ID
  213 + Name string `json:"name"` // 部门名称
  214 + UserIds []int64 `json:"userIds"` // 部门下的用户
  215 + }
  216 + UserSearchRequest{
  217 + Page int `json:"page,optional"`
  218 + Size int `json:"size,optional"`
  219 + AuditFlag *int `json:"auditFlag,optional"` // 按审核状态 0:待审核 1:审核通过 2:拒绝
  220 + }
  221 + UserSearchResponse{
  222 + List []*UserItem `json:"list"`
  223 + Total int64 `json:"total"`
  224 + }
  225 + FollowRequest{
  226 + UserId int64 `json:"userId"`
  227 + }
  228 + UserFollowItem struct {
  229 + Id int64 `json:"id"` // 用户ID
  230 + Name string `json:"name"` // 名称
  231 + CompanyName string `json:"companyName"` // 公司名称
  232 + Avatar string `json:"avatar"` // 头像
  233 + Position string `json:"position"` // 职位
  234 + Followed bool `json:"followed"` // 关注
  235 + MutualFollowed bool `json:"mutualFollowed"` // 互相关注标识
  236 + ReadFlag bool `json:"readFlag"` // 已读标识 true:已读 false:未读(小红点)
  237 + }
  238 +)
  239 +
  240 +
  241 +
  242 +// 1.我点赞的文章或评论 2.我的文章或评论被点赞
  243 +type (
  244 + MiniMyLikeRequest{
  245 + Page int `json:"page"`
  246 + Size int `json:"size"`
  247 + }
  248 +
  249 + MiniMyLikeResponse {
  250 + List []MyLikeItem `json:"list"`
  251 + Total int64 `json:"total"`
  252 + }
  253 +
  254 + MyLikeItem {
  255 + UserId int64 `json:"userId"` // 发布人id
  256 + ArticleId int64 `json:"articleId"` // 文章id
  257 + CommentId int64 `json:"commentId"` // 评论id
  258 + CreatedAt int64 `json:"createdAt"` // 创建时间
  259 + User *SimpleUser `json:"user"` // 发布人
  260 + Article *SimpleArticle `json:"article"` // 文章
  261 + Comment *SimpleComment `json:"comment"` // 评论
  262 + }
  263 +
  264 + SimpleComment {
  265 + Id int64 `json:"id"`
  266 + Content string `json:"content"` // 评论内容
  267 + Show int `json:"show"` // 评论的展示状态(0显示、1不显示)
  268 + AtWho []CommentAtWho `json:"atWho"` // 填写评论时@的人
  269 + MatchUrl map[string]string `json:"matchUrl"` // 评论内容中的url文本
  270 + CountReply int `json:"countReply"` // 用户回复数量
  271 + CountUserLove int `json:"countUserLove"` // 用户点赞数量
  272 + }
  273 +
  274 + MiniBeLikedRequest{
  275 + Page int `json:"page"`
  276 + Size int `json:"size"`
  277 + }
  278 +
  279 + MiniBeLikedResponse {
  280 + List []MyBeLikedItem `json:"list"`
  281 + Total int64 `json:"total"`
  282 + }
  283 +
  284 + MyBeLikedItem {
  285 + UserId int64 `json:"userId"` // 点赞人id
  286 + ArticleId int64 `json:"articleId"` // 文章id
  287 + CommentId int64 `json:"commentId"` // 评论id
  288 + CreatedAt int64 `json:"createdAt"` // 创建时间
  289 + User *SimpleUser `json:"user"` // 点赞人
  290 + Article *SimpleArticle `json:"article"` // 文章
  291 + Comment *SimpleComment `json:"comment"` // 评论
  292 + }
  293 +
  294 +)
  295 +
  296 +
  297 +// 后台接口
  298 +@server(
  299 + prefix: v1
  300 + group: user
  301 + middleware: LoginStatusCheck,LogRequest
  302 + jwt: SystemAuth
  303 +)
  304 +service Core {
  305 + @doc "系统用户信息"
  306 + @handler systemUserInfo
  307 + post /system/user/info(SystemUserInfoRequest) returns (SystemUserInfoResponse)
  308 + @doc "用户统计"
  309 + @handler systemUserStatistics
  310 + post /system/user/statistics (UserStatisticsRequest) returns (UserStatisticsResponse)
  311 + @doc "用户列表"
  312 + @handler systemUsersList
  313 + post /system/user/user_list (MiniUsersListRequest)
  314 +
  315 + @doc "用户详情"
  316 + @handler systemUserGet
  317 + get /system/user/:id (SystemUserGetRequest) returns (SystemUserGetResponse)
  318 + @doc "更新用户"
  319 + @handler systemUserUpdate
  320 + put /system/user/:id (SystemUserUpdateRequest) returns (SystemUserUpdateResponse)
  321 + @doc "搜索用户"
  322 + @handler systemUserSearch
  323 + post /system/user/search (SystemUserSearchRequest) returns (SystemUserSearchResponse)
  324 +
  325 +
  326 + @doc "系统账号详情"
  327 + @handler systemUserAccountGet
  328 + get /system/account/:id (SystemUserAccountGetRequest) returns (SystemUserAccountGetResponse)
  329 + @doc "系统新增账号"
  330 + @handler systemUserAccountSave
  331 + post /system/account (SystemUserAccountSaveRequest) returns (SystemUserAccountSaveResponse)
  332 + @doc "系统启用/禁用账号"
  333 + @handler systemUserAccountEnable
  334 + post /system/account/enable (SystemUserAccountEnableRequest) returns (SystemUserAccountEnableResponse)
  335 + @doc "系统更新账号"
  336 + @handler systemUserAccountUpdate
  337 + put /system/account/:id (SystemUserAccountUpdateRequest) returns (SystemUserAccountUpdateResponse)
  338 + @doc "系统搜索账号"
  339 + @handler systemUserAccountSearch
  340 + post /system/account/search (SystemUserAccountSearchRequest) returns (SystemUserAccountSearchResponse)
  341 +}
  342 +
  343 +type(
  344 + SystemUserInfoRequest{
  345 + Token string `header:"x-mmm-accesstoken"`
  346 + }
  347 + SystemUserInfoResponse{
  348 + UserId int64 `json:"userId"`
  349 + UserName string `json:"userName"`
  350 + Avatar string `json:"avatar"`
  351 + CompanyId int64 `json:"companyId"`
  352 + CompanyName string `json:"companyName"`
  353 + Code string `json:"code"`
  354 + }
  355 + UserStatisticsRequest{
  356 + UserId int64 `json:"userId,optional"`
  357 + ItemFlag int `json:"itemFlag"` //0:默认查询所有 1:他的帖子 2:他的评论/回复 4:他收到的赞 8:TA的圆桌讨论 16:被采纳
  358 + }
  359 + UserStatisticsResponse{
  360 + TotalArticle int `json:"totalArticle"` // 累计发布文章
  361 + TotalComment int `json:"totalComment"` // 累计发布评论
  362 + TotalLoved int `json:"totalLoved"` // 累计赞别人
  363 + TotalBeLoved int `json:"totalBeLoved"` // 累计收到的赞
  364 + }
  365 + StatisticsItem{
  366 + ItemFlag int `json:"itemFlag"` // 1:他的帖子 2:他的评论/回复 4:他收到的赞 8:TA的圆桌讨论 16:被采纳
  367 + Value float64 `json:"value"` // 统计值
  368 + }
  369 +
  370 + SystemUserGetRequest {
  371 + Id int64 `path:"id"`
  372 + }
  373 + SystemUserGetResponse struct{
  374 + User SystemUser `json:"user"`
  375 + }
  376 + SystemUser struct{
  377 + Id int64 `json:"id"` // 用户ID
  378 + Name string `json:"name"` // 名称
  379 + Avatar string `json:"avatar"` // 头像
  380 + Phone string `json:"phone"` // 手机号 唯一
  381 + Position string `json:"position"` // 职位
  382 + Enable int `json:"enable"` // 启用状态 1:启用 2:禁用
  383 + Departments []int64 `json:"departments"` // 所属部门
  384 + AccountFrom string `json:"accountFrom"` // 账号来源 后台新增、扫码注册
  385 + CreatedAt int64 `json:"createdAt"` // 注册时间
  386 + Roles []int64 `json:"roles"` // 角色
  387 + RolesDesc string `json:"rolesDesc"` // 角色描述
  388 + DepartmentsDesc string `json:"departmentsDesc"` // 部门描述
  389 + }
  390 +
  391 + SystemUserUpdateRequest struct{
  392 + Id int64 `path:"id"`
  393 + Avatar string `json:"avatar,optional"` // 头像
  394 + Position string `json:"position"` // 职位
  395 + Departments []int64 `json:"departments"` // 所属部门
  396 + }
  397 + SystemUserUpdateResponse struct{}
  398 +
  399 + SystemUserSearchRequest struct{
  400 + Page int `json:"page"`
  401 + Size int `json:"size"`
  402 + Name string `json:"name,optional"` // 名称
  403 + Phone string `json:"phone,optional"` // 手机号 唯一
  404 + Position string `json:"position,optional"` // 职位
  405 + Enable int `json:"enable,optional"` // 启用状态 1:启用 2:禁用
  406 + DepartmentId int64 `json:"departmentId,optional"` // 所属部门
  407 + }
  408 + SystemUserSearchResponse{
  409 + List []SystemUser `json:"list"`
  410 + Total int64 `json:"total"`
  411 + }
  412 +
  413 + SystemUserAccountGetRequest {
  414 + Id int64 `path:"id"`
  415 + }
  416 + SystemUserAccountGetResponse struct{
  417 + User SystemUser `json:"user"`
  418 + }
  419 +
  420 + SystemUserAccountSaveRequest struct{
  421 + Name string `json:"name"` // 名称
  422 + Phone string `json:"phone"` // 手机号 唯一
  423 + Enable int `json:"enable"` // 启用状态 1:启用 2:禁用
  424 + Roles []int64 `json:"roles"` // 角色
  425 + }
  426 + SystemUserAccountSaveResponse struct{
  427 +
  428 + }
  429 + SystemUserAccountEnableRequest struct{
  430 + UserIds []int64 `json:"userIds"` // 用户ID列表
  431 + Status int `json:"status"` // 状态 1:启用 2:禁用
  432 + }
  433 + SystemUserAccountEnableResponse struct{
  434 +
  435 + }
  436 + SystemUserAccountUpdateRequest struct{
  437 + Id int64 `path:"id"`
  438 + Name string `json:"name"` // 姓名
  439 + Roles []int64 `json:"roles"` // 权限角色
  440 + Status int `json:"enable"` // 状态 1:启用 2:禁用
  441 + }
  442 + SystemUserAccountUpdateResponse struct{}
  443 +
  444 + SystemUserAccountSearchRequest struct{
  445 + Page int `json:"page"`
  446 + Size int `json:"size"`
  447 + Name string `json:"name,optional"` // 名称
  448 + Phone string `json:"phone,optional"` // 手机号 唯一
  449 + RoleId int64 `json:"roleId,optional"` // 角色权限
  450 + Enable int `json:"enable,optional"` // 启用状态 1:启用 2:禁用
  451 + BeginTime int64 `json:"beginTime,optional"` // 注册日期-开始
  452 + EndTime int64 `json:"endTime,optional"` // 注册日期-结束
  453 + }
  454 + SystemUserAccountSearchResponse{
  455 + List []SystemUser `json:"list"`
  456 + Total int64 `json:"total"`
  457 + }
  458 +)
1 Name: discuss 1 Name: discuss
2 Host: 0.0.0.0 2 Host: 0.0.0.0
3 Port: 8081 3 Port: 8081
4 -Verbose: true 4 +Verbose: false
  5 +Migrate: false
  6 +Timeout: 30000
  7 +# CertFile: ./key/fjmaimaimai.com_bundle.crt
  8 +# KeyFile: ./key/fjmaimaimai.com.key
  9 +LogRequest: true # 记录详细请求日志
5 10
6 Log: 11 Log:
7 - #Mode: file 12 + Mode: file
8 Encoding: plain 13 Encoding: plain
9 Level: debug # info 14 Level: debug # info
10 MaxSize: 1 # 2MB 15 MaxSize: 1 # 2MB
11 - TimeFormat: 2006-01-02 15:04:05.000 16 + TimeFormat: 2006-01-02 15:04:05
  17 + Rotation: size
  18 + MaxContentLength: 10240
12 19
13 -JwtAuth: 20 +SystemAuth:
14 AccessSecret: digital-platform 21 AccessSecret: digital-platform
15 - Expire: 360000 22 + AccessExpire: 360000
  23 +
  24 +MiniAuth:
  25 + AccessSecret: discuss-secret
  26 + AccessExpire: 360000
16 27
17 Redis: 28 Redis:
18 Host: 192.168.0.247:30379 29 Host: 192.168.0.247:30379
19 Type: node 30 Type: node
20 Pass: 31 Pass:
21 DB: 32 DB:
22 - DataSource: host=114.55.200.59 user=postgres password=eagle1010 dbname=sumifcc-discuss-dev port=31543 sslmode=disable TimeZone=Asia/Shanghai  
  33 + DataSource: host=114.55.200.59 user=postgres password=eagle1010 dbname=sumifcc-discuss-dev port=31543 sslmode=disable TimeZone=Asia/Shanghai
  34 +
  35 +ApiAuth:
  36 + Name: ApiAuth
  37 + Host: http://digital-platform-dev.fjmaimaimai.com
  38 + Timeout: 0s
  39 +
  40 +Wechat:
  41 + AppID: wxae5b305849343ec8
  42 + AppSecret: f584adb68f7d784425b60e1ebb2ffd4b
@@ -4,10 +4,23 @@ import ( @@ -4,10 +4,23 @@ import (
4 "github.com/zeromicro/go-zero/core/stores/redis" 4 "github.com/zeromicro/go-zero/core/stores/redis"
5 "github.com/zeromicro/go-zero/rest" 5 "github.com/zeromicro/go-zero/rest"
6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/config" 6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/config"
  7 + "time"
7 ) 8 )
8 9
9 type Config struct { 10 type Config struct {
10 rest.RestConf 11 rest.RestConf
11 config.Config 12 config.Config
12 - Redis redis.RedisConf `json:",optional"` 13 + Redis redis.RedisConf `json:",optional"`
  14 + SystemAuth config.Auth
  15 + MiniAuth config.Auth
  16 + Migrate bool `json:",optional,default=true"`
  17 + ApiAuth ApiService
  18 + DebugSmsCode string `json:",optional,default=999512"`
  19 + LogRequest bool `json:",optional,default=true"`
  20 +}
  21 +
  22 +type ApiService struct {
  23 + Name string
  24 + Host string
  25 + Timeout time.Duration
13 } 26 }
  1 +package article
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 获取所有的标签
  15 +func MiniAllArticleTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.MiniAllArticleTagRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 +
  23 + l := article.NewMiniAllArticleTagLogic(r.Context(), svcCtx)
  24 + token := contextdata.GetUserTokenFromCtx(r.Context())
  25 + req.CompanyId = token.CompanyId
  26 + req.UserId = token.UserId
  27 + resp, err := l.MiniAllArticleTag(&req)
  28 + result.HttpResult(r, w, resp, err)
  29 + }
  30 +}
  1 +package article
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 获取文章的编辑记录
  15 +func MiniArticleBackupSearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.MiniArticleBackupSearchRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 + token := contextdata.GetUserTokenFromCtx(r.Context())
  23 + req.CompanyId = token.CompanyId
  24 + l := article.NewMiniArticleBackupSearchLogic(r.Context(), svcCtx)
  25 + resp, err := l.MiniArticleBackupSearch(&req)
  26 + result.HttpResult(r, w, resp, err)
  27 + }
  28 +}
  1 +package article
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  7 +
  8 + "github.com/zeromicro/go-zero/rest/httpx"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  12 +)
  13 +
  14 +// 获取我的文章浏览记录
  15 +func MiniArticleMarkListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.MiniArticleMarkListRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 +
  23 + l := article.NewMiniArticleMarkListLogic(r.Context(), svcCtx)
  24 + resp, err := l.MiniArticleMarkList(&req)
  25 + result.HttpResult(r, w, resp, err)
  26 + }
  27 +}
  1 +package article
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 标记人员当前浏览的文章
  15 +func MiniArticleMarkUserReadHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.MiniArticleMarkUserReadRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 +
  23 + l := article.NewMiniArticleMarkUserReadLogic(r.Context(), svcCtx)
  24 + token := contextdata.GetUserTokenFromCtx(r.Context())
  25 + req.CompanyId = token.CompanyId
  26 + req.UserId = token.UserId
  27 + resp, err := l.MiniArticleMarkUserRead(&req)
  28 + result.HttpResult(r, w, resp, err)
  29 + }
  30 +}
  1 +package article
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 获取我发布的文章
  15 +func MiniArticleSearchMeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.MiniArticleSearchMeRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 +
  23 + l := article.NewMiniArticleSearchMeLogic(r.Context(), svcCtx)
  24 + token := contextdata.GetUserTokenFromCtx(r.Context())
  25 + req.AuthorId = token.UserId
  26 + req.CompanyId = token.CompanyId
  27 + resp, err := l.MiniArticleSearchMe(&req)
  28 + result.HttpResult(r, w, resp, err)
  29 + }
  30 +}
  1 +package article
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 设置文章的定性标签
  15 +func MiniArticleSetTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.MiniArticleSetTagRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 +
  23 + l := article.NewMiniArticleSetTagLogic(r.Context(), svcCtx)
  24 + token := contextdata.GetUserTokenFromCtx(r.Context())
  25 + req.UserId = token.UserId
  26 + req.CompanyId = token.CompanyId
  27 + resp, err := l.MiniArticleSetTag(&req)
  28 + result.HttpResult(r, w, resp, err)
  29 + }
  30 +}
  1 +package article
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 保存文章进草稿箱
  15 +func MiniCreateArticleDraftHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.MiniArticleDraftCreateRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 +
  23 + l := article.NewMiniCreateArticleDraftLogic(r.Context(), svcCtx)
  24 + token := contextdata.GetUserTokenFromCtx(r.Context())
  25 + req.AuthorId = token.UserId
  26 + req.CompanyId = token.CompanyId
  27 + resp, err := l.MiniCreateArticleDraft(&req)
  28 + result.HttpResult(r, w, resp, err)
  29 + }
  30 +}
  1 +package article
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 发布新的文章
  15 +func MiniCreateArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.MiniArticleCreateRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 + token := contextdata.GetUserTokenFromCtx(r.Context())
  23 +
  24 + l := article.NewMiniCreateArticleLogic(r.Context(), svcCtx)
  25 + req.AuthorId = token.UserId
  26 + resp, err := l.MiniCreateArticle(&req)
  27 + result.HttpResult(r, w, resp, err)
  28 +
  29 + }
  30 +}
  1 +package article
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 删除文章的草稿箱
  15 +func MiniDeleteArticleDraftMeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.MiniArticleDraftDeleteMeRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 +
  23 + l := article.NewMiniDeleteArticleDraftMeLogic(r.Context(), svcCtx)
  24 + token := contextdata.GetUserTokenFromCtx(r.Context())
  25 + req.AuthorId = token.UserId
  26 + req.CompanyId = token.CompanyId
  27 + resp, err := l.MiniDeleteArticleDraftMe(&req)
  28 + result.HttpResult(r, w, resp, err)
  29 + }
  30 +}
  1 +package article
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 获取我的文章草稿内容
  15 +func MiniGetArticleDraftMeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.MiniArticleDraftGetMeRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 +
  23 + l := article.NewMiniGetArticleDraftMeLogic(r.Context(), svcCtx)
  24 + token := contextdata.GetUserTokenFromCtx(r.Context())
  25 + req.AuthorId = token.UserId
  26 + req.CompanyId = token.CompanyId
  27 + resp, err := l.MiniGetArticleDraftMe(&req)
  28 + result.HttpResult(r, w, resp, err)
  29 + }
  30 +}
  1 +package article
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 小程序端展示文章内容
  15 +func MiniGetArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.MiniArticleGetRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 +
  23 + l := article.NewMiniGetArticleLogic(r.Context(), svcCtx)
  24 + token := contextdata.GetUserTokenFromCtx(r.Context())
  25 + req.CompanyId = token.CompanyId
  26 + req.UserId = int(token.UserId)
  27 + resp, err := l.MiniGetArticle(&req)
  28 + result.HttpResult(r, w, resp, err)
  29 + }
  30 +}
  1 +package article
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 查询我的草稿箱内容列表
  15 +func MiniSearchArticleDraftMeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.MiniArticleDraftSearchMeRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 +
  23 + l := article.NewMiniSearchArticleDraftMeLogic(r.Context(), svcCtx)
  24 + token := contextdata.GetUserTokenFromCtx(r.Context())
  25 + req.AuthorId = token.UserId
  26 + req.CompanyId = token.CompanyId
  27 + resp, err := l.MiniSearchArticleDraftMe(&req)
  28 + result.HttpResult(r, w, resp, err)
  29 + }
  30 +}
  1 +package article
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 小程序端搜索
  15 +func MiniSearchArticlePageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.MiniSearchArticleRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 +
  23 + l := article.NewMiniSearchArticlePageLogic(r.Context(), svcCtx)
  24 + token := contextdata.GetUserTokenFromCtx(r.Context())
  25 + req.UserId = token.UserId
  26 + req.CompanyId = token.CompanyId
  27 + resp, err := l.MiniSearchArticlePage(&req)
  28 + result.HttpResult(r, w, resp, err)
  29 + }
  30 +}
  1 +package article
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 设置文章\评论的点赞操作
  15 +func MiniSetUserLikeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.MiniSetUserLikeRequset
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 +
  23 + l := article.NewMiniSetUserLikeLogic(r.Context(), svcCtx)
  24 + token := contextdata.GetUserTokenFromCtx(r.Context())
  25 + req.UserId = token.UserId
  26 + resp, err := l.MiniSetUserLike(&req)
  27 + result.HttpResult(r, w, resp, err)
  28 + }
  29 +}
  1 +package article
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  11 +)
  12 +
  13 +// 展示小程序端首页的数据
  14 +func MiniShowHomePageHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  15 + return func(w http.ResponseWriter, r *http.Request) {
  16 + var req types.MiniHomePageRequest
  17 + // if err := httpx.Parse(r, &req); err != nil {
  18 + // httpx.ErrorCtx(r.Context(), w, err)
  19 + // return
  20 + // }
  21 +
  22 + l := article.NewMiniShowHomePageLogic(r.Context(), svcCtx)
  23 + token := contextdata.GetUserTokenFromCtx(r.Context())
  24 + req.UserId = token.UserId
  25 + req.CompanyId = token.CompanyId
  26 + resp, err := l.MiniShowHomePage(&req)
  27 + result.HttpResult(r, w, resp, err)
  28 + }
  29 +}
  1 +package article
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 更新文章草稿箱的内容
  15 +func MiniUpdateArticleDraftHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.MiniArticleDraftUpdateRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 + l := article.NewMiniUpdateArticleDraftLogic(r.Context(), svcCtx)
  23 + token := contextdata.GetUserTokenFromCtx(r.Context())
  24 + req.AuthorId = token.UserId
  25 + req.CompanyId = token.CompanyId
  26 + resp, err := l.MiniUpdateArticleDraft(&req)
  27 + result.HttpResult(r, w, resp, err)
  28 + }
  29 +}
  1 +package article
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 获取点赞文章的的人员列表
  15 +func MiniUserLikeArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.MiniUserLikeArticleRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 +
  23 + l := article.NewMiniUserLikeArticleLogic(r.Context(), svcCtx)
  24 + token := contextdata.GetUserTokenFromCtx(r.Context())
  25 + req.CompanyId = token.CompanyId
  26 + resp, err := l.MiniUserLikeArticle(&req)
  27 + result.HttpResult(r, w, resp, err)
  28 + }
  29 +}
  1 +package article
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func SystemArticleGetHistoryHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.SystemArticleGetHistoryRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + result.ParamErrorResult(r, w, err)
  18 + return
  19 + }
  20 +
  21 + l := article.NewSystemArticleGetHistoryLogic(r.Context(), svcCtx)
  22 + resp, err := l.SystemArticleGetHistory(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package article
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func SystemArticleRestoreHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.SystemArticleRestoreRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + result.ParamErrorResult(r, w, err)
  18 + return
  19 + }
  20 +
  21 + l := article.NewSystemArticleRestoreLogic(r.Context(), svcCtx)
  22 + resp, err := l.SystemArticleRestore(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package article
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func SystemArticleSearchMeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.SystemArticleSearchMeRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 +
  21 + l := article.NewSystemArticleSearchMeLogic(r.Context(), svcCtx)
  22 + resp, err := l.SystemArticleSearchMe(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package article
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +func SystemGetArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  15 + return func(w http.ResponseWriter, r *http.Request) {
  16 + var req types.SystemArticleGetRequest
  17 + if err := httpx.Parse(r, &req); err != nil {
  18 + result.ParamErrorResult(r, w, err)
  19 + return
  20 + }
  21 +
  22 + l := article.NewSystemGetArticleLogic(r.Context(), svcCtx)
  23 + token := contextdata.GetUserTokenFromCtx(r.Context())
  24 + req.CompanyId = token.CompanyId
  25 + resp, err := l.SystemGetArticle(&req)
  26 + result.HttpResult(r, w, resp, err)
  27 + }
  28 +}
  1 +package article
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func SystemHistoryArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.SystemArticleHistoryRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + result.ParamErrorResult(r, w, err)
  18 + return
  19 + }
  20 +
  21 + l := article.NewSystemHistoryArticleLogic(r.Context(), svcCtx)
  22 + resp, err := l.SystemHistoryArticle(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package article
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +func SystemSearchArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  15 + return func(w http.ResponseWriter, r *http.Request) {
  16 + var req types.SystemArticleSearchRequest
  17 + if err := httpx.Parse(r, &req); err != nil {
  18 + result.ParamErrorResult(r, w, err)
  19 + return
  20 + }
  21 +
  22 + l := article.NewSystemSearchArticleLogic(r.Context(), svcCtx)
  23 +
  24 + token := contextdata.GetUserTokenFromCtx(r.Context())
  25 + req.CompanyId = token.CompanyId
  26 + resp, err := l.SystemSearchArticle(&req)
  27 + result.HttpResult(r, w, resp, err)
  28 + }
  29 +}
  1 +package article
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/article"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func SystemUpdateArticleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.SystemArticleUpdateRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + result.ParamErrorResult(r, w, err)
  18 + return
  19 + }
  20 + l := article.NewSystemUpdateArticleLogic(r.Context(), svcCtx)
  21 + resp, err := l.SystemUpdateArticle(&req)
  22 + result.HttpResult(r, w, resp, err)
  23 + }
  24 +}
  1 +package comment
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 填写评估时@谁 的可选择者列表
  15 +func MiniArticleCommentAtWhoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.MiniArticleCommentAtWhoRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 +
  23 + l := comment.NewMiniArticleCommentAtWhoLogic(r.Context(), svcCtx)
  24 + token := contextdata.GetUserTokenFromCtx(r.Context())
  25 + req.CompanyId = token.CompanyId
  26 + req.UserId = token.UserId
  27 + resp, err := l.MiniArticleCommentAtWho(&req)
  28 + result.HttpResult(r, w, resp, err)
  29 + }
  30 +}
  1 +package comment
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 填写评论
  15 +func MiniCreateArticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.MiniCreateArticleCommentRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 + l := comment.NewMiniCreateArticleCommentLogic(r.Context(), svcCtx)
  23 + token := contextdata.GetUserTokenFromCtx(r.Context())
  24 + req.CompanyId = token.CompanyId
  25 + req.FromUserId = token.UserId
  26 + resp, err := l.MiniCreateArticleComment(&req)
  27 + result.HttpResult(r, w, resp, err)
  28 + }
  29 +}
  1 +package comment
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 小程序端人员删除评论
  15 +func MiniDeleteArticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.MiniDeleteArticleCommentRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 +
  23 + l := comment.NewMiniDeleteArticleCommentLogic(r.Context(), svcCtx)
  24 + token := contextdata.GetUserTokenFromCtx(r.Context())
  25 + req.CompanyId = token.CompanyId
  26 + req.UserId = token.UserId
  27 + resp, err := l.MiniDeleteArticleComment(&req)
  28 + result.HttpResult(r, w, resp, err)
  29 + }
  30 +}
  1 +package comment
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 获取单条评论详情
  15 +func MiniGetArticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.MiniGetArticleCommentRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 +
  23 + l := comment.NewMiniGetArticleCommentLogic(r.Context(), svcCtx)
  24 + token := contextdata.GetUserTokenFromCtx(r.Context())
  25 + req.CompanyId = token.CompanyId
  26 + req.UserId = token.UserId
  27 + resp, err := l.MiniGetArticleComment(&req)
  28 + result.HttpResult(r, w, resp, err)
  29 + }
  30 +}
  1 +package comment
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 小程序端获取 根据文章id 获取评论列表
  15 +func MiniListArticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.MiniListArticleCommentRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 + l := comment.NewMiniListArticleCommentLogic(r.Context(), svcCtx)
  23 + token := contextdata.GetUserTokenFromCtx(r.Context())
  24 + req.CompanyId = token.CompanyId
  25 + req.UserId = token.UserId
  26 + resp, err := l.MiniListArticleComment(&req)
  27 + result.HttpResult(r, w, resp, err)
  28 + }
  29 +}
  1 +package comment
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +func MiniListReplyArticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  15 + return func(w http.ResponseWriter, r *http.Request) {
  16 + var req types.MiniListReplyArticleCommentRequest
  17 + if err := httpx.Parse(r, &req); err != nil {
  18 + result.HttpResult(r, w, nil, err)
  19 + return
  20 + }
  21 +
  22 + l := comment.NewMiniListReplyArticleCommentLogic(r.Context(), svcCtx)
  23 + token := contextdata.GetUserTokenFromCtx(r.Context())
  24 + req.CompanyId = token.CompanyId
  25 + req.UserId = token.UserId
  26 + resp, err := l.MiniListReplyArticleComment(&req)
  27 + result.HttpResult(r, w, resp, err)
  28 + }
  29 +}
  1 +package comment
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 获取前5的评论
  15 +func MiniTop5ArticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.MiniTop5ArticleCommentRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 +
  23 + l := comment.NewMiniTop5ArticleCommentLogic(r.Context(), svcCtx)
  24 + token := contextdata.GetUserTokenFromCtx(r.Context())
  25 + req.CompanyId = token.CompanyId
  26 + req.UserId = token.UserId
  27 + resp, err := l.MiniTop5ArticleComment(&req)
  28 + result.HttpResult(r, w, resp, err)
  29 + }
  30 +}
  1 +package comment
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  7 +
  8 + "github.com/zeromicro/go-zero/rest/httpx"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  12 +)
  13 +
  14 +func SystemArticleCommentSearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  15 + return func(w http.ResponseWriter, r *http.Request) {
  16 + var req types.SystemArticleCommentSearchRequest
  17 + if err := httpx.Parse(r, &req); err != nil {
  18 + result.HttpResult(r, w, nil, err)
  19 + return
  20 + }
  21 +
  22 + l := comment.NewSystemArticleCommentSearchLogic(r.Context(), svcCtx)
  23 + resp, err := l.SystemArticleCommentSearch(&req)
  24 + result.HttpResult(r, w, resp, err)
  25 + }
  26 +}
  1 +package comment
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  7 +
  8 + "github.com/zeromicro/go-zero/rest/httpx"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  12 +)
  13 +
  14 +func SystemArticleCommentSearchMeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  15 + return func(w http.ResponseWriter, r *http.Request) {
  16 + var req types.SystemArticleCommentSearchMeRequest
  17 + if err := httpx.Parse(r, &req); err != nil {
  18 + result.HttpResult(r, w, nil, err)
  19 + return
  20 + }
  21 +
  22 + l := comment.NewSystemArticleCommentSearchMeLogic(r.Context(), svcCtx)
  23 + resp, err := l.SystemArticleCommentSearchMe(&req)
  24 + result.HttpResult(r, w, resp, err)
  25 + }
  26 +}
  1 +package comment
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +func SystemEditAticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  15 + return func(w http.ResponseWriter, r *http.Request) {
  16 + var req types.SystemEditCommentRequest
  17 + if err := httpx.Parse(r, &req); err != nil {
  18 + result.HttpResult(r, w, nil, err)
  19 + return
  20 + }
  21 +
  22 + l := comment.NewSystemEditAticleCommentLogic(r.Context(), svcCtx)
  23 + token := contextdata.GetUserTokenFromCtx(r.Context())
  24 + req.CompanyId = token.CompanyId
  25 + resp, err := l.SystemEditAticleComment(&req)
  26 + result.HttpResult(r, w, resp, err)
  27 + }
  28 +}
  1 +package comment
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 单独编辑评论的运营点赞数量
  15 +func SystemEditAticleCommentLoveHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.SystemEditCommentLoveRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 + token := contextdata.GetUserTokenFromCtx(r.Context())
  23 + req.CompanyId = token.CompanyId
  24 + l := comment.NewSystemEditAticleCommentLoveLogic(r.Context(), svcCtx)
  25 + resp, err := l.SystemEditAticleCommentLove(&req)
  26 + result.HttpResult(r, w, resp, err)
  27 + }
  28 +}
  1 +package comment
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +func SystemEditAticleCommentShowHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  15 + return func(w http.ResponseWriter, r *http.Request) {
  16 + var req types.SystemEditCommentShowRequest
  17 + if err := httpx.Parse(r, &req); err != nil {
  18 + result.HttpResult(r, w, nil, err)
  19 + return
  20 + }
  21 +
  22 + l := comment.NewSystemEditAticleCommentShowLogic(r.Context(), svcCtx)
  23 + token := contextdata.GetUserTokenFromCtx(r.Context())
  24 + req.CompanyId = token.CompanyId
  25 + resp, err := l.SystemEditAticleCommentShow(&req)
  26 + result.HttpResult(r, w, resp, err)
  27 + }
  28 +}
  1 +package comment
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +func SystemGetAticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  15 + return func(w http.ResponseWriter, r *http.Request) {
  16 + var req types.SystemGetCommentRequest
  17 + if err := httpx.Parse(r, &req); err != nil {
  18 + result.HttpResult(r, w, nil, err)
  19 + return
  20 + }
  21 +
  22 + l := comment.NewSystemGetAticleCommentLogic(r.Context(), svcCtx)
  23 + token := contextdata.GetUserTokenFromCtx(r.Context())
  24 + req.CompanyId = token.CompanyId
  25 + resp, err := l.SystemGetAticleComment(&req)
  26 + result.HttpResult(r, w, resp, err)
  27 + }
  28 +}
  1 +package comment
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/comment"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +// 管理后台的评论列表
  15 +func SystemListAticleCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  16 + return func(w http.ResponseWriter, r *http.Request) {
  17 + var req types.SystemListCommentRequest
  18 + if err := httpx.Parse(r, &req); err != nil {
  19 + result.HttpResult(r, w, nil, err)
  20 + return
  21 + }
  22 +
  23 + l := comment.NewSystemListAticleCommentLogic(r.Context(), svcCtx)
  24 + token := contextdata.GetUserTokenFromCtx(r.Context())
  25 + req.CompanyId = token.CompanyId
  26 + resp, err := l.SystemListAticleComment(&req)
  27 + result.HttpResult(r, w, resp, err)
  28 + }
  29 +}
  1 +package common
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/common"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 +)
  10 +
  11 +func CommonGetClearCacheHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  12 + return func(w http.ResponseWriter, r *http.Request) {
  13 + l := common.NewCommonGetClearCacheLogic(r.Context(), svcCtx)
  14 + err := l.CommonGetClearCache()
  15 + if err != nil {
  16 + httpx.ErrorCtx(r.Context(), w, err)
  17 + } else {
  18 + httpx.Ok(w)
  19 + }
  20 + }
  21 +}
  1 +package common
  2 +
  3 +import (
  4 + "net/http"
  5 + "path/filepath"
  6 + "strings"
  7 +
  8 + "github.com/zeromicro/go-zero/rest/httpx"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 +)
  11 +
  12 +func CommonGetLogHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  13 + return func(w http.ResponseWriter, r *http.Request) {
  14 + var req struct {
  15 + Module string `path:"module"`
  16 + }
  17 + if err := httpx.Parse(r, &req); err != nil {
  18 + httpx.ErrorCtx(r.Context(), w, err)
  19 + return
  20 + }
  21 + path := svcCtx.Config.Log.Path
  22 + if svcCtx.Config.Log.Mode != "file" {
  23 + return
  24 + }
  25 + if path == "" {
  26 + path = "logs"
  27 + }
  28 + if !strings.HasSuffix(req.Module, ".log") {
  29 + req.Module += ".log"
  30 + }
  31 + handler := http.FileServer(http.Dir(path))
  32 + r.URL.Path = filepath.Join(req.Module)
  33 + handler.ServeHTTP(w, r)
  34 + }
  35 +}
1 -package tool 1 +package common
2 2
3 import ( 3 import (
4 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" 4 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
5 "net/http" 5 "net/http"
6 6
7 "github.com/zeromicro/go-zero/rest/httpx" 7 "github.com/zeromicro/go-zero/rest/httpx"
8 - "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tool" 8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/common"
9 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 9 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
10 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types" 10 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
11 ) 11 )
12 12
13 -func MiniHealthHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { 13 +func CommonSmsCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
14 return func(w http.ResponseWriter, r *http.Request) { 14 return func(w http.ResponseWriter, r *http.Request) {
15 - var req types.MiniHealthRequest 15 + var req types.CommonSmsCodeRequest
16 if err := httpx.Parse(r, &req); err != nil { 16 if err := httpx.Parse(r, &req); err != nil {
17 httpx.ErrorCtx(r.Context(), w, err) 17 httpx.ErrorCtx(r.Context(), w, err)
18 return 18 return
19 } 19 }
20 20
21 - l := tool.NewMiniHealthLogic(r.Context(), svcCtx)  
22 - resp, err := l.MiniHealth(&req) 21 + l := common.NewCommonSmsCodeLogic(r.Context(), svcCtx)
  22 + resp, err := l.CommonSmsCode(&req)
23 result.HttpResult(r, w, resp, err) 23 result.HttpResult(r, w, resp, err)
24 } 24 }
25 } 25 }
  1 +package common
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/common"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func MiniQrcodeInviteHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.MiniQrCodeRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 +
  21 + l := common.NewMiniQrcodeInviteLogic(r.Context(), svcCtx)
  22 + resp, err := l.MiniQrcodeInvite(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package company
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/company"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func MiniCompanySearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.CompanySearchRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 +
  21 + l := company.NewMiniCompanySearchLogic(r.Context(), svcCtx)
  22 + resp, err := l.MiniCompanySearch(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package company
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/company"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func MiniCompanySearchJoinedHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.CompanySearchRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 +
  21 + l := company.NewMiniCompanySearchJoinedLogic(r.Context(), svcCtx)
  22 + resp, err := l.MiniCompanySearchJoined(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package company
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/company"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 +)
  11 +
  12 +func SystemCompanyPositionsSearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  13 + return func(w http.ResponseWriter, r *http.Request) {
  14 + var req types.CompanyPositionsSearchRequest
  15 + if err := httpx.Parse(r, &req); err != nil {
  16 + httpx.ErrorCtx(r.Context(), w, err)
  17 + return
  18 + }
  19 +
  20 + l := company.NewSystemCompanyPositionsSearchLogic(r.Context(), svcCtx)
  21 + resp, err := l.SystemCompanyPositionsSearch(&req)
  22 + if err != nil {
  23 + httpx.ErrorCtx(r.Context(), w, err)
  24 + } else {
  25 + httpx.OkJsonCtx(r.Context(), w, resp)
  26 + }
  27 + }
  28 +}
  1 +package company
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/company"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func SystemCompanySearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.CompanySearchRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 +
  21 + l := company.NewSystemCompanySearchLogic(r.Context(), svcCtx)
  22 + resp, err := l.SystemCompanySearch(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package department
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/department"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func SystemAddHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.DepartmentAddRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + result.ParamErrorResult(r, w, err)
  18 + return
  19 + }
  20 +
  21 + l := department.NewSystemAddLogic(r.Context(), svcCtx)
  22 + resp, err := l.SystemAdd(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package department
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/department"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func SystemDeleteHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.DepartmentGetRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + result.ParamErrorResult(r, w, err)
  18 + return
  19 + }
  20 +
  21 + l := department.NewSystemDeleteLogic(r.Context(), svcCtx)
  22 + resp, err := l.SystemDelete(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package department
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/department"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func SystemGetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.DepartmentGetRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + result.ParamErrorResult(r, w, err)
  18 + return
  19 + }
  20 +
  21 + l := department.NewSystemGetLogic(r.Context(), svcCtx)
  22 + resp, err := l.SystemGet(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package department
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/department"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func SystemListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.DepartmentListRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + result.ParamErrorResult(r, w, err)
  18 + return
  19 + }
  20 +
  21 + l := department.NewSystemListLogic(r.Context(), svcCtx)
  22 + resp, err := l.SystemList(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package department
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/department"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func SystemUpdateHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.DepartmentUpdateRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + result.ParamErrorResult(r, w, err)
  18 + return
  19 + }
  20 +
  21 + l := department.NewSystemUpdateLogic(r.Context(), svcCtx)
  22 + resp, err := l.SystemUpdate(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package message
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
  5 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  6 + "net/http"
  7 +
  8 + "github.com/zeromicro/go-zero/rest/httpx"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/message"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  12 +)
  13 +
  14 +func MiniCommentHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  15 + return func(w http.ResponseWriter, r *http.Request) {
  16 + var req types.MessageRequest
  17 + if err := httpx.Parse(r, &req); err != nil {
  18 + result.ParamErrorResult(r, w, err)
  19 + return
  20 + }
  21 +
  22 + l := message.NewMiniBusinessLogic(r.Context(), svcCtx)
  23 + resp, err := l.MiniBusiness(&req, domain.MsgTypeReply)
  24 + result.HttpResult(r, w, resp, err)
  25 + }
  26 +}
  1 +package message
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
  5 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  6 + "net/http"
  7 +
  8 + "github.com/zeromicro/go-zero/rest/httpx"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/message"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  12 +)
  13 +
  14 +func MiniLikeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  15 + return func(w http.ResponseWriter, r *http.Request) {
  16 + var req types.MessageRequest
  17 + if err := httpx.Parse(r, &req); err != nil {
  18 + result.ParamErrorResult(r, w, err)
  19 + return
  20 + }
  21 +
  22 + l := message.NewMiniBusinessLogic(r.Context(), svcCtx)
  23 + resp, err := l.MiniBusiness(&req, domain.MsgTypeLike)
  24 + result.HttpResult(r, w, resp, err)
  25 + }
  26 +}
  1 +package message
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/message"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func MiniSystemHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.MessageRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + result.ParamErrorResult(r, w, err)
  18 + return
  19 + }
  20 +
  21 + l := message.NewMiniSystemLogic(r.Context(), svcCtx)
  22 + resp, err := l.MiniSystem(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package role
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/role"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func SystemDeleteRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.RoleDeleteRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 +
  21 + l := role.NewSystemDeleteRoleLogic(r.Context(), svcCtx)
  22 + resp, err := l.SystemDeleteRole(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package role
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/role"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 +)
  10 +
  11 +func SystemGetRoleAuthsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  12 + return func(w http.ResponseWriter, r *http.Request) {
  13 + l := role.NewSystemGetRoleAuthsLogic(r.Context(), svcCtx)
  14 + resp, err := l.SystemGetRoleAuths()
  15 + result.HttpResult(r, w, resp, err)
  16 + }
  17 +}
  1 +package role
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/role"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func SystemGetRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.RoleGetRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 +
  21 + l := role.NewSystemGetRoleLogic(r.Context(), svcCtx)
  22 + resp, err := l.SystemGetRole(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package role
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/role"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func SystemSaveRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.RoleSaveRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 +
  21 + l := role.NewSystemSaveRoleLogic(r.Context(), svcCtx)
  22 + resp, err := l.SystemSaveRole(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package role
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/role"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func SystemSearchRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.RoleSearchRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 +
  21 + l := role.NewSystemSearchRoleLogic(r.Context(), svcCtx)
  22 + resp, err := l.SystemSearchRole(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
  1 +package role
  2 +
  3 +import (
  4 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  5 + "net/http"
  6 +
  7 + "github.com/zeromicro/go-zero/rest/httpx"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/role"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  11 +)
  12 +
  13 +func SystemUpdateRoleHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  14 + return func(w http.ResponseWriter, r *http.Request) {
  15 + var req types.RoleUpdateRequest
  16 + if err := httpx.Parse(r, &req); err != nil {
  17 + httpx.ErrorCtx(r.Context(), w, err)
  18 + return
  19 + }
  20 +
  21 + l := role.NewSystemUpdateRoleLogic(r.Context(), svcCtx)
  22 + resp, err := l.SystemUpdateRole(&req)
  23 + result.HttpResult(r, w, resp, err)
  24 + }
  25 +}
@@ -4,7 +4,15 @@ package handler @@ -4,7 +4,15 @@ package handler
4 import ( 4 import (
5 "net/http" 5 "net/http"
6 6
7 - tool "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/tool" 7 + article "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/article"
  8 + comment "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/comment"
  9 + common "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/common"
  10 + company "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/company"
  11 + department "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/department"
  12 + message "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/message"
  13 + role "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/role"
  14 + tags "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/tags"
  15 + user "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/user"
8 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 16 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
9 17
10 "github.com/zeromicro/go-zero/rest" 18 "github.com/zeromicro/go-zero/rest"
@@ -15,10 +23,634 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { @@ -15,10 +23,634 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
15 []rest.Route{ 23 []rest.Route{
16 { 24 {
17 Method: http.MethodGet, 25 Method: http.MethodGet,
18 - Path: "/health",  
19 - Handler: tool.MiniHealthHandler(serverCtx), 26 + Path: "/log/:module",
  27 + Handler: common.CommonGetLogHandler(serverCtx),
20 }, 28 },
21 }, 29 },
22 rest.WithPrefix("/v1"), 30 rest.WithPrefix("/v1"),
23 ) 31 )
  32 +
  33 + server.AddRoutes(
  34 + rest.WithMiddlewares(
  35 + []rest.Middleware{serverCtx.LogRequest},
  36 + []rest.Route{
  37 + {
  38 + Method: http.MethodPost,
  39 + Path: "/common/sms/code",
  40 + Handler: common.CommonSmsCodeHandler(serverCtx),
  41 + },
  42 + {
  43 + Method: http.MethodPost,
  44 + Path: "/mini/qrcode",
  45 + Handler: common.MiniQrcodeInviteHandler(serverCtx),
  46 + },
  47 + {
  48 + Method: http.MethodGet,
  49 + Path: "/clear",
  50 + Handler: common.CommonGetClearCacheHandler(serverCtx),
  51 + },
  52 + }...,
  53 + ),
  54 + rest.WithPrefix("/v1"),
  55 + )
  56 +
  57 + server.AddRoutes(
  58 + rest.WithMiddlewares(
  59 + []rest.Middleware{serverCtx.LogRequest},
  60 + []rest.Route{
  61 + {
  62 + Method: http.MethodPost,
  63 + Path: "/article_comment",
  64 + Handler: comment.MiniCreateArticleCommentHandler(serverCtx),
  65 + },
  66 + {
  67 + Method: http.MethodPost,
  68 + Path: "/article_comment/list",
  69 + Handler: comment.MiniListArticleCommentHandler(serverCtx),
  70 + },
  71 + {
  72 + Method: http.MethodPost,
  73 + Path: "/article_comment/list_reply",
  74 + Handler: comment.MiniListReplyArticleCommentHandler(serverCtx),
  75 + },
  76 + {
  77 + Method: http.MethodPost,
  78 + Path: "/article_comment/top5",
  79 + Handler: comment.MiniTop5ArticleCommentHandler(serverCtx),
  80 + },
  81 + {
  82 + Method: http.MethodGet,
  83 + Path: "/article_comment/:id",
  84 + Handler: comment.MiniGetArticleCommentHandler(serverCtx),
  85 + },
  86 + {
  87 + Method: http.MethodDelete,
  88 + Path: "/article_comment/:id",
  89 + Handler: comment.MiniDeleteArticleCommentHandler(serverCtx),
  90 + },
  91 + {
  92 + Method: http.MethodPost,
  93 + Path: "/article_comment/at_who/list",
  94 + Handler: comment.MiniArticleCommentAtWhoHandler(serverCtx),
  95 + },
  96 + }...,
  97 + ),
  98 + rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
  99 + rest.WithPrefix("/v1/mini"),
  100 + )
  101 +
  102 + server.AddRoutes(
  103 + rest.WithMiddlewares(
  104 + []rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest},
  105 + []rest.Route{
  106 + {
  107 + Method: http.MethodPost,
  108 + Path: "/article_comment/search/me",
  109 + Handler: comment.SystemArticleCommentSearchMeHandler(serverCtx),
  110 + },
  111 + {
  112 + Method: http.MethodPost,
  113 + Path: "/article_comment/search",
  114 + Handler: comment.SystemArticleCommentSearchHandler(serverCtx),
  115 + },
  116 + {
  117 + Method: http.MethodPost,
  118 + Path: "/article_comment/list",
  119 + Handler: comment.SystemListAticleCommentHandler(serverCtx),
  120 + },
  121 + {
  122 + Method: http.MethodGet,
  123 + Path: "/article_comment/:id",
  124 + Handler: comment.SystemGetAticleCommentHandler(serverCtx),
  125 + },
  126 + {
  127 + Method: http.MethodPost,
  128 + Path: "/article_comment/edit_show",
  129 + Handler: comment.SystemEditAticleCommentShowHandler(serverCtx),
  130 + },
  131 + {
  132 + Method: http.MethodPost,
  133 + Path: "/article_comment/edit",
  134 + Handler: comment.SystemEditAticleCommentHandler(serverCtx),
  135 + },
  136 + {
  137 + Method: http.MethodPost,
  138 + Path: "/article_comment/edit/love",
  139 + Handler: comment.SystemEditAticleCommentLoveHandler(serverCtx),
  140 + },
  141 + }...,
  142 + ),
  143 + rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
  144 + rest.WithPrefix("/v1/system"),
  145 + )
  146 +
  147 + server.AddRoutes(
  148 + rest.WithMiddlewares(
  149 + []rest.Middleware{serverCtx.LogRequest},
  150 + []rest.Route{
  151 + {
  152 + Method: http.MethodPost,
  153 + Path: "/mini/message/system",
  154 + Handler: message.MiniSystemHandler(serverCtx),
  155 + },
  156 + {
  157 + Method: http.MethodPost,
  158 + Path: "/mini/message/comment",
  159 + Handler: message.MiniCommentHandler(serverCtx),
  160 + },
  161 + {
  162 + Method: http.MethodPost,
  163 + Path: "/mini/message/like",
  164 + Handler: message.MiniLikeHandler(serverCtx),
  165 + },
  166 + }...,
  167 + ),
  168 + rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
  169 + rest.WithPrefix("/v1"),
  170 + )
  171 +
  172 + server.AddRoutes(
  173 + rest.WithMiddlewares(
  174 + []rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest},
  175 + []rest.Route{
  176 + {
  177 + Method: http.MethodPost,
  178 + Path: "/article_tag",
  179 + Handler: tags.CreateTagHandler(serverCtx),
  180 + },
  181 + {
  182 + Method: http.MethodPut,
  183 + Path: "/article_tag",
  184 + Handler: tags.EditTagHandler(serverCtx),
  185 + },
  186 + {
  187 + Method: http.MethodGet,
  188 + Path: "/article_tag/:id",
  189 + Handler: tags.GetTagHandler(serverCtx),
  190 + },
  191 + {
  192 + Method: http.MethodDelete,
  193 + Path: "/article_tag/:id",
  194 + Handler: tags.DeleteTagHandler(serverCtx),
  195 + },
  196 + {
  197 + Method: http.MethodPost,
  198 + Path: "/article_tag/search",
  199 + Handler: tags.SearchTagHandler(serverCtx),
  200 + },
  201 + {
  202 + Method: http.MethodGet,
  203 + Path: "/article_tag/options",
  204 + Handler: tags.OptionsHandler(serverCtx),
  205 + },
  206 + }...,
  207 + ),
  208 + rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
  209 + rest.WithPrefix("/v1/system"),
  210 + )
  211 +
  212 + server.AddRoutes(
  213 + []rest.Route{
  214 + {
  215 + Method: http.MethodPost,
  216 + Path: "/mini/user/apply_join_company",
  217 + Handler: user.MiniUserApplyJoinCompanyHandler(serverCtx),
  218 + },
  219 + {
  220 + Method: http.MethodPost,
  221 + Path: "/mini/user/login",
  222 + Handler: user.MiniUserLoginHandler(serverCtx),
  223 + },
  224 + },
  225 + rest.WithPrefix("/v1"),
  226 + )
  227 +
  228 + server.AddRoutes(
  229 + rest.WithMiddlewares(
  230 + []rest.Middleware{serverCtx.LogRequest},
  231 + []rest.Route{
  232 + {
  233 + Method: http.MethodPost,
  234 + Path: "/mini/user/switch_account",
  235 + Handler: user.MiniUserSwitchAccountHandler(serverCtx),
  236 + },
  237 + {
  238 + Method: http.MethodPost,
  239 + Path: "/mini/user/info",
  240 + Handler: user.MiniUserInfoHandler(serverCtx),
  241 + },
  242 + {
  243 + Method: http.MethodPost,
  244 + Path: "/mini/user/info/edit",
  245 + Handler: user.MiniEditUserInfoHandler(serverCtx),
  246 + },
  247 + {
  248 + Method: http.MethodPost,
  249 + Path: "/mini/user/statistics",
  250 + Handler: user.MiniUserStatisticsHandler(serverCtx),
  251 + },
  252 + {
  253 + Method: http.MethodPost,
  254 + Path: "/mini/user/audit_list",
  255 + Handler: user.MiniUserAuditListHandler(serverCtx),
  256 + },
  257 + {
  258 + Method: http.MethodPost,
  259 + Path: "/mini/user/audit",
  260 + Handler: user.MiniUserAuditHandler(serverCtx),
  261 + },
  262 + {
  263 + Method: http.MethodPost,
  264 + Path: "/mini/user/department_users",
  265 + Handler: user.MiniUserDepartmentUsersHandler(serverCtx),
  266 + },
  267 + {
  268 + Method: http.MethodPost,
  269 + Path: "/mini/user/user_list",
  270 + Handler: user.MiniUsersListHandler(serverCtx),
  271 + },
  272 + {
  273 + Method: http.MethodPost,
  274 + Path: "/mini/user/news",
  275 + Handler: user.MiniUserNewsHandler(serverCtx),
  276 + },
  277 + {
  278 + Method: http.MethodPost,
  279 + Path: "/mini/user/my_following_news",
  280 + Handler: user.MiniUserMyFollowingNewsHandler(serverCtx),
  281 + },
  282 + {
  283 + Method: http.MethodPost,
  284 + Path: "/mini/user/follower",
  285 + Handler: user.MiniUserFollowerHandler(serverCtx),
  286 + },
  287 + {
  288 + Method: http.MethodPost,
  289 + Path: "/mini/user/following",
  290 + Handler: user.MiniUserFollowingHandler(serverCtx),
  291 + },
  292 + {
  293 + Method: http.MethodPost,
  294 + Path: "/mini/user/following/latest_unread_list",
  295 + Handler: user.MiniUserFollowingLatestUnreadListHandler(serverCtx),
  296 + },
  297 + {
  298 + Method: http.MethodPost,
  299 + Path: "/mini/user/following/mark_read",
  300 + Handler: user.MiniUserFollowingMarkReadHandler(serverCtx),
  301 + },
  302 + {
  303 + Method: http.MethodPost,
  304 + Path: "/mini/user/follow",
  305 + Handler: user.MiniUserFollowHandler(serverCtx),
  306 + },
  307 + {
  308 + Method: http.MethodPost,
  309 + Path: "/mini/user/unfollow",
  310 + Handler: user.MiniUserUnFollowHandler(serverCtx),
  311 + },
  312 + {
  313 + Method: http.MethodPost,
  314 + Path: "/mini/user/mylike",
  315 + Handler: user.MiniMyLikeHandler(serverCtx),
  316 + },
  317 + {
  318 + Method: http.MethodPost,
  319 + Path: "/mini/user/mybeliked",
  320 + Handler: user.MiniMyBeLikedHandler(serverCtx),
  321 + },
  322 + }...,
  323 + ),
  324 + rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
  325 + rest.WithPrefix("/v1"),
  326 + )
  327 +
  328 + server.AddRoutes(
  329 + rest.WithMiddlewares(
  330 + []rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest},
  331 + []rest.Route{
  332 + {
  333 + Method: http.MethodPost,
  334 + Path: "/system/user/info",
  335 + Handler: user.SystemUserInfoHandler(serverCtx),
  336 + },
  337 + {
  338 + Method: http.MethodPost,
  339 + Path: "/system/user/statistics",
  340 + Handler: user.SystemUserStatisticsHandler(serverCtx),
  341 + },
  342 + {
  343 + Method: http.MethodPost,
  344 + Path: "/system/user/user_list",
  345 + Handler: user.SystemUsersListHandler(serverCtx),
  346 + },
  347 + {
  348 + Method: http.MethodGet,
  349 + Path: "/system/user/:id",
  350 + Handler: user.SystemUserGetHandler(serverCtx),
  351 + },
  352 + {
  353 + Method: http.MethodPut,
  354 + Path: "/system/user/:id",
  355 + Handler: user.SystemUserUpdateHandler(serverCtx),
  356 + },
  357 + {
  358 + Method: http.MethodPost,
  359 + Path: "/system/user/search",
  360 + Handler: user.SystemUserSearchHandler(serverCtx),
  361 + },
  362 + {
  363 + Method: http.MethodGet,
  364 + Path: "/system/account/:id",
  365 + Handler: user.SystemUserAccountGetHandler(serverCtx),
  366 + },
  367 + {
  368 + Method: http.MethodPost,
  369 + Path: "/system/account",
  370 + Handler: user.SystemUserAccountSaveHandler(serverCtx),
  371 + },
  372 + {
  373 + Method: http.MethodPost,
  374 + Path: "/system/account/enable",
  375 + Handler: user.SystemUserAccountEnableHandler(serverCtx),
  376 + },
  377 + {
  378 + Method: http.MethodPut,
  379 + Path: "/system/account/:id",
  380 + Handler: user.SystemUserAccountUpdateHandler(serverCtx),
  381 + },
  382 + {
  383 + Method: http.MethodPost,
  384 + Path: "/system/account/search",
  385 + Handler: user.SystemUserAccountSearchHandler(serverCtx),
  386 + },
  387 + }...,
  388 + ),
  389 + rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
  390 + rest.WithPrefix("/v1"),
  391 + )
  392 +
  393 + server.AddRoutes(
  394 + rest.WithMiddlewares(
  395 + []rest.Middleware{serverCtx.LogRequest},
  396 + []rest.Route{
  397 + {
  398 + Method: http.MethodPost,
  399 + Path: "/mini/company/search",
  400 + Handler: company.MiniCompanySearchHandler(serverCtx),
  401 + },
  402 + }...,
  403 + ),
  404 + rest.WithPrefix("/v1"),
  405 + )
  406 +
  407 + server.AddRoutes(
  408 + rest.WithMiddlewares(
  409 + []rest.Middleware{serverCtx.LogRequest},
  410 + []rest.Route{
  411 + {
  412 + Method: http.MethodPost,
  413 + Path: "/mini/company/search-joined",
  414 + Handler: company.MiniCompanySearchJoinedHandler(serverCtx),
  415 + },
  416 + }...,
  417 + ),
  418 + rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
  419 + rest.WithPrefix("/v1"),
  420 + )
  421 +
  422 + server.AddRoutes(
  423 + rest.WithMiddlewares(
  424 + []rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest},
  425 + []rest.Route{
  426 + {
  427 + Method: http.MethodPost,
  428 + Path: "/system/company/search",
  429 + Handler: company.SystemCompanySearchHandler(serverCtx),
  430 + },
  431 + {
  432 + Method: http.MethodPost,
  433 + Path: "/system/company/positions/search",
  434 + Handler: company.SystemCompanyPositionsSearchHandler(serverCtx),
  435 + },
  436 + }...,
  437 + ),
  438 + rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
  439 + rest.WithPrefix("/v1"),
  440 + )
  441 +
  442 + server.AddRoutes(
  443 + rest.WithMiddlewares(
  444 + []rest.Middleware{serverCtx.LogRequest},
  445 + []rest.Route{
  446 + {
  447 + Method: http.MethodPost,
  448 + Path: "/article",
  449 + Handler: article.MiniCreateArticleHandler(serverCtx),
  450 + },
  451 + {
  452 + Method: http.MethodGet,
  453 + Path: "/article/:id",
  454 + Handler: article.MiniGetArticleHandler(serverCtx),
  455 + },
  456 + {
  457 + Method: http.MethodPost,
  458 + Path: "/article/user_like/list",
  459 + Handler: article.MiniUserLikeArticleHandler(serverCtx),
  460 + },
  461 + {
  462 + Method: http.MethodPost,
  463 + Path: "/article/user_like/set",
  464 + Handler: article.MiniSetUserLikeHandler(serverCtx),
  465 + },
  466 + {
  467 + Method: http.MethodPost,
  468 + Path: "/article/mark/user_read",
  469 + Handler: article.MiniArticleMarkUserReadHandler(serverCtx),
  470 + },
  471 + {
  472 + Method: http.MethodPost,
  473 + Path: "/article/mark/list",
  474 + Handler: article.MiniArticleMarkListHandler(serverCtx),
  475 + },
  476 + {
  477 + Method: http.MethodPost,
  478 + Path: "/article/search/me",
  479 + Handler: article.MiniArticleSearchMeHandler(serverCtx),
  480 + },
  481 + {
  482 + Method: http.MethodPost,
  483 + Path: "/article_draft",
  484 + Handler: article.MiniCreateArticleDraftHandler(serverCtx),
  485 + },
  486 + {
  487 + Method: http.MethodPut,
  488 + Path: "/article_draft",
  489 + Handler: article.MiniUpdateArticleDraftHandler(serverCtx),
  490 + },
  491 + {
  492 + Method: http.MethodPost,
  493 + Path: "/article_draft/search/me",
  494 + Handler: article.MiniSearchArticleDraftMeHandler(serverCtx),
  495 + },
  496 + {
  497 + Method: http.MethodGet,
  498 + Path: "/article_draft/me/:id",
  499 + Handler: article.MiniGetArticleDraftMeHandler(serverCtx),
  500 + },
  501 + {
  502 + Method: http.MethodDelete,
  503 + Path: "/article_draft/me/:id",
  504 + Handler: article.MiniDeleteArticleDraftMeHandler(serverCtx),
  505 + },
  506 + {
  507 + Method: http.MethodPost,
  508 + Path: "/article_backup/search",
  509 + Handler: article.MiniArticleBackupSearchHandler(serverCtx),
  510 + },
  511 + {
  512 + Method: http.MethodPost,
  513 + Path: "/article/set_tag",
  514 + Handler: article.MiniArticleSetTagHandler(serverCtx),
  515 + },
  516 + {
  517 + Method: http.MethodGet,
  518 + Path: "/article_tag/list/all",
  519 + Handler: article.MiniAllArticleTagHandler(serverCtx),
  520 + },
  521 + {
  522 + Method: http.MethodGet,
  523 + Path: "/show/home_page",
  524 + Handler: article.MiniShowHomePageHandler(serverCtx),
  525 + },
  526 + {
  527 + Method: http.MethodPost,
  528 + Path: "/show/search_article",
  529 + Handler: article.MiniSearchArticlePageHandler(serverCtx),
  530 + },
  531 + }...,
  532 + ),
  533 + rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
  534 + rest.WithPrefix("/v1/mini"),
  535 + )
  536 +
  537 + server.AddRoutes(
  538 + rest.WithMiddlewares(
  539 + []rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest},
  540 + []rest.Route{
  541 + {
  542 + Method: http.MethodGet,
  543 + Path: "/article/:id",
  544 + Handler: article.SystemGetArticleHandler(serverCtx),
  545 + },
  546 + {
  547 + Method: http.MethodPost,
  548 + Path: "/article/search",
  549 + Handler: article.SystemSearchArticleHandler(serverCtx),
  550 + },
  551 + {
  552 + Method: http.MethodPut,
  553 + Path: "/article",
  554 + Handler: article.SystemUpdateArticleHandler(serverCtx),
  555 + },
  556 + {
  557 + Method: http.MethodPost,
  558 + Path: "/article/history",
  559 + Handler: article.SystemHistoryArticleHandler(serverCtx),
  560 + },
  561 + {
  562 + Method: http.MethodGet,
  563 + Path: "/article/history/:id",
  564 + Handler: article.SystemArticleGetHistoryHandler(serverCtx),
  565 + },
  566 + {
  567 + Method: http.MethodPost,
  568 + Path: "/article/search/me",
  569 + Handler: article.SystemArticleSearchMeHandler(serverCtx),
  570 + },
  571 + {
  572 + Method: http.MethodPost,
  573 + Path: "/article/restore",
  574 + Handler: article.SystemArticleRestoreHandler(serverCtx),
  575 + },
  576 + }...,
  577 + ),
  578 + rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
  579 + rest.WithPrefix("/v1/system"),
  580 + )
  581 +
  582 + server.AddRoutes(
  583 + rest.WithMiddlewares(
  584 + []rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest},
  585 + []rest.Route{
  586 + {
  587 + Method: http.MethodGet,
  588 + Path: "/system/role/:id",
  589 + Handler: role.SystemGetRoleHandler(serverCtx),
  590 + },
  591 + {
  592 + Method: http.MethodPost,
  593 + Path: "/system/role",
  594 + Handler: role.SystemSaveRoleHandler(serverCtx),
  595 + },
  596 + {
  597 + Method: http.MethodDelete,
  598 + Path: "/system/role/:id",
  599 + Handler: role.SystemDeleteRoleHandler(serverCtx),
  600 + },
  601 + {
  602 + Method: http.MethodPut,
  603 + Path: "/system/role/:id",
  604 + Handler: role.SystemUpdateRoleHandler(serverCtx),
  605 + },
  606 + {
  607 + Method: http.MethodPost,
  608 + Path: "/system/role/search",
  609 + Handler: role.SystemSearchRoleHandler(serverCtx),
  610 + },
  611 + {
  612 + Method: http.MethodGet,
  613 + Path: "/system/role/auths",
  614 + Handler: role.SystemGetRoleAuthsHandler(serverCtx),
  615 + },
  616 + }...,
  617 + ),
  618 + rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
  619 + rest.WithPrefix("/v1"),
  620 + )
  621 +
  622 + server.AddRoutes(
  623 + rest.WithMiddlewares(
  624 + []rest.Middleware{serverCtx.LoginStatusCheck, serverCtx.LogRequest},
  625 + []rest.Route{
  626 + {
  627 + Method: http.MethodPost,
  628 + Path: "/system/department/list",
  629 + Handler: department.SystemListHandler(serverCtx),
  630 + },
  631 + {
  632 + Method: http.MethodPost,
  633 + Path: "/system/department/add",
  634 + Handler: department.SystemAddHandler(serverCtx),
  635 + },
  636 + {
  637 + Method: http.MethodGet,
  638 + Path: "/system/department/:id",
  639 + Handler: department.SystemGetHandler(serverCtx),
  640 + },
  641 + {
  642 + Method: http.MethodPut,
  643 + Path: "/system/department/:id",
  644 + Handler: department.SystemUpdateHandler(serverCtx),
  645 + },
  646 + {
  647 + Method: http.MethodDelete,
  648 + Path: "/system/department/:id",
  649 + Handler: department.SystemDeleteHandler(serverCtx),
  650 + },
  651 + }...,
  652 + ),
  653 + rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
  654 + rest.WithPrefix("/v1"),
  655 + )
24 } 656 }
  1 +package tags
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +func CreateTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  15 + return func(w http.ResponseWriter, r *http.Request) {
  16 + var req types.TagCreateRequest
  17 + if err := httpx.Parse(r, &req); err != nil {
  18 + result.HttpResult(r, w, nil, err)
  19 + return
  20 + }
  21 +
  22 + l := tags.NewCreateTagLogic(r.Context(), svcCtx)
  23 + token := contextdata.GetUserTokenFromCtx(r.Context())
  24 + req.CompanyId = token.CompanyId
  25 + resp, err := l.CreateTag(&req)
  26 + result.HttpResult(r, w, resp, err)
  27 + }
  28 +}
  1 +package tags
  2 +
  3 +import (
  4 + "net/http"
  5 +
  6 + "github.com/zeromicro/go-zero/rest/httpx"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/logic/tags"
  8 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  9 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  10 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/contextdata"
  11 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result"
  12 +)
  13 +
  14 +func DeleteTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  15 + return func(w http.ResponseWriter, r *http.Request) {
  16 + var req types.TagDeleteRequest
  17 + if err := httpx.Parse(r, &req); err != nil {
  18 + result.HttpResult(r, w, nil, err)
  19 + return
  20 + }
  21 +
  22 + l := tags.NewDeleteTagLogic(r.Context(), svcCtx)
  23 + token := contextdata.GetUserTokenFromCtx(r.Context())
  24 + req.CompanyId = token.CompanyId
  25 + resp, err := l.DeleteTag(&req)
  26 + result.HttpResult(r, w, resp, err)
  27 + }
  28 +}