正在显示
10 个修改的文件
包含
324 行增加
和
0 行删除
| @@ -7,6 +7,7 @@ import ( | @@ -7,6 +7,7 @@ import ( | ||
| 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 | company "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/company" |
| 9 | message "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/message" | 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" | ||
| 10 | user "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/user" | 11 | user "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/cmd/discuss/api/internal/handler/user" |
| 11 | "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" |
| 12 | 13 | ||
| @@ -59,6 +60,33 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | @@ -59,6 +60,33 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) { | ||
| 59 | []rest.Route{ | 60 | []rest.Route{ |
| 60 | { | 61 | { |
| 61 | Method: http.MethodPost, | 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, | ||
| 62 | Path: "/mini/user/apply-join-company", | 90 | Path: "/mini/user/apply-join-company", |
| 63 | Handler: user.MiniUserApplyJoinCompanyHandler(serverCtx), | 91 | Handler: user.MiniUserApplyJoinCompanyHandler(serverCtx), |
| 64 | }, | 92 | }, |
| 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 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 | +} |
| @@ -63,6 +63,70 @@ type User struct { | @@ -63,6 +63,70 @@ type User struct { | ||
| 63 | Position string `json:"position,omitempty"` // 职位 | 63 | Position string `json:"position,omitempty"` // 职位 |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | +type TagCreateRequest struct { | ||
| 67 | + CompanyId int64 `json:"companyId"` | ||
| 68 | + Image string `json:"image"` | ||
| 69 | + Name string `json:"name"` // 标签名称 | ||
| 70 | + Group string `json:"group"` // 标签分类 | ||
| 71 | + Remark string `json:"remark"` // 备注 | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +type TagCreateResponse struct { | ||
| 75 | + Id int64 `json:"id"` | ||
| 76 | +} | ||
| 77 | + | ||
| 78 | +type TagEditRequest struct { | ||
| 79 | + Id int64 `json:"id"` | ||
| 80 | + CompanyId int64 `json:"companyId"` | ||
| 81 | + Image string `json:"image"` | ||
| 82 | + Name string `json:"name"` // 标签名称 | ||
| 83 | + Group string `json:"group"` // 标签分类 | ||
| 84 | + Remark string `json:"remark"` // 备注 | ||
| 85 | +} | ||
| 86 | + | ||
| 87 | +type TagEditResponse struct { | ||
| 88 | + Id int64 `json:"id"` | ||
| 89 | +} | ||
| 90 | + | ||
| 91 | +type TagGetRequest struct { | ||
| 92 | + Id int64 `json:"id"` | ||
| 93 | +} | ||
| 94 | + | ||
| 95 | +type TagGetResponse struct { | ||
| 96 | + Id int64 `json:"id"` | ||
| 97 | + Image string `json:"image"` | ||
| 98 | + Name string `json:"name"` // 标签名称 | ||
| 99 | + Group string `json:"group"` // 标签分类 | ||
| 100 | + Remark string `json:"remark"` // 备注 | ||
| 101 | +} | ||
| 102 | + | ||
| 103 | +type TagListRequest struct { | ||
| 104 | + Page int `json:"page"` | ||
| 105 | + Size int `json:"size"` | ||
| 106 | +} | ||
| 107 | + | ||
| 108 | +type TagListResponse struct { | ||
| 109 | + Total int `json:"total"` | ||
| 110 | + List []TagItem `json:"list"` | ||
| 111 | +} | ||
| 112 | + | ||
| 113 | +type TagItem struct { | ||
| 114 | + Id int64 `json:"id"` | ||
| 115 | + Image string `json:"image"` | ||
| 116 | + Name string `json:"name"` // 标签名称 | ||
| 117 | + Group string `json:"group"` // 标签分类 | ||
| 118 | + Remark string `json:"remark"` // 备注 | ||
| 119 | + CreatedAt int64 `json:"createdAt"` | ||
| 120 | +} | ||
| 121 | + | ||
| 122 | +type TagDeleteRequest struct { | ||
| 123 | + Id int64 `json:"id"` | ||
| 124 | +} | ||
| 125 | + | ||
| 126 | +type TagDeleteResponse struct { | ||
| 127 | + Id int64 `json:"id"` | ||
| 128 | +} | ||
| 129 | + | ||
| 66 | type MiniUserLoginRequest struct { | 130 | type MiniUserLoginRequest struct { |
| 67 | LoginType string `json:"loginType"` // 登录类型 wechat-login whchat-phone-login phone-password-login phone-smscode-login | 131 | LoginType string `json:"loginType"` // 登录类型 wechat-login whchat-phone-login phone-password-login phone-smscode-login |
| 68 | WechatAuthCode string `json:"wechatAuthcode,optional"` // 微信登录 授权码 | 132 | WechatAuthCode string `json:"wechatAuthcode,optional"` // 微信登录 授权码 |
-
请 注册 或 登录 后发表评论