作者 郑周

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	cmd/discuss/interanl/pkg/db/migrate.go
正在显示 59 个修改的文件 包含 1692 行增加58 行删除
@@ -33,3 +33,4 @@ lastupdate.tmp @@ -33,3 +33,4 @@ lastupdate.tmp
33 public/* 33 public/*
34 logs/ 34 logs/
35 cmd/discuss/api/api 35 cmd/discuss/api/api
  36 +discuss
@@ -2,11 +2,12 @@ package main @@ -2,11 +2,12 @@ package main
2 2
3 import ( 3 import (
4 "flag" 4 "flag"
  5 + "net/http"
  6 + "strings"
  7 +
5 "github.com/zeromicro/go-zero/core/logx" 8 "github.com/zeromicro/go-zero/core/logx"
6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db" 9 "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" 10 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
8 - "net/http"  
9 - "strings"  
10 11
11 "github.com/golang-jwt/jwt/v4/request" 12 "github.com/golang-jwt/jwt/v4/request"
12 "github.com/zeromicro/go-zero/core/conf" 13 "github.com/zeromicro/go-zero/core/conf"
1 import "core/comment.api" 1 import "core/comment.api"
2 -import "core/message.api"  
  2 +import "core/message.api"
  3 +import "core/article_tag.api"
  4 +import "core/user.api"
  5 +import "core/company.api"
  1 +syntax = "v1"
  2 +
  3 +info(
  4 + title: "文章内容处理"
  5 + desc: "编辑处理文章内容"
  6 + author: "author"
  7 + email: "email"
  8 + version: "v1"
  9 +)
  10 +
  11 +// 坐标地点描述
  12 +type Location {
  13 + Longitude float64 `json:"longitude"` //经度
  14 + Latitude float64 `json:"latitude"` //纬度
  15 + Descript string `json:"descript"` //地点描述
  16 +}
  17 +
  18 +// 人员的简单展示信息
  19 +type Author {
  20 + Id int64 `json:"id"` // 人员id
  21 + Name string `json:"name"` // 人员的名字
  22 + Avatar string `json:"avatar"` // 人员头像URL
  23 + Group string `json:"group"` // 人员的分组
  24 + Position string `json:"position"` // 职位
  25 +}
  26 +
  27 +// 创建发布文章
  28 +type (
  29 + ArticleCreateRequest {
  30 + Title string `json:"title"` //标题
  31 + Section []string `json:"section"` //文章的文本内容
  32 + AuthorId int `json:"authorId"` //发布人id
  33 + Images []string `json:"images"` //图片
  34 + WhoRead []int `json:"whoRead"` //谁可查看
  35 + WhoReview []int `json:"whoReview"` //谁可评论
  36 + Location Location `json:"location"` //定位坐标
  37 + }
  38 + ArticleCreateResponse {
  39 + Id int64 `json:"id"`
  40 + }
  41 +)
  42 +
  43 +// 查看文章的详情
  44 +type (
  45 + ArticleGetRequest {
  46 + Id int64 `json:"id"` //id
  47 + }
  48 + ArticleGetResponse {
  49 + Title string `json:"title"` //标题
  50 + AuthorId int `json:"authorId"` //发布人id
  51 + Author Author `json:"author"` //发布人
  52 + CreatedAt int64 `json:"createdAt"` //文章的发布时间
  53 + Section []string `json:"section"` //文章的文本内容
  54 + Images []string `json:"images"` //图片
  55 + WhoRead []int `json:"whoRead"` //谁可查看
  56 + WhoReview []int `json:"whoReview"` //谁可评论
  57 + Location Location `json:"location"` //定位坐标
  58 + CountLove int `json:"countLove"` // 点赞数量
  59 + CountComment int `json:"countComment"` // 评论数量
  60 + Show int `json:"showState"` // 评论的展示状态(0显示、1不显示)
  61 + }
  62 +)
  63 +
  64 +// 小程序接口
  65 +@server(
  66 + prefix: v1/mini
  67 + group: article
  68 + jwt: MiniAuth
  69 +)
  70 +service Core {
  71 + @doc "小程序创建发布内容"
  72 + @handler CreateArticle
  73 + post /article (ArticleCreateRequest) returns (ArticleCreateResponse)
  74 + @doc "小程序获取文章内容详情"
  75 + @handler GetArticle
  76 + get /article/:id (ArticleGetRequest) returns (ArticleGetResponse)
  77 +}
  1 +syntax = "v1"
  2 +
  3 +info(
  4 + title: "后台编辑标签"
  5 + desc: "编辑处理标签信息"
  6 + author: "author"
  7 + email: "email"
  8 + version: "v1"
  9 +)
  10 +
  11 +// 创建标签
  12 +type (
  13 + TagCreateRequest {
  14 + CompanyId int64 `json:"companyId"`
  15 + Image string `json:"image"`
  16 + Name string `json:"name"` // 标签名称
  17 + Group string `json:"group"` // 标签分类
  18 + Remark string `json:"remark"` // 备注
  19 + }
  20 +
  21 + TagCreateResponse {
  22 + Id int64 `json:"id"`
  23 + }
  24 +)
  25 +
  26 +// 编辑标签
  27 +type (
  28 + TagEditRequest {
  29 + Id int64 `json:"id"`
  30 + CompanyId int64 `json:"companyId"`
  31 + Image string `json:"image"`
  32 + Name string `json:"name"` // 标签名称
  33 + Group string `json:"group"` // 标签分类
  34 + Remark string `json:"remark"` // 备注
  35 + }
  36 +
  37 + TagEditResponse {
  38 + Id int64 `json:"id"`
  39 + }
  40 +)
  41 +
  42 +// 获取标签详情
  43 +type (
  44 + TagGetRequest {
  45 + Id int64 `json:"id"`
  46 + }
  47 + TagGetResponse {
  48 + Id int64 `json:"id"`
  49 + Image string `json:"image"`
  50 + Name string `json:"name"` // 标签名称
  51 + Group string `json:"group"` // 标签分类
  52 + Remark string `json:"remark"` // 备注
  53 + }
  54 +)
  55 +
  56 +//标签列表
  57 +type (
  58 + TagListRequest {
  59 + Page int `json:"page"`
  60 + Size int `json:"size"`
  61 + }
  62 + TagListResponse {
  63 + Total int `json:"total"`
  64 + List []TagItem `json:"list"`
  65 + }
  66 + TagItem {
  67 + Id int64 `json:"id"`
  68 + Image string `json:"image"`
  69 + Name string `json:"name"` // 标签名称
  70 + Group string `json:"group"` // 标签分类
  71 + Remark string `json:"remark"` // 备注
  72 + CreatedAt int64 `json:"createdAt"`
  73 + }
  74 +)
  75 +
  76 +//删除标签
  77 +type (
  78 + TagDeleteRequest {
  79 + Id int64 `json:"id"`
  80 + }
  81 + TagDeleteResponse {
  82 + Id int64 `json:"id"`
  83 + }
  84 +)
  85 +
  86 +@server(
  87 + prefix: v1/mini
  88 + group: tags
  89 + jwt: MiniAuth
  90 +)
  91 +service Core {
  92 + @doc "后台创建文章标签"
  93 + @handler CreateTag
  94 + post /article_tag (TagCreateRequest) returns (TagCreateResponse)
  95 + @doc "后台编辑文章标签"
  96 + @handler EditTag
  97 + put /article_tag (TagEditRequest) returns (TagEditResponse)
  98 + @doc "后台获取文章标签"
  99 + @handler GetTag
  100 + get /article_tag/:id (TagGetRequest) returns (TagGetResponse)
  101 + @doc "后台删除文章标签"
  102 + @handler DeleteTag
  103 + delete /article_tag (TagDeleteRequest) returns (TagDeleteResponse)
  104 +}
  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 +)
  16 +service Core {
  17 + @doc "公司搜索"
  18 + @handler miniCompanySearch
  19 + post /mini/company/search(CompanySearchRequest) returns (CompanySearchResponse)
  20 +}
  21 +
  22 +// 小程序接口
  23 +@server(
  24 + prefix: v1
  25 + group: company
  26 + jwt : SystemAuth
  27 +)
  28 +service Core {
  29 + @doc "公司搜索"
  30 + @handler systemCompanySearch
  31 + post /system/company/search(CompanySearchRequest) returns (CompanySearchResponse)
  32 +}
  33 +
  34 +type (
  35 + CompanySearchRequest struct{
  36 + Page int `json:"page"`
  37 + Size int `json:"size"`
  38 + UserId int64 `json:"userId,optional"` // 按用户搜索
  39 + Code string `json:"code,optional"` // 按编码搜索
  40 + }
  41 + CompanySearchResponse{
  42 + List []Company `json:"list"`
  43 + Total int64 `json:"total"`
  44 + }
  45 + Company struct{
  46 + Id int64 `json:"id,omitempty"` // 唯一标识
  47 + Name string `json:"name,omitempty"` // 名称
  48 + Code string `json:"code,omitempty"` // 编码(搜索使用,4位字母数字)
  49 + Logo string `json:"logo,omitempty"` // 公司LOGO
  50 + }
  51 +)
  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 + jwt: MiniAuth
  28 +)
  29 +service Core {
  30 + @doc "用户信息"
  31 + @handler miniUserInfo
  32 + post /mini/user/info (MiniUserInfoRequest) returns (MiniUserInfoResponse)
  33 + @doc "用户审核列表"
  34 + @handler miniUserAuditList
  35 + post /mini/user/audit-list (UserSearchRequest)returns(UserSearchResponse)
  36 + @doc "用户审核"
  37 + @handler miniUserAudit
  38 + post /mini/user/audit (MiniUserAuditRequest)
  39 + @doc "部门用户列表"
  40 + @handler miniUserDepartmentUsers
  41 + post /mini/user/department-users (MiniUserDepartmentUsersRequest)returns (MiniUserInfoResponse)
  42 + @doc "关注我的人"
  43 + @handler miniUserFollower
  44 + post /mini/user/follower (UserSearchRequest)returns(UserSearchResponse)
  45 + @doc "我关注的人"
  46 + @handler miniUserFollowing
  47 + post /mini/user/following (UserSearchRequest)returns(UserSearchResponse)
  48 + @doc "关注"
  49 + @handler miniUserFollow
  50 + post /mini/user/follow (FollowRequest)
  51 + @doc "取消关注"
  52 + @handler miniUserUnFollow
  53 + post /mini/user/unfollow (FollowRequest)
  54 +}
  55 +
  56 +type(
  57 + MiniUserLoginRequest {
  58 + LoginType string `json:"loginType"` // 登录类型 wechat-login whchat-phone-login phone-password-login phone-smscode-login
  59 + WechatAuthCode string `json:"wechatAuthcode,optional"` // 微信登录 授权码
  60 + WechatEncryptedData string `json:"wechatEncryptedData,optional"` // 微信登录 加密数据
  61 + WechatIV string `json:"wechatIV,optional"` // 微信登录 加密算法初始向量
  62 + Phone string `json:"phone,optional"` // 手机号
  63 + Password string `json:"password,optional"` // 密码
  64 + SmsCode string `json:"smsCode,optional"` // 短信验证码
  65 + }
  66 + MiniUserLoginResponse {
  67 + Token string `json:"token"` // x-token
  68 + Phone string `json:"phone"` // 手机号
  69 + Message string `json:"message"` // 失败消息(审核中,注册成功等待审核)
  70 + Success bool `json:"success"` // 成功标识
  71 + }
  72 +
  73 + MiniUserInfoRequest {
  74 + //MyStatisticsFlag bool `json:"myStatisticsFlag"` // true:返回统计信息 false;统计信息不返回
  75 + }
  76 + MiniUserInfoResponse {
  77 + User *UserItem `json:"user,omitempty"` // 用户信息
  78 + TotalArticle int64 `json:"totalArticle"` // 累计信息发布
  79 + TotalLoved int64 `json:"totalLoved"` // 累计收到的赞
  80 + TotalAccepted int64 `json:"totalAccepted"` // 累计被采纳
  81 + }
  82 + MiniUserApplyJoinCompanyRequest{
  83 + Phone string `json:"phone"`
  84 + Code string `json:"code"`
  85 + }
  86 + MiniUserApplyJoinCompanyResponse{
  87 +
  88 + }
  89 + MiniUserAuditRequest{
  90 + UserId int64 `json:"userId"` // 用户ID
  91 + }
  92 + MiniUserDepartmentUsersRequest{
  93 +
  94 + }
  95 + MiniUserDepartmentUsersResponse{
  96 + Departments []*Department `json:"departments"`
  97 + Users []*UserItem `json:"users"`
  98 + }
  99 + UserItem {
  100 + CompanyId int64 `json:"companyId,omitempty"` // 公司ID
  101 + DepartmentId int64 `json:"departmentId,omitempty"` // 部门ID
  102 + Roles []int64 `json:"roleId,omitempty"` // 角色
  103 + Flag int `json:"flag,omitempty"` // 标识 1:管理员 2:普通用户 (有绑定角色是管理员)
  104 + Name string `json:"name,omitempty"` // 名称
  105 + Avatar string `json:"avatar,omitempty"` // 头像
  106 + Phone string `json:"phone,omitempty"` // 手机号 唯一
  107 + Position string `json:"position,omitempty"` // 职位
  108 + Enable int `json:"enable,omitempty"` // 启用状态 1:启用 2:禁用
  109 + AuditStatus int `json:"auditStatus,omitempty"` // 审核状态 0:待审核 1:审核通过 2:拒绝
  110 + Follower []int64 `json:"followers,omitempty"` // 关注我的人 (冗余)
  111 + Following []int64 `json:"following,omitempty"` // 我关注的人 (冗余)
  112 + }
  113 + Department struct {
  114 + Id int64 `json:"id,omitempty"` // 部门ID
  115 + CompanyId int64 `json:"companyId,omitempty"` // 公司ID
  116 + ParentId int64 `json:"parentId,omitempty"` // 父级ID
  117 + Name string `json:"name,omitempty"` // 部门名称
  118 + }
  119 + UserSearchRequest{
  120 + Page int `json:"page,optional"`
  121 + Size int `json:"size,optional"`
  122 + AuditFlag *int `json:"auditFlag,optional"` // 按审核状态 0:待审核 1:审核通过 2:拒绝
  123 + }
  124 + UserSearchResponse{
  125 + List []*UserItem `json:"list"`
  126 + Total int64 `json:"total"`
  127 + }
  128 + FollowRequest{
  129 + UserId int64 `json:"userId"`
  130 + }
  131 +)
  132 +
  133 +
  134 +// 后台接口
  135 +//@server(
  136 +// prefix: v1
  137 +// group: user
  138 +// jwt: SystemAuth
  139 +//)
  140 +//service Core {
  141 +// @doc "系统评论"
  142 +// @handler systemUser
  143 +// get /system/user () returns ()
  144 +//}
  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 MiniCompanySearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  13 + return func(w http.ResponseWriter, r *http.Request) {
  14 + var req types.CompanySearchRequest
  15 + if err := httpx.Parse(r, &req); err != nil {
  16 + httpx.ErrorCtx(r.Context(), w, err)
  17 + return
  18 + }
  19 +
  20 + l := company.NewMiniCompanySearchLogic(r.Context(), svcCtx)
  21 + resp, err := l.MiniCompanySearch(&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 + "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 SystemCompanySearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  13 + return func(w http.ResponseWriter, r *http.Request) {
  14 + var req types.CompanySearchRequest
  15 + if err := httpx.Parse(r, &req); err != nil {
  16 + httpx.ErrorCtx(r.Context(), w, err)
  17 + return
  18 + }
  19 +
  20 + l := company.NewSystemCompanySearchLogic(r.Context(), svcCtx)
  21 + resp, err := l.SystemCompanySearch(&req)
  22 + if err != nil {
  23 + httpx.ErrorCtx(r.Context(), w, err)
  24 + } else {
  25 + httpx.OkJsonCtx(r.Context(), w, resp)
  26 + }
  27 + }
  28 +}
@@ -5,7 +5,10 @@ import ( @@ -5,7 +5,10 @@ import (
5 "net/http" 5 "net/http"
6 6
7 comment "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/comment" 7 comment "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/comment"
  8 + company "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/company"
8 message "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/message" 9 message "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/message"
  10 + tags "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/tags"
  11 + user "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/user"
9 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc" 12 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
10 13
11 "github.com/zeromicro/go-zero/rest" 14 "github.com/zeromicro/go-zero/rest"
@@ -52,4 +55,117 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { @@ -52,4 +55,117 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
52 rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret), 55 rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
53 rest.WithPrefix("/v1"), 56 rest.WithPrefix("/v1"),
54 ) 57 )
  58 +
  59 + server.AddRoutes(
  60 + []rest.Route{
  61 + {
  62 + Method: http.MethodPost,
  63 + Path: "/article_tag",
  64 + Handler: tags.CreateTagHandler(serverCtx),
  65 + },
  66 + {
  67 + Method: http.MethodPut,
  68 + Path: "/article_tag",
  69 + Handler: tags.EditTagHandler(serverCtx),
  70 + },
  71 + {
  72 + Method: http.MethodGet,
  73 + Path: "/article_tag/:id",
  74 + Handler: tags.GetTagHandler(serverCtx),
  75 + },
  76 + {
  77 + Method: http.MethodDelete,
  78 + Path: "/article_tag",
  79 + Handler: tags.DeleteTagHandler(serverCtx),
  80 + },
  81 + },
  82 + rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
  83 + rest.WithPrefix("/v1/mini"),
  84 + )
  85 +
  86 + server.AddRoutes(
  87 + []rest.Route{
  88 + {
  89 + Method: http.MethodPost,
  90 + Path: "/mini/user/apply-join-company",
  91 + Handler: user.MiniUserApplyJoinCompanyHandler(serverCtx),
  92 + },
  93 + {
  94 + Method: http.MethodPost,
  95 + Path: "/mini/user/login",
  96 + Handler: user.MiniUserLoginHandler(serverCtx),
  97 + },
  98 + },
  99 + rest.WithPrefix("/v1"),
  100 + )
  101 +
  102 + server.AddRoutes(
  103 + []rest.Route{
  104 + {
  105 + Method: http.MethodPost,
  106 + Path: "/mini/user/info",
  107 + Handler: user.MiniUserInfoHandler(serverCtx),
  108 + },
  109 + {
  110 + Method: http.MethodPost,
  111 + Path: "/mini/user/audit-list",
  112 + Handler: user.MiniUserAuditListHandler(serverCtx),
  113 + },
  114 + {
  115 + Method: http.MethodPost,
  116 + Path: "/mini/user/audit",
  117 + Handler: user.MiniUserAuditHandler(serverCtx),
  118 + },
  119 + {
  120 + Method: http.MethodPost,
  121 + Path: "/mini/user/department-users",
  122 + Handler: user.MiniUserDepartmentUsersHandler(serverCtx),
  123 + },
  124 + {
  125 + Method: http.MethodPost,
  126 + Path: "/mini/user/follower",
  127 + Handler: user.MiniUserFollowerHandler(serverCtx),
  128 + },
  129 + {
  130 + Method: http.MethodPost,
  131 + Path: "/mini/user/following",
  132 + Handler: user.MiniUserFollowingHandler(serverCtx),
  133 + },
  134 + {
  135 + Method: http.MethodPost,
  136 + Path: "/mini/user/follow",
  137 + Handler: user.MiniUserFollowHandler(serverCtx),
  138 + },
  139 + {
  140 + Method: http.MethodPost,
  141 + Path: "/mini/user/unfollow",
  142 + Handler: user.MiniUserUnFollowHandler(serverCtx),
  143 + },
  144 + },
  145 + rest.WithJwt(serverCtx.Config.MiniAuth.AccessSecret),
  146 + rest.WithPrefix("/v1"),
  147 + )
  148 +
  149 + server.AddRoutes(
  150 + []rest.Route{
  151 + {
  152 + Method: http.MethodPost,
  153 + Path: "/mini/company/search",
  154 + Handler: company.MiniCompanySearchHandler(serverCtx),
  155 + },
  156 + },
  157 + rest.WithPrefix("/v1"),
  158 + )
  159 +
  160 + server.AddRoutes(
  161 + []rest.Route{
  162 + {
  163 + Method: http.MethodPost,
  164 + Path: "/system/company/search",
  165 + Handler: company.SystemCompanySearchHandler(serverCtx),
  166 + },
  167 + },
  168 + rest.WithJwt(serverCtx.Config.SystemAuth.AccessSecret),
  169 + rest.WithPrefix("/v1"),
  170 + )
55 } 171 }
  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 +)
  11 +
  12 +func CreateTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  13 + return func(w http.ResponseWriter, r *http.Request) {
  14 + var req types.TagCreateRequest
  15 + if err := httpx.Parse(r, &req); err != nil {
  16 + httpx.ErrorCtx(r.Context(), w, err)
  17 + return
  18 + }
  19 +
  20 + l := tags.NewCreateTagLogic(r.Context(), svcCtx)
  21 + resp, err := l.CreateTag(&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 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 +)
  11 +
  12 +func DeleteTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  13 + return func(w http.ResponseWriter, r *http.Request) {
  14 + var req types.TagDeleteRequest
  15 + if err := httpx.Parse(r, &req); err != nil {
  16 + httpx.ErrorCtx(r.Context(), w, err)
  17 + return
  18 + }
  19 +
  20 + l := tags.NewDeleteTagLogic(r.Context(), svcCtx)
  21 + resp, err := l.DeleteTag(&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 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 +)
  11 +
  12 +func EditTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  13 + return func(w http.ResponseWriter, r *http.Request) {
  14 + var req types.TagEditRequest
  15 + if err := httpx.Parse(r, &req); err != nil {
  16 + httpx.ErrorCtx(r.Context(), w, err)
  17 + return
  18 + }
  19 +
  20 + l := tags.NewEditTagLogic(r.Context(), svcCtx)
  21 + resp, err := l.EditTag(&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 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 +)
  11 +
  12 +func GetTagHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  13 + return func(w http.ResponseWriter, r *http.Request) {
  14 + var req types.TagGetRequest
  15 + if err := httpx.Parse(r, &req); err != nil {
  16 + httpx.ErrorCtx(r.Context(), w, err)
  17 + return
  18 + }
  19 +
  20 + l := tags.NewGetTagLogic(r.Context(), svcCtx)
  21 + resp, err := l.GetTag(&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 user
  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/user"
  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 MiniUserApplyJoinCompanyHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  13 + return func(w http.ResponseWriter, r *http.Request) {
  14 + var req types.MiniUserApplyJoinCompanyRequest
  15 + if err := httpx.Parse(r, &req); err != nil {
  16 + httpx.ErrorCtx(r.Context(), w, err)
  17 + return
  18 + }
  19 +
  20 + l := user.NewMiniUserApplyJoinCompanyLogic(r.Context(), svcCtx)
  21 + resp, err := l.MiniUserApplyJoinCompany(&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 user
  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/user"
  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 MiniUserAuditHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  13 + return func(w http.ResponseWriter, r *http.Request) {
  14 + var req types.MiniUserAuditRequest
  15 + if err := httpx.Parse(r, &req); err != nil {
  16 + httpx.ErrorCtx(r.Context(), w, err)
  17 + return
  18 + }
  19 +
  20 + l := user.NewMiniUserAuditLogic(r.Context(), svcCtx)
  21 + err := l.MiniUserAudit(&req)
  22 + if err != nil {
  23 + httpx.ErrorCtx(r.Context(), w, err)
  24 + } else {
  25 + httpx.Ok(w)
  26 + }
  27 + }
  28 +}
  1 +package user
  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/user"
  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 MiniUserAuditListHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  13 + return func(w http.ResponseWriter, r *http.Request) {
  14 + var req types.UserSearchRequest
  15 + if err := httpx.Parse(r, &req); err != nil {
  16 + httpx.ErrorCtx(r.Context(), w, err)
  17 + return
  18 + }
  19 +
  20 + l := user.NewMiniUserAuditListLogic(r.Context(), svcCtx)
  21 + resp, err := l.MiniUserAuditList(&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 user
  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/user"
  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 MiniUserDepartmentUsersHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  13 + return func(w http.ResponseWriter, r *http.Request) {
  14 + var req types.MiniUserDepartmentUsersRequest
  15 + if err := httpx.Parse(r, &req); err != nil {
  16 + httpx.ErrorCtx(r.Context(), w, err)
  17 + return
  18 + }
  19 +
  20 + l := user.NewMiniUserDepartmentUsersLogic(r.Context(), svcCtx)
  21 + resp, err := l.MiniUserDepartmentUsers(&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 user
  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/user"
  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 MiniUserFollowHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  13 + return func(w http.ResponseWriter, r *http.Request) {
  14 + var req types.FollowRequest
  15 + if err := httpx.Parse(r, &req); err != nil {
  16 + httpx.ErrorCtx(r.Context(), w, err)
  17 + return
  18 + }
  19 +
  20 + l := user.NewMiniUserFollowLogic(r.Context(), svcCtx)
  21 + err := l.MiniUserFollow(&req)
  22 + if err != nil {
  23 + httpx.ErrorCtx(r.Context(), w, err)
  24 + } else {
  25 + httpx.Ok(w)
  26 + }
  27 + }
  28 +}
  1 +package user
  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/user"
  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 MiniUserFollowerHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  13 + return func(w http.ResponseWriter, r *http.Request) {
  14 + var req types.UserSearchRequest
  15 + if err := httpx.Parse(r, &req); err != nil {
  16 + httpx.ErrorCtx(r.Context(), w, err)
  17 + return
  18 + }
  19 +
  20 + l := user.NewMiniUserFollowerLogic(r.Context(), svcCtx)
  21 + resp, err := l.MiniUserFollower(&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 user
  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/user"
  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 MiniUserFollowingHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  13 + return func(w http.ResponseWriter, r *http.Request) {
  14 + var req types.UserSearchRequest
  15 + if err := httpx.Parse(r, &req); err != nil {
  16 + httpx.ErrorCtx(r.Context(), w, err)
  17 + return
  18 + }
  19 +
  20 + l := user.NewMiniUserFollowingLogic(r.Context(), svcCtx)
  21 + resp, err := l.MiniUserFollowing(&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 user
  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/user"
  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 MiniUserInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  13 + return func(w http.ResponseWriter, r *http.Request) {
  14 + var req types.MiniUserInfoRequest
  15 + if err := httpx.Parse(r, &req); err != nil {
  16 + httpx.ErrorCtx(r.Context(), w, err)
  17 + return
  18 + }
  19 +
  20 + l := user.NewMiniUserInfoLogic(r.Context(), svcCtx)
  21 + resp, err := l.MiniUserInfo(&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 user
  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/user"
  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 MiniUserLoginHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  13 + return func(w http.ResponseWriter, r *http.Request) {
  14 + var req types.MiniUserLoginRequest
  15 + if err := httpx.Parse(r, &req); err != nil {
  16 + httpx.ErrorCtx(r.Context(), w, err)
  17 + return
  18 + }
  19 +
  20 + l := user.NewMiniUserLoginLogic(r.Context(), svcCtx)
  21 + resp, err := l.MiniUserLogin(&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 user
  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/user"
  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 MiniUserUnFollowHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
  13 + return func(w http.ResponseWriter, r *http.Request) {
  14 + var req types.FollowRequest
  15 + if err := httpx.Parse(r, &req); err != nil {
  16 + httpx.ErrorCtx(r.Context(), w, err)
  17 + return
  18 + }
  19 +
  20 + l := user.NewMiniUserUnFollowLogic(r.Context(), svcCtx)
  21 + err := l.MiniUserUnFollow(&req)
  22 + if err != nil {
  23 + httpx.ErrorCtx(r.Context(), w, err)
  24 + } else {
  25 + httpx.Ok(w)
  26 + }
  27 + }
  28 +}
  1 +package company
  2 +
  3 +import (
  4 + "context"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 +
  9 + "github.com/zeromicro/go-zero/core/logx"
  10 +)
  11 +
  12 +type MiniCompanySearchLogic struct {
  13 + logx.Logger
  14 + ctx context.Context
  15 + svcCtx *svc.ServiceContext
  16 +}
  17 +
  18 +func NewMiniCompanySearchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniCompanySearchLogic {
  19 + return &MiniCompanySearchLogic{
  20 + Logger: logx.WithContext(ctx),
  21 + ctx: ctx,
  22 + svcCtx: svcCtx,
  23 + }
  24 +}
  25 +
  26 +func (l *MiniCompanySearchLogic) MiniCompanySearch(req *types.CompanySearchRequest) (resp *types.CompanySearchResponse, err error) {
  27 + // todo: add your logic here and delete this line
  28 +
  29 + return
  30 +}
  1 +package company
  2 +
  3 +import (
  4 + "context"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 +
  9 + "github.com/zeromicro/go-zero/core/logx"
  10 +)
  11 +
  12 +type SystemCompanySearchLogic struct {
  13 + logx.Logger
  14 + ctx context.Context
  15 + svcCtx *svc.ServiceContext
  16 +}
  17 +
  18 +func NewSystemCompanySearchLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SystemCompanySearchLogic {
  19 + return &SystemCompanySearchLogic{
  20 + Logger: logx.WithContext(ctx),
  21 + ctx: ctx,
  22 + svcCtx: svcCtx,
  23 + }
  24 +}
  25 +
  26 +func (l *SystemCompanySearchLogic) SystemCompanySearch(req *types.CompanySearchRequest) (resp *types.CompanySearchResponse, err error) {
  27 + // todo: add your logic here and delete this line
  28 +
  29 + return
  30 +}
  1 +package tags
  2 +
  3 +import (
  4 + "context"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 +
  9 + "github.com/zeromicro/go-zero/core/logx"
  10 +)
  11 +
  12 +type CreateTagLogic struct {
  13 + logx.Logger
  14 + ctx context.Context
  15 + svcCtx *svc.ServiceContext
  16 +}
  17 +
  18 +func NewCreateTagLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateTagLogic {
  19 + return &CreateTagLogic{
  20 + Logger: logx.WithContext(ctx),
  21 + ctx: ctx,
  22 + svcCtx: svcCtx,
  23 + }
  24 +}
  25 +
  26 +func (l *CreateTagLogic) CreateTag(req *types.TagCreateRequest) (resp *types.TagCreateResponse, err error) {
  27 + // todo: add your logic here and delete this line
  28 +
  29 + return
  30 +}
  1 +package tags
  2 +
  3 +import (
  4 + "context"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 +
  9 + "github.com/zeromicro/go-zero/core/logx"
  10 +)
  11 +
  12 +type DeleteTagLogic struct {
  13 + logx.Logger
  14 + ctx context.Context
  15 + svcCtx *svc.ServiceContext
  16 +}
  17 +
  18 +func NewDeleteTagLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DeleteTagLogic {
  19 + return &DeleteTagLogic{
  20 + Logger: logx.WithContext(ctx),
  21 + ctx: ctx,
  22 + svcCtx: svcCtx,
  23 + }
  24 +}
  25 +
  26 +func (l *DeleteTagLogic) DeleteTag(req *types.TagDeleteRequest) (resp *types.TagDeleteResponse, err error) {
  27 + // todo: add your logic here and delete this line
  28 +
  29 + return
  30 +}
  1 +package tags
  2 +
  3 +import (
  4 + "context"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 +
  9 + "github.com/zeromicro/go-zero/core/logx"
  10 +)
  11 +
  12 +type EditTagLogic struct {
  13 + logx.Logger
  14 + ctx context.Context
  15 + svcCtx *svc.ServiceContext
  16 +}
  17 +
  18 +func NewEditTagLogic(ctx context.Context, svcCtx *svc.ServiceContext) *EditTagLogic {
  19 + return &EditTagLogic{
  20 + Logger: logx.WithContext(ctx),
  21 + ctx: ctx,
  22 + svcCtx: svcCtx,
  23 + }
  24 +}
  25 +
  26 +func (l *EditTagLogic) EditTag(req *types.TagEditRequest) (resp *types.TagEditResponse, err error) {
  27 + // todo: add your logic here and delete this line
  28 +
  29 + return
  30 +}
  1 +package tags
  2 +
  3 +import (
  4 + "context"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 +
  9 + "github.com/zeromicro/go-zero/core/logx"
  10 +)
  11 +
  12 +type GetTagLogic struct {
  13 + logx.Logger
  14 + ctx context.Context
  15 + svcCtx *svc.ServiceContext
  16 +}
  17 +
  18 +func NewGetTagLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetTagLogic {
  19 + return &GetTagLogic{
  20 + Logger: logx.WithContext(ctx),
  21 + ctx: ctx,
  22 + svcCtx: svcCtx,
  23 + }
  24 +}
  25 +
  26 +func (l *GetTagLogic) GetTag(req *types.TagGetRequest) (resp *types.TagGetResponse, err error) {
  27 + // todo: add your logic here and delete this line
  28 +
  29 + return
  30 +}
  1 +package user
  2 +
  3 +import (
  4 + "context"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 +
  9 + "github.com/zeromicro/go-zero/core/logx"
  10 +)
  11 +
  12 +type MiniUserApplyJoinCompanyLogic struct {
  13 + logx.Logger
  14 + ctx context.Context
  15 + svcCtx *svc.ServiceContext
  16 +}
  17 +
  18 +func NewMiniUserApplyJoinCompanyLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUserApplyJoinCompanyLogic {
  19 + return &MiniUserApplyJoinCompanyLogic{
  20 + Logger: logx.WithContext(ctx),
  21 + ctx: ctx,
  22 + svcCtx: svcCtx,
  23 + }
  24 +}
  25 +
  26 +func (l *MiniUserApplyJoinCompanyLogic) MiniUserApplyJoinCompany(req *types.MiniUserApplyJoinCompanyRequest) (resp *types.MiniUserApplyJoinCompanyResponse, err error) {
  27 + // todo: add your logic here and delete this line
  28 +
  29 + return
  30 +}
  1 +package user
  2 +
  3 +import (
  4 + "context"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 +
  9 + "github.com/zeromicro/go-zero/core/logx"
  10 +)
  11 +
  12 +type MiniUserAuditListLogic struct {
  13 + logx.Logger
  14 + ctx context.Context
  15 + svcCtx *svc.ServiceContext
  16 +}
  17 +
  18 +func NewMiniUserAuditListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUserAuditListLogic {
  19 + return &MiniUserAuditListLogic{
  20 + Logger: logx.WithContext(ctx),
  21 + ctx: ctx,
  22 + svcCtx: svcCtx,
  23 + }
  24 +}
  25 +
  26 +func (l *MiniUserAuditListLogic) MiniUserAuditList(req *types.UserSearchRequest) (resp *types.UserSearchResponse, err error) {
  27 + // todo: add your logic here and delete this line
  28 +
  29 + return
  30 +}
  1 +package user
  2 +
  3 +import (
  4 + "context"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 +
  9 + "github.com/zeromicro/go-zero/core/logx"
  10 +)
  11 +
  12 +type MiniUserAuditLogic struct {
  13 + logx.Logger
  14 + ctx context.Context
  15 + svcCtx *svc.ServiceContext
  16 +}
  17 +
  18 +func NewMiniUserAuditLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUserAuditLogic {
  19 + return &MiniUserAuditLogic{
  20 + Logger: logx.WithContext(ctx),
  21 + ctx: ctx,
  22 + svcCtx: svcCtx,
  23 + }
  24 +}
  25 +
  26 +func (l *MiniUserAuditLogic) MiniUserAudit(req *types.MiniUserAuditRequest) error {
  27 + // todo: add your logic here and delete this line
  28 +
  29 + return nil
  30 +}
  1 +package user
  2 +
  3 +import (
  4 + "context"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 +
  9 + "github.com/zeromicro/go-zero/core/logx"
  10 +)
  11 +
  12 +type MiniUserDepartmentUsersLogic struct {
  13 + logx.Logger
  14 + ctx context.Context
  15 + svcCtx *svc.ServiceContext
  16 +}
  17 +
  18 +func NewMiniUserDepartmentUsersLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUserDepartmentUsersLogic {
  19 + return &MiniUserDepartmentUsersLogic{
  20 + Logger: logx.WithContext(ctx),
  21 + ctx: ctx,
  22 + svcCtx: svcCtx,
  23 + }
  24 +}
  25 +
  26 +func (l *MiniUserDepartmentUsersLogic) MiniUserDepartmentUsers(req *types.MiniUserDepartmentUsersRequest) (resp *types.MiniUserInfoResponse, err error) {
  27 + // todo: add your logic here and delete this line
  28 +
  29 + return
  30 +}
  1 +package user
  2 +
  3 +import (
  4 + "context"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 +
  9 + "github.com/zeromicro/go-zero/core/logx"
  10 +)
  11 +
  12 +type MiniUserFollowLogic struct {
  13 + logx.Logger
  14 + ctx context.Context
  15 + svcCtx *svc.ServiceContext
  16 +}
  17 +
  18 +func NewMiniUserFollowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUserFollowLogic {
  19 + return &MiniUserFollowLogic{
  20 + Logger: logx.WithContext(ctx),
  21 + ctx: ctx,
  22 + svcCtx: svcCtx,
  23 + }
  24 +}
  25 +
  26 +func (l *MiniUserFollowLogic) MiniUserFollow(req *types.FollowRequest) error {
  27 + // todo: add your logic here and delete this line
  28 +
  29 + return nil
  30 +}
  1 +package user
  2 +
  3 +import (
  4 + "context"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 +
  9 + "github.com/zeromicro/go-zero/core/logx"
  10 +)
  11 +
  12 +type MiniUserFollowerLogic struct {
  13 + logx.Logger
  14 + ctx context.Context
  15 + svcCtx *svc.ServiceContext
  16 +}
  17 +
  18 +func NewMiniUserFollowerLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUserFollowerLogic {
  19 + return &MiniUserFollowerLogic{
  20 + Logger: logx.WithContext(ctx),
  21 + ctx: ctx,
  22 + svcCtx: svcCtx,
  23 + }
  24 +}
  25 +
  26 +func (l *MiniUserFollowerLogic) MiniUserFollower(req *types.UserSearchRequest) (resp *types.UserSearchResponse, err error) {
  27 + // todo: add your logic here and delete this line
  28 +
  29 + return
  30 +}
  1 +package user
  2 +
  3 +import (
  4 + "context"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 +
  9 + "github.com/zeromicro/go-zero/core/logx"
  10 +)
  11 +
  12 +type MiniUserFollowingLogic struct {
  13 + logx.Logger
  14 + ctx context.Context
  15 + svcCtx *svc.ServiceContext
  16 +}
  17 +
  18 +func NewMiniUserFollowingLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUserFollowingLogic {
  19 + return &MiniUserFollowingLogic{
  20 + Logger: logx.WithContext(ctx),
  21 + ctx: ctx,
  22 + svcCtx: svcCtx,
  23 + }
  24 +}
  25 +
  26 +func (l *MiniUserFollowingLogic) MiniUserFollowing(req *types.UserSearchRequest) (resp *types.UserSearchResponse, err error) {
  27 + // todo: add your logic here and delete this line
  28 +
  29 + return
  30 +}
  1 +package user
  2 +
  3 +import (
  4 + "context"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 +
  9 + "github.com/zeromicro/go-zero/core/logx"
  10 +)
  11 +
  12 +type MiniUserInfoLogic struct {
  13 + logx.Logger
  14 + ctx context.Context
  15 + svcCtx *svc.ServiceContext
  16 +}
  17 +
  18 +func NewMiniUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUserInfoLogic {
  19 + return &MiniUserInfoLogic{
  20 + Logger: logx.WithContext(ctx),
  21 + ctx: ctx,
  22 + svcCtx: svcCtx,
  23 + }
  24 +}
  25 +
  26 +func (l *MiniUserInfoLogic) MiniUserInfo(req *types.MiniUserInfoRequest) (resp *types.MiniUserInfoResponse, err error) {
  27 + // todo: add your logic here and delete this line
  28 +
  29 + return
  30 +}
  1 +package user
  2 +
  3 +import (
  4 + "context"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 +
  9 + "github.com/zeromicro/go-zero/core/logx"
  10 +)
  11 +
  12 +type MiniUserLoginLogic struct {
  13 + logx.Logger
  14 + ctx context.Context
  15 + svcCtx *svc.ServiceContext
  16 +}
  17 +
  18 +func NewMiniUserLoginLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUserLoginLogic {
  19 + return &MiniUserLoginLogic{
  20 + Logger: logx.WithContext(ctx),
  21 + ctx: ctx,
  22 + svcCtx: svcCtx,
  23 + }
  24 +}
  25 +
  26 +func (l *MiniUserLoginLogic) MiniUserLogin(req *types.MiniUserLoginRequest) (resp *types.MiniUserLoginResponse, err error) {
  27 + // todo: add your logic here and delete this line
  28 +
  29 + return
  30 +}
  1 +package user
  2 +
  3 +import (
  4 + "context"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/svc"
  7 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/types"
  8 +
  9 + "github.com/zeromicro/go-zero/core/logx"
  10 +)
  11 +
  12 +type MiniUserUnFollowLogic struct {
  13 + logx.Logger
  14 + ctx context.Context
  15 + svcCtx *svc.ServiceContext
  16 +}
  17 +
  18 +func NewMiniUserUnFollowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *MiniUserUnFollowLogic {
  19 + return &MiniUserUnFollowLogic{
  20 + Logger: logx.WithContext(ctx),
  21 + ctx: ctx,
  22 + svcCtx: svcCtx,
  23 + }
  24 +}
  25 +
  26 +func (l *MiniUserUnFollowLogic) MiniUserUnFollow(req *types.FollowRequest) error {
  27 + // todo: add your logic here and delete this line
  28 +
  29 + return nil
  30 +}
@@ -20,6 +20,8 @@ type ServiceContext struct { @@ -20,6 +20,8 @@ type ServiceContext struct {
20 ArticleCommentRepository domain.ArticleCommentRepository 20 ArticleCommentRepository domain.ArticleCommentRepository
21 ArticleDraftRepository domain.ArticleDraftRepository 21 ArticleDraftRepository domain.ArticleDraftRepository
22 ArticleRepository domain.ArticleRepository 22 ArticleRepository domain.ArticleRepository
  23 + ArticleSectionRepository domain.ArticleSectionRepository
  24 + ArticleTagRepository domain.ArticleTagRepository
23 25
24 CompanyRepository domain.CompanyRepository 26 CompanyRepository domain.CompanyRepository
25 CommentRepository domain.CommentRepository // 待移除 27 CommentRepository domain.CommentRepository // 待移除
@@ -35,6 +37,7 @@ type ServiceContext struct { @@ -35,6 +37,7 @@ type ServiceContext struct {
35 func NewServiceContext(c config.Config) *ServiceContext { 37 func NewServiceContext(c config.Config) *ServiceContext {
36 38
37 db := database.OpenGormPGDB(c.DB.DataSource, c.Log.Mode) 39 db := database.OpenGormPGDB(c.DB.DataSource, c.Log.Mode)
  40 +
38 mlCache := cache.NewMultiLevelCache([]string{c.Redis.Host}, c.Redis.Pass) 41 mlCache := cache.NewMultiLevelCache([]string{c.Redis.Host}, c.Redis.Pass)
39 redis, _ := redis.NewRedis(redis.RedisConf{Host: c.Redis.Host, Pass: c.Redis.Pass, Type: "node"}) 42 redis, _ := redis.NewRedis(redis.RedisConf{Host: c.Redis.Host, Pass: c.Redis.Pass, Type: "node"})
40 43
@@ -47,6 +50,7 @@ func NewServiceContext(c config.Config) *ServiceContext { @@ -47,6 +50,7 @@ func NewServiceContext(c config.Config) *ServiceContext {
47 ArticleCommentRepository: repository.NewArticleCommentRepository(cache.NewCachedRepository(mlCache)), 50 ArticleCommentRepository: repository.NewArticleCommentRepository(cache.NewCachedRepository(mlCache)),
48 ArticleDraftRepository: repository.NewArticleDraftRepository(cache.NewCachedRepository(mlCache)), 51 ArticleDraftRepository: repository.NewArticleDraftRepository(cache.NewCachedRepository(mlCache)),
49 ArticleRepository: repository.NewArticleRepository(cache.NewCachedRepository(mlCache)), 52 ArticleRepository: repository.NewArticleRepository(cache.NewCachedRepository(mlCache)),
  53 + ArticleSectionRepository: repository.NewArticleSectionRepository(cache.NewCachedRepository(mlCache)),
50 CompanyRepository: repository.NewCompanyRepository(cache.NewCachedRepository(mlCache)), 54 CompanyRepository: repository.NewCompanyRepository(cache.NewCachedRepository(mlCache)),
51 DepartmentRepository: repository.NewDepartmentRepository(cache.NewCachedRepository(mlCache)), 55 DepartmentRepository: repository.NewDepartmentRepository(cache.NewCachedRepository(mlCache)),
52 MessageBusinessRepository: repository.NewMessageBusinessRepository(cache.NewCachedRepository(mlCache)), 56 MessageBusinessRepository: repository.NewMessageBusinessRepository(cache.NewCachedRepository(mlCache)),
@@ -55,6 +59,7 @@ func NewServiceContext(c config.Config) *ServiceContext { @@ -55,6 +59,7 @@ func NewServiceContext(c config.Config) *ServiceContext {
55 UserFollowRepository: repository.NewUserFollowRepository(cache.NewCachedRepository(mlCache)), 59 UserFollowRepository: repository.NewUserFollowRepository(cache.NewCachedRepository(mlCache)),
56 UserLoveFlagRepository: repository.NewUserLoveFlagRepository(cache.NewCachedRepository(mlCache)), 60 UserLoveFlagRepository: repository.NewUserLoveFlagRepository(cache.NewCachedRepository(mlCache)),
57 UserRepository: repository.NewUserRepository(cache.NewCachedRepository(mlCache)), 61 UserRepository: repository.NewUserRepository(cache.NewCachedRepository(mlCache)),
  62 + ArticleTagRepository: repository.NewArticleTagRepository(cache.NewCachedRepository(mlCache)),
58 } 63 }
59 } 64 }
60 65
@@ -63,3 +63,170 @@ type User struct { @@ -63,3 +63,170 @@ type User struct {
63 Avatar string `json:"avatar,omitempty"` // 头像 63 Avatar string `json:"avatar,omitempty"` // 头像
64 Position string `json:"position,omitempty"` // 职位 64 Position string `json:"position,omitempty"` // 职位
65 } 65 }
  66 +
  67 +type TagCreateRequest struct {
  68 + CompanyId int64 `json:"companyId"`
  69 + Image string `json:"image"`
  70 + Name string `json:"name"` // 标签名称
  71 + Group string `json:"group"` // 标签分类
  72 + Remark string `json:"remark"` // 备注
  73 +}
  74 +
  75 +type TagCreateResponse struct {
  76 + Id int64 `json:"id"`
  77 +}
  78 +
  79 +type TagEditRequest struct {
  80 + Id int64 `json:"id"`
  81 + CompanyId int64 `json:"companyId"`
  82 + Image string `json:"image"`
  83 + Name string `json:"name"` // 标签名称
  84 + Group string `json:"group"` // 标签分类
  85 + Remark string `json:"remark"` // 备注
  86 +}
  87 +
  88 +type TagEditResponse struct {
  89 + Id int64 `json:"id"`
  90 +}
  91 +
  92 +type TagGetRequest struct {
  93 + Id int64 `json:"id"`
  94 +}
  95 +
  96 +type TagGetResponse struct {
  97 + Id int64 `json:"id"`
  98 + Image string `json:"image"`
  99 + Name string `json:"name"` // 标签名称
  100 + Group string `json:"group"` // 标签分类
  101 + Remark string `json:"remark"` // 备注
  102 +}
  103 +
  104 +type TagListRequest struct {
  105 + Page int `json:"page"`
  106 + Size int `json:"size"`
  107 +}
  108 +
  109 +type TagListResponse struct {
  110 + Total int `json:"total"`
  111 + List []TagItem `json:"list"`
  112 +}
  113 +
  114 +type TagItem struct {
  115 + Id int64 `json:"id"`
  116 + Image string `json:"image"`
  117 + Name string `json:"name"` // 标签名称
  118 + Group string `json:"group"` // 标签分类
  119 + Remark string `json:"remark"` // 备注
  120 + CreatedAt int64 `json:"createdAt"`
  121 +}
  122 +
  123 +type TagDeleteRequest struct {
  124 + Id int64 `json:"id"`
  125 +}
  126 +
  127 +type TagDeleteResponse struct {
  128 + Id int64 `json:"id"`
  129 +}
  130 +
  131 +type MiniUserLoginRequest struct {
  132 + LoginType string `json:"loginType"` // 登录类型 wechat-login whchat-phone-login phone-password-login phone-smscode-login
  133 + WechatAuthCode string `json:"wechatAuthcode,optional"` // 微信登录 授权码
  134 + WechatEncryptedData string `json:"wechatEncryptedData,optional"` // 微信登录 加密数据
  135 + WechatIV string `json:"wechatIV,optional"` // 微信登录 加密算法初始向量
  136 + Phone string `json:"phone,optional"` // 手机号
  137 + Password string `json:"password,optional"` // 密码
  138 + SmsCode string `json:"smsCode,optional"` // 短信验证码
  139 +}
  140 +
  141 +type MiniUserLoginResponse struct {
  142 + Token string `json:"token"` // x-token
  143 + Phone string `json:"phone"` // 手机号
  144 + Message string `json:"message"` // 失败消息(审核中,注册成功等待审核)
  145 + Success bool `json:"success"` // 成功标识
  146 +}
  147 +
  148 +type MiniUserInfoRequest struct {
  149 +}
  150 +
  151 +type MiniUserInfoResponse struct {
  152 + User *UserItem `json:"user,omitempty"` // 用户信息
  153 + TotalArticle int64 `json:"totalArticle"` // 累计信息发布
  154 + TotalLoved int64 `json:"totalLoved"` // 累计收到的赞
  155 + TotalAccepted int64 `json:"totalAccepted"` // 累计被采纳
  156 +}
  157 +
  158 +type MiniUserApplyJoinCompanyRequest struct {
  159 + Phone string `json:"phone"`
  160 + Code string `json:"code"`
  161 +}
  162 +
  163 +type MiniUserApplyJoinCompanyResponse struct {
  164 +}
  165 +
  166 +type MiniUserAuditRequest struct {
  167 + UserId int64 `json:"userId"` // 用户ID
  168 +}
  169 +
  170 +type MiniUserDepartmentUsersRequest struct {
  171 +}
  172 +
  173 +type MiniUserDepartmentUsersResponse struct {
  174 + Departments []*Department `json:"departments"`
  175 + Users []*UserItem `json:"users"`
  176 +}
  177 +
  178 +type UserItem struct {
  179 + CompanyId int64 `json:"companyId,omitempty"` // 公司ID
  180 + DepartmentId int64 `json:"departmentId,omitempty"` // 部门ID
  181 + Roles []int64 `json:"roleId,omitempty"` // 角色
  182 + Flag int `json:"flag,omitempty"` // 标识 1:管理员 2:普通用户 (有绑定角色是管理员)
  183 + Name string `json:"name,omitempty"` // 名称
  184 + Avatar string `json:"avatar,omitempty"` // 头像
  185 + Phone string `json:"phone,omitempty"` // 手机号 唯一
  186 + Position string `json:"position,omitempty"` // 职位
  187 + Enable int `json:"enable,omitempty"` // 启用状态 1:启用 2:禁用
  188 + AuditStatus int `json:"auditStatus,omitempty"` // 审核状态 0:待审核 1:审核通过 2:拒绝
  189 + Follower []int64 `json:"followers,omitempty"` // 关注我的人 (冗余)
  190 + Following []int64 `json:"following,omitempty"` // 我关注的人 (冗余)
  191 +}
  192 +
  193 +type Department struct {
  194 + Id int64 `json:"id,omitempty"` // 部门ID
  195 + CompanyId int64 `json:"companyId,omitempty"` // 公司ID
  196 + ParentId int64 `json:"parentId,omitempty"` // 父级ID
  197 + Name string `json:"name,omitempty"` // 部门名称
  198 +}
  199 +
  200 +type UserSearchRequest struct {
  201 + Page int `json:"page,optional"`
  202 + Size int `json:"size,optional"`
  203 + AuditFlag *int `json:"auditFlag,optional"` // 按审核状态 0:待审核 1:审核通过 2:拒绝
  204 +}
  205 +
  206 +type UserSearchResponse struct {
  207 + List []*UserItem `json:"list"`
  208 + Total int64 `json:"total"`
  209 +}
  210 +
  211 +type FollowRequest struct {
  212 + UserId int64 `json:"userId"`
  213 +}
  214 +
  215 +type CompanySearchRequest struct {
  216 + Page int `json:"page"`
  217 + Size int `json:"size"`
  218 + UserId int64 `json:"userId,optional"` // 按用户搜索
  219 + Code string `json:"code,optional"` // 按编码搜索
  220 +}
  221 +
  222 +type CompanySearchResponse struct {
  223 + List []Company `json:"list"`
  224 + Total int64 `json:"total"`
  225 +}
  226 +
  227 +type Company struct {
  228 + Id int64 `json:"id,omitempty"` // 唯一标识
  229 + Name string `json:"name,omitempty"` // 名称
  230 + Code string `json:"code,omitempty"` // 编码(搜索使用,4位字母数字)
  231 + Logo string `json:"logo,omitempty"` // 公司LOGO
  232 +}
@@ -6,5 +6,21 @@ import ( @@ -6,5 +6,21 @@ import (
6 ) 6 )
7 7
8 func Migrate(db *gorm.DB) { 8 func Migrate(db *gorm.DB) {
9 - _ = db.AutoMigrate(models.MessageSystem{}, models.MessageBusiness{}) 9 + modelsList := []interface{}{
  10 + &models.Article{},
  11 + &models.ArticleSection{},
  12 + &models.ArticleBackup{},
  13 + &models.ArticleDraft{},
  14 + &models.ArticleComment{},
  15 + &models.ArticleTag{},
  16 + &models.UserLoveFlag{},
  17 + &models.User{},
  18 + &models.Role{},
  19 + &models.Company{},
  20 + &models.UserFollow{},
  21 + &models.MessageSystem{},
  22 + &models.MessageBusiness{},
  23 + }
  24 +
  25 + db.AutoMigrate(modelsList...)
10 } 26 }
@@ -18,16 +18,15 @@ type Article struct { @@ -18,16 +18,15 @@ type Article struct {
18 IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"` 18 IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"`
19 Version int 19 Version int
20 AuthorId int64 // 发布人 20 AuthorId int64 // 发布人
21 - Author domain.UserSimple // 发布人 21 + Author domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 发布人
22 Title string // 文章标题 22 Title string // 文章标题
23 - Images []domain.Image // 图片  
24 - WhoRead []int64 // 谁可以看  
25 - WhoReview []int64 // 评论人  
26 - Location domain.Location // 坐标 23 + Images []domain.Image `gorm:"type:jsonb;serializer:json"` // 图片
  24 + WhoRead []int64 `gorm:"type:jsonb;serializer:json"` // 谁可以看
  25 + WhoReview []int64 `gorm:"type:jsonb;serializer:json"` // 评论人
  26 + Location domain.Location `gorm:"type:jsonb;serializer:json"` // 坐标
27 TargetUser int // 分发方式 0 分发给所有人 1 分发给指定的人 27 TargetUser int // 分发方式 0 分发给所有人 1 分发给指定的人
28 CountLove int // 点赞数量 28 CountLove int // 点赞数量
29 CountComment int // 评论数量 29 CountComment int // 评论数量
30 - Tags []int // 标签  
31 Show int // 评论的展示状态(0显示、1不显示) 30 Show int // 评论的展示状态(0显示、1不显示)
32 } 31 }
33 32
@@ -17,14 +17,14 @@ type ArticleBackup struct { @@ -17,14 +17,14 @@ type ArticleBackup struct {
17 DeletedAt int64 17 DeletedAt int64
18 IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"` 18 IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"`
19 Version int 19 Version int
20 - Operator domain.UserSimple // 操作人 20 + Operator domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 操作人
21 Title string // 标题 21 Title string // 标题
22 - Section []domain.ArticleSection // 分段内容  
23 - Images []domain.Image // 图片 22 + Section []domain.ArticleSection `gorm:"type:jsonb;serializer:json"` // 分段内容
  23 + Images []domain.Image `gorm:"type:jsonb;serializer:json"` // 图片
24 Action string // 操作 24 Action string // 操作
25 - WhoRead []int64 // 谁可以看  
26 - WhoReview []int64 // 评论人  
27 - Tags []int // 标签 25 + WhoRead []int64 `gorm:"type:jsonb;serializer:json"` // 谁可以看
  26 + WhoReview []int64 `gorm:"type:jsonb;serializer:json"` // 评论人
  27 + Tags []int `gorm:"type:jsonb;serializer:json"` // 标签
28 TargetUser int // 分发方式 0 分发给所有人 1 分发给指定的人 28 TargetUser int // 分发方式 0 分发给所有人 1 分发给指定的人
29 } 29 }
30 30
@@ -23,9 +23,9 @@ type ArticleComment struct { @@ -23,9 +23,9 @@ type ArticleComment struct {
23 ArticleSectionId int64 // 文本内容id 23 ArticleSectionId int64 // 文本内容id
24 SectionContent string // 引用的文章内容文本 24 SectionContent string // 引用的文章内容文本
25 FromUserId int64 // 谁填写的评论 25 FromUserId int64 // 谁填写的评论
26 - FromUser domain.UserSimple // 谁填写的评论 26 + FromUser domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 谁填写的评论
27 ToUserId int64 // 回复谁的评论 27 ToUserId int64 // 回复谁的评论
28 - ToUser domain.UserSimple // 回复谁的评论 28 + ToUser domain.UserSimple `gorm:"type:jsonb;serializer:json"` // 回复谁的评论
29 Content string // 评论内容 29 Content string // 评论内容
30 CountReply int // 回复数量 30 CountReply int // 回复数量
31 CountUserLove int // 用户点赞数量 31 CountUserLove int // 用户点赞数量
@@ -17,13 +17,13 @@ type ArticleDraft struct { @@ -17,13 +17,13 @@ type ArticleDraft struct {
17 DeletedAt int64 17 DeletedAt int64
18 Version int 18 Version int
19 Template int // 填写内容时用的样板0、无 1、演绎式 2、归纳式 19 Template int // 填写内容时用的样板0、无 1、演绎式 2、归纳式
20 - Content []string // 文章内容 20 + Content []string `gorm:"type:jsonb;serializer:json"` // 文章内容
21 AuthorId int64 // 发布人 21 AuthorId int64 // 发布人
22 Title string // 文章标题 22 Title string // 文章标题
23 - Images []domain.Image // 图片  
24 - WhoRead []int64 // 谁可以看  
25 - WhoReview []int64 // 评论人  
26 - Location domain.Location // 坐标 23 + Images []domain.Image `gorm:"type:jsonb;serializer:json"` // 图片
  24 + WhoRead []int64 `gorm:"type:jsonb;serializer:json"` // 谁可以看
  25 + WhoReview []int64 `gorm:"type:jsonb;serializer:json"` // 评论人
  26 + Location domain.Location `gorm:"type:jsonb;serializer:json"` // 坐标
27 } 27 }
28 28
29 func (m *ArticleDraft) TableName() string { 29 func (m *ArticleDraft) TableName() string {
@@ -9,14 +9,14 @@ import ( @@ -9,14 +9,14 @@ import (
9 9
10 type Company struct { 10 type Company struct {
11 Id int64 // 唯一标识 11 Id int64 // 唯一标识
12 - Name string `json:"name,omitempty"` // 名称  
13 - Code string `json:"code,omitempty"` // 编码(搜索使用,4位字母数字)  
14 - Logo string `json:"logo,omitempty"` // 公司LOGO  
15 -  
16 - CreatedAt int64 `json:"createdAt,omitempty"`  
17 - UpdatedAt int64 `json:"updatedAt,omitempty"`  
18 - DeletedAt int64 `json:"deletedAt,omitempty"`  
19 - Version int `json:"version,omitempty"` 12 + Name string // 名称
  13 + Code string // 编码(搜索使用,4位字母数字)
  14 + Logo string // 公司LOGO
  15 +
  16 + CreatedAt int64
  17 + UpdatedAt int64
  18 + DeletedAt int64
  19 + Version int
20 } 20 }
21 21
22 func (m *Company) TableName() string { 22 func (m *Company) TableName() string {
@@ -4,16 +4,18 @@ import ( @@ -4,16 +4,18 @@ import (
4 "fmt" 4 "fmt"
5 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" 5 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
6 "gorm.io/gorm" 6 "gorm.io/gorm"
  7 + "gorm.io/plugin/soft_delete"
7 "time" 8 "time"
8 ) 9 )
9 10
10 type Role struct { 11 type Role struct {
11 Id int64 // 唯一标识 12 Id int64 // 唯一标识
12 13
13 - CreatedAt int64 `json:"createdAt,omitempty"`  
14 - UpdatedAt int64 `json:"updatedAt,omitempty"`  
15 - DeletedAt int64 `json:"deletedAt,omitempty"`  
16 - Version int `json:"version,omitempty"` 14 + CreatedAt int64
  15 + UpdatedAt int64
  16 + DeletedAt int64
  17 + Version int
  18 + IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"`
17 } 19 }
18 20
19 func (m *Role) TableName() string { 21 func (m *Role) TableName() string {
@@ -4,28 +4,30 @@ import ( @@ -4,28 +4,30 @@ import (
4 "fmt" 4 "fmt"
5 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain" 5 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/domain"
6 "gorm.io/gorm" 6 "gorm.io/gorm"
  7 + "gorm.io/plugin/soft_delete"
7 "time" 8 "time"
8 ) 9 )
9 10
10 type User struct { 11 type User struct {
11 Id int64 // 唯一标识 12 Id int64 // 唯一标识
12 - CompanyId int64 `json:"companyId,omitempty"` // 公司ID  
13 - DepartmentId int64 `json:"departmentId,omitempty"` // 部门ID  
14 - Roles []int64 `json:"roleId,omitempty"` // 角色  
15 - Flag int `json:"flag"` // 标识 1:管理员 2:普通用户 (有绑定角色是管理员)  
16 - Name string `json:"name,omitempty"` // 名称  
17 - Avatar string `json:"avatar,omitempty"` // 头像  
18 - Phone string `json:"phone,omitempty"` // 手机号 唯一  
19 - Position string `json:"position,omitempty"` // 职位  
20 - Enable int `json:"enable,omitempty"` // 启用状态 1:启用 2:禁用  
21 - AuditStatus int `json:"auditStatus,omitempty"` // 审核状态 0:待审核 1:审核通过 2:拒绝  
22 - Follower []int64 `json:"followers,omitempty"` // 关注我的人 (冗余)  
23 - Following []int64 `json:"following,omitempty"` // 我关注的人 (冗余) 13 + CompanyId int64 // 公司ID
  14 + DepartmentId int64 // 部门ID
  15 + Roles []int64 `gorm:"type:jsonb;serializer:json"` // 角色
  16 + Flag int // 标识 1:管理员 2:普通用户 (有绑定角色是管理员)
  17 + Name string // 名称
  18 + Avatar string // 头像
  19 + Phone string // 手机号 唯一
  20 + Position string // 职位
  21 + Enable int // 启用状态 1:启用 2:禁用
  22 + AuditStatus int // 审核状态 0:待审核 1:审核通过 2:拒绝
  23 + Follower []int64 `gorm:"type:jsonb;serializer:json"` // 关注我的人 (冗余)
  24 + Following []int64 `gorm:"type:jsonb;serializer:json"` // 我关注的人 (冗余)
24 25
25 - CreatedAt int64 `json:"createdAt,omitempty"`  
26 - UpdatedAt int64 `json:"updatedAt,omitempty"`  
27 - DeletedAt int64 `json:"deletedAt,omitempty"`  
28 - Version int `json:"version,omitempty"` 26 + CreatedAt int64
  27 + UpdatedAt int64
  28 + DeletedAt int64
  29 + Version int
  30 + IsDel soft_delete.DeletedAt `gorm:"softDelete:flag,DeletedAtField:DeletedAt"`
29 } 31 }
30 32
31 func (m *User) TableName() string { 33 func (m *User) TableName() string {
@@ -158,7 +158,6 @@ func (repository *ArticleRepository) ModelToDomainModel(from *models.Article) (* @@ -158,7 +158,6 @@ func (repository *ArticleRepository) ModelToDomainModel(from *models.Article) (*
158 TargetUser: domain.ArticleTarget(from.TargetUser), 158 TargetUser: domain.ArticleTarget(from.TargetUser),
159 CountLove: from.CountLove, 159 CountLove: from.CountLove,
160 CountComment: from.CountComment, 160 CountComment: from.CountComment,
161 - Tags: from.Tags,  
162 Show: domain.ArticleShow(from.Show), 161 Show: domain.ArticleShow(from.Show),
163 } 162 }
164 return to, nil 163 return to, nil
@@ -182,7 +181,6 @@ func (repository *ArticleRepository) DomainModelToModel(from *domain.Article) (* @@ -182,7 +181,6 @@ func (repository *ArticleRepository) DomainModelToModel(from *domain.Article) (*
182 TargetUser: int(from.TargetUser), 181 TargetUser: int(from.TargetUser),
183 CountLove: from.CountLove, 182 CountLove: from.CountLove,
184 CountComment: from.CountComment, 183 CountComment: from.CountComment,
185 - Tags: from.Tags,  
186 Show: int(from.Show), 184 Show: int(from.Show),
187 } 185 }
188 // err := copier.Copy(to, from) 186 // err := copier.Copy(to, from)
@@ -24,7 +24,6 @@ type Article struct { @@ -24,7 +24,6 @@ type Article struct {
24 TargetUser ArticleTarget `json:"targetUser"` // 分发方式 0 分发给所有人 1 分发给指定的人 24 TargetUser ArticleTarget `json:"targetUser"` // 分发方式 0 分发给所有人 1 分发给指定的人
25 CountLove int `json:"countLove"` // 点赞数量 25 CountLove int `json:"countLove"` // 点赞数量
26 CountComment int `json:"countComment"` // 评论数量 26 CountComment int `json:"countComment"` // 评论数量
27 - Tags []int `json:"tags"` // 标签  
28 Show ArticleShow `json:"showState"` // 评论的展示状态(0显示、1不显示) 27 Show ArticleShow `json:"showState"` // 评论的展示状态(0显示、1不显示)
29 // ...more 28 // ...more
30 } 29 }
@@ -68,6 +67,7 @@ type ArticleRepository interface { @@ -68,6 +67,7 @@ type ArticleRepository interface {
68 Insert(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error) 67 Insert(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error)
69 Update(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error) 68 Update(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error)
70 Delete(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error) 69 Delete(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error)
  70 + UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *Article) (*Article, error)
71 FindOne(ctx context.Context, conn transaction.Conn, id int64) (*Article, error) 71 FindOne(ctx context.Context, conn transaction.Conn, id int64) (*Article, error)
72 Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*Article, error) 72 Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*Article, error)
73 } 73 }
@@ -28,6 +28,7 @@ type ArticleBackup struct { @@ -28,6 +28,7 @@ type ArticleBackup struct {
28 type ArticleBackupRepository interface { 28 type ArticleBackupRepository interface {
29 Insert(ctx context.Context, conn transaction.Conn, dm *ArticleBackup) (*ArticleBackup, error) 29 Insert(ctx context.Context, conn transaction.Conn, dm *ArticleBackup) (*ArticleBackup, error)
30 Update(ctx context.Context, conn transaction.Conn, dm *ArticleBackup) (*ArticleBackup, error) 30 Update(ctx context.Context, conn transaction.Conn, dm *ArticleBackup) (*ArticleBackup, error)
  31 + UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *ArticleBackup) (*ArticleBackup, error)
31 Delete(ctx context.Context, conn transaction.Conn, dm *ArticleBackup) (*ArticleBackup, error) 32 Delete(ctx context.Context, conn transaction.Conn, dm *ArticleBackup) (*ArticleBackup, error)
32 FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleBackup, error) 33 FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleBackup, error)
33 Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleBackup, error) 34 Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleBackup, error)
@@ -42,6 +42,7 @@ const ( @@ -42,6 +42,7 @@ const (
42 type ArticleCommentRepository interface { 42 type ArticleCommentRepository interface {
43 Insert(ctx context.Context, conn transaction.Conn, dm *ArticleComment) (*ArticleComment, error) 43 Insert(ctx context.Context, conn transaction.Conn, dm *ArticleComment) (*ArticleComment, error)
44 Update(ctx context.Context, conn transaction.Conn, dm *ArticleComment) (*ArticleComment, error) 44 Update(ctx context.Context, conn transaction.Conn, dm *ArticleComment) (*ArticleComment, error)
  45 + UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *ArticleComment) (*ArticleComment, error)
45 Delete(ctx context.Context, conn transaction.Conn, dm *ArticleComment) (*ArticleComment, error) 46 Delete(ctx context.Context, conn transaction.Conn, dm *ArticleComment) (*ArticleComment, error)
46 FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleComment, error) 47 FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleComment, error)
47 Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleComment, error) 48 Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleComment, error)
@@ -27,6 +27,7 @@ type ArticleDraft struct { @@ -27,6 +27,7 @@ type ArticleDraft struct {
27 type ArticleDraftRepository interface { 27 type ArticleDraftRepository interface {
28 Insert(ctx context.Context, conn transaction.Conn, dm *ArticleDraft) (*ArticleDraft, error) 28 Insert(ctx context.Context, conn transaction.Conn, dm *ArticleDraft) (*ArticleDraft, error)
29 Update(ctx context.Context, conn transaction.Conn, dm *ArticleDraft) (*ArticleDraft, error) 29 Update(ctx context.Context, conn transaction.Conn, dm *ArticleDraft) (*ArticleDraft, error)
  30 + UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *ArticleDraft) (*ArticleDraft, error)
30 Delete(ctx context.Context, conn transaction.Conn, dm *ArticleDraft) (*ArticleDraft, error) 31 Delete(ctx context.Context, conn transaction.Conn, dm *ArticleDraft) (*ArticleDraft, error)
31 FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleDraft, error) 32 FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleDraft, error)
32 Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleDraft, error) 33 Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleDraft, error)
@@ -6,7 +6,7 @@ import ( @@ -6,7 +6,7 @@ import (
6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" 6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
7 ) 7 )
8 8
9 -// 文章段落 9 +// 文章段落内容
10 type ArticleSection struct { 10 type ArticleSection struct {
11 Id int64 `json:"id"` 11 Id int64 `json:"id"`
12 CompanyId int64 `json:"companyId"` 12 CompanyId int64 `json:"companyId"`
@@ -23,6 +23,7 @@ type ArticleSection struct { @@ -23,6 +23,7 @@ type ArticleSection struct {
23 type ArticleSectionRepository interface { 23 type ArticleSectionRepository interface {
24 Insert(ctx context.Context, conn transaction.Conn, dm *ArticleSection) (*ArticleSection, error) 24 Insert(ctx context.Context, conn transaction.Conn, dm *ArticleSection) (*ArticleSection, error)
25 Update(ctx context.Context, conn transaction.Conn, dm *ArticleSection) (*ArticleSection, error) 25 Update(ctx context.Context, conn transaction.Conn, dm *ArticleSection) (*ArticleSection, error)
  26 + UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *ArticleSection) (*ArticleSection, error)
26 Delete(ctx context.Context, conn transaction.Conn, dm *ArticleSection) (*ArticleSection, error) 27 Delete(ctx context.Context, conn transaction.Conn, dm *ArticleSection) (*ArticleSection, error)
27 FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleSection, error) 28 FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleSection, error)
28 Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleSection, error) 29 Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleSection, error)
@@ -6,7 +6,7 @@ import ( @@ -6,7 +6,7 @@ import (
6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction" 6 "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
7 ) 7 )
8 8
9 -// 文章的标签 9 +// 文章全部的标签
10 10
11 type ArticleTag struct { 11 type ArticleTag struct {
12 Id int64 `json:"id"` 12 Id int64 `json:"id"`
@@ -22,8 +22,9 @@ type ArticleTag struct { @@ -22,8 +22,9 @@ type ArticleTag struct {
22 } 22 }
23 type ArticleTagRepository interface { 23 type ArticleTagRepository interface {
24 Insert(ctx context.Context, conn transaction.Conn, dm *ArticleTag) (*ArticleTag, error) 24 Insert(ctx context.Context, conn transaction.Conn, dm *ArticleTag) (*ArticleTag, error)
25 - Update(ctx context.Context, conn transaction.Conn, dm *ArticleTag) (*ArticleSection, error) 25 + Update(ctx context.Context, conn transaction.Conn, dm *ArticleTag) (*ArticleTag, error)
26 Delete(ctx context.Context, conn transaction.Conn, dm *ArticleTag) (*ArticleTag, error) 26 Delete(ctx context.Context, conn transaction.Conn, dm *ArticleTag) (*ArticleTag, error)
  27 + UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *ArticleTag) (*ArticleTag, error)
27 FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleTag, error) 28 FindOne(ctx context.Context, conn transaction.Conn, id int64) (*ArticleTag, error)
28 Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleTag, error) 29 Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*ArticleTag, error)
29 } 30 }
@@ -10,7 +10,7 @@ type User struct { @@ -10,7 +10,7 @@ type User struct {
10 CompanyId int64 `json:"companyId,omitempty"` // 公司ID 10 CompanyId int64 `json:"companyId,omitempty"` // 公司ID
11 DepartmentId int64 `json:"departmentId,omitempty"` // 部门ID 11 DepartmentId int64 `json:"departmentId,omitempty"` // 部门ID
12 Roles []int64 `json:"roleId,omitempty"` // 角色 12 Roles []int64 `json:"roleId,omitempty"` // 角色
13 - Flag int `json:"flag"` // 标识 1:管理员 2:普通用户 (有绑定角色是管理员) 13 + Flag int `json:"flag,omitempty"` // 标识 1:管理员 2:普通用户 (有绑定角色是管理员)
14 Name string `json:"name,omitempty"` // 名称 14 Name string `json:"name,omitempty"` // 名称
15 Avatar string `json:"avatar,omitempty"` // 头像 15 Avatar string `json:"avatar,omitempty"` // 头像
16 Phone string `json:"phone,omitempty"` // 手机号 唯一 16 Phone string `json:"phone,omitempty"` // 手机号 唯一
1 package domain 1 package domain
2 2
  3 +import (
  4 + "context"
  5 +
  6 + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/interanl/pkg/db/transaction"
  7 +)
  8 +
3 // 人员查看文章详情后,标记一个记录 9 // 人员查看文章详情后,标记一个记录
4 // 浏览记录 10 // 浏览记录
5 11
@@ -14,3 +20,12 @@ type UserReadArticle struct { @@ -14,3 +20,12 @@ type UserReadArticle struct {
14 DeletedAt int64 `json:"deletedAt,omitempty"` 20 DeletedAt int64 `json:"deletedAt,omitempty"`
15 Version int `json:"version,omitempty"` 21 Version int `json:"version,omitempty"`
16 } 22 }
  23 +
  24 +type UserReadArticleRepository interface {
  25 + Insert(ctx context.Context, conn transaction.Conn, dm *UserReadArticle) (*UserReadArticle, error)
  26 + Update(ctx context.Context, conn transaction.Conn, dm *UserReadArticle) (*UserReadArticle, error)
  27 + UpdateWithVersion(ctx context.Context, conn transaction.Conn, dm *UserReadArticle) (*UserReadArticle, error)
  28 + Delete(ctx context.Context, conn transaction.Conn, dm *UserReadArticle) (*UserReadArticle, error)
  29 + FindOne(ctx context.Context, conn transaction.Conn, id int64) (*UserReadArticle, error)
  30 + Find(ctx context.Context, conn transaction.Conn, queryOptions map[string]interface{}) (int64, []*UserReadArticle, error)
  31 +}