正在显示
11 个修改的文件
包含
24 行增加
和
41 行删除
| @@ -80,7 +80,7 @@ type ( | @@ -80,7 +80,7 @@ type ( | ||
| 80 | //标签下拉列表 | 80 | //标签下拉列表 |
| 81 | type ( | 81 | type ( |
| 82 | CategoryOptionsRequest { | 82 | CategoryOptionsRequest { |
| 83 | - CompanyId int64 `path:",optional"` // 公司ID | 83 | + Enable int `form:"enable,optional"` // 启用状态 1:启用 |
| 84 | } | 84 | } |
| 85 | CategoryOptionsResponse { | 85 | CategoryOptionsResponse { |
| 86 | Options []CategoryOptions `json:"options"` | 86 | Options []CategoryOptions `json:"options"` |
| 1 | package tags | 1 | package tags |
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
| 4 | "net/http" | 5 | "net/http" |
| 5 | 6 | ||
| 6 | "github.com/zeromicro/go-zero/rest/httpx" | 7 | "github.com/zeromicro/go-zero/rest/httpx" |
| @@ -19,10 +20,6 @@ func ArticleCategoryDeleteHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -19,10 +20,6 @@ func ArticleCategoryDeleteHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 19 | 20 | ||
| 20 | l := tags.NewArticleCategoryDeleteLogic(r.Context(), svcCtx) | 21 | l := tags.NewArticleCategoryDeleteLogic(r.Context(), svcCtx) |
| 21 | resp, err := l.ArticleCategoryDelete(&req) | 22 | resp, err := l.ArticleCategoryDelete(&req) |
| 22 | - if err != nil { | ||
| 23 | - httpx.ErrorCtx(r.Context(), w, err) | ||
| 24 | - } else { | ||
| 25 | - httpx.OkJsonCtx(r.Context(), w, resp) | ||
| 26 | - } | 23 | + result.HttpResult(r, w, resp, err) |
| 27 | } | 24 | } |
| 28 | } | 25 | } |
| 1 | package tags | 1 | package tags |
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
| 4 | "net/http" | 5 | "net/http" |
| 5 | 6 | ||
| 6 | "github.com/zeromicro/go-zero/rest/httpx" | 7 | "github.com/zeromicro/go-zero/rest/httpx" |
| @@ -19,10 +20,6 @@ func ArticleCategoryGetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -19,10 +20,6 @@ func ArticleCategoryGetHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 19 | 20 | ||
| 20 | l := tags.NewArticleCategoryGetLogic(r.Context(), svcCtx) | 21 | l := tags.NewArticleCategoryGetLogic(r.Context(), svcCtx) |
| 21 | resp, err := l.ArticleCategoryGet(&req) | 22 | resp, err := l.ArticleCategoryGet(&req) |
| 22 | - if err != nil { | ||
| 23 | - httpx.ErrorCtx(r.Context(), w, err) | ||
| 24 | - } else { | ||
| 25 | - httpx.OkJsonCtx(r.Context(), w, resp) | ||
| 26 | - } | 23 | + result.HttpResult(r, w, resp, err) |
| 27 | } | 24 | } |
| 28 | } | 25 | } |
| 1 | package tags | 1 | package tags |
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
| 4 | "net/http" | 5 | "net/http" |
| 5 | 6 | ||
| 6 | "github.com/zeromicro/go-zero/rest/httpx" | 7 | "github.com/zeromicro/go-zero/rest/httpx" |
| @@ -19,10 +20,6 @@ func ArticleCategoryOptionsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc | @@ -19,10 +20,6 @@ func ArticleCategoryOptionsHandler(svcCtx *svc.ServiceContext) http.HandlerFunc | ||
| 19 | 20 | ||
| 20 | l := tags.NewArticleCategoryOptionsLogic(r.Context(), svcCtx) | 21 | l := tags.NewArticleCategoryOptionsLogic(r.Context(), svcCtx) |
| 21 | resp, err := l.ArticleCategoryOptions(&req) | 22 | resp, err := l.ArticleCategoryOptions(&req) |
| 22 | - if err != nil { | ||
| 23 | - httpx.ErrorCtx(r.Context(), w, err) | ||
| 24 | - } else { | ||
| 25 | - httpx.OkJsonCtx(r.Context(), w, resp) | ||
| 26 | - } | 23 | + result.HttpResult(r, w, resp, err) |
| 27 | } | 24 | } |
| 28 | } | 25 | } |
| 1 | package tags | 1 | package tags |
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
| 4 | "net/http" | 5 | "net/http" |
| 5 | 6 | ||
| 6 | "github.com/zeromicro/go-zero/rest/httpx" | 7 | "github.com/zeromicro/go-zero/rest/httpx" |
| @@ -19,10 +20,6 @@ func ArticleCategorySaveHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -19,10 +20,6 @@ func ArticleCategorySaveHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 19 | 20 | ||
| 20 | l := tags.NewArticleCategorySaveLogic(r.Context(), svcCtx) | 21 | l := tags.NewArticleCategorySaveLogic(r.Context(), svcCtx) |
| 21 | resp, err := l.ArticleCategorySave(&req) | 22 | resp, err := l.ArticleCategorySave(&req) |
| 22 | - if err != nil { | ||
| 23 | - httpx.ErrorCtx(r.Context(), w, err) | ||
| 24 | - } else { | ||
| 25 | - httpx.OkJsonCtx(r.Context(), w, resp) | ||
| 26 | - } | 23 | + result.HttpResult(r, w, resp, err) |
| 27 | } | 24 | } |
| 28 | } | 25 | } |
| 1 | package tags | 1 | package tags |
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
| 4 | "net/http" | 5 | "net/http" |
| 5 | 6 | ||
| 6 | "github.com/zeromicro/go-zero/rest/httpx" | 7 | "github.com/zeromicro/go-zero/rest/httpx" |
| @@ -19,10 +20,6 @@ func ArticleCategorySearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -19,10 +20,6 @@ func ArticleCategorySearchHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 19 | 20 | ||
| 20 | l := tags.NewArticleCategorySearchLogic(r.Context(), svcCtx) | 21 | l := tags.NewArticleCategorySearchLogic(r.Context(), svcCtx) |
| 21 | resp, err := l.ArticleCategorySearch(&req) | 22 | resp, err := l.ArticleCategorySearch(&req) |
| 22 | - if err != nil { | ||
| 23 | - httpx.ErrorCtx(r.Context(), w, err) | ||
| 24 | - } else { | ||
| 25 | - httpx.OkJsonCtx(r.Context(), w, resp) | ||
| 26 | - } | 23 | + result.HttpResult(r, w, resp, err) |
| 27 | } | 24 | } |
| 28 | } | 25 | } |
| 1 | package tags | 1 | package tags |
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | + "gitlab.fjmaimaimai.com/allied-creation/sumifcc-discuss/pkg/result" | ||
| 4 | "net/http" | 5 | "net/http" |
| 5 | 6 | ||
| 6 | "github.com/zeromicro/go-zero/rest/httpx" | 7 | "github.com/zeromicro/go-zero/rest/httpx" |
| @@ -19,10 +20,6 @@ func ArticleCategoryUpdateHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | @@ -19,10 +20,6 @@ func ArticleCategoryUpdateHandler(svcCtx *svc.ServiceContext) http.HandlerFunc { | ||
| 19 | 20 | ||
| 20 | l := tags.NewArticleCategoryUpdateLogic(r.Context(), svcCtx) | 21 | l := tags.NewArticleCategoryUpdateLogic(r.Context(), svcCtx) |
| 21 | resp, err := l.ArticleCategoryUpdate(&req) | 22 | resp, err := l.ArticleCategoryUpdate(&req) |
| 22 | - if err != nil { | ||
| 23 | - httpx.ErrorCtx(r.Context(), w, err) | ||
| 24 | - } else { | ||
| 25 | - httpx.OkJsonCtx(r.Context(), w, resp) | ||
| 26 | - } | 23 | + result.HttpResult(r, w, resp, err) |
| 27 | } | 24 | } |
| 28 | } | 25 | } |
| @@ -46,7 +46,7 @@ func (l *SystemDeleteArticleLogic) SystemDeleteArticle(req *types.SystemArticleD | @@ -46,7 +46,7 @@ func (l *SystemDeleteArticleLogic) SystemDeleteArticle(req *types.SystemArticleD | ||
| 46 | if err != nil { | 46 | if err != nil { |
| 47 | return err | 47 | return err |
| 48 | } | 48 | } |
| 49 | - _, err = l.svcCtx.ArticleRepository.Delete(l.ctx, l.conn, article) | 49 | + _, err = l.svcCtx.ArticleRepository.Delete(l.ctx, conn, article) |
| 50 | if err != nil { | 50 | if err != nil { |
| 51 | return err | 51 | return err |
| 52 | } | 52 | } |
| @@ -32,7 +32,7 @@ func (l *ArticleCategoryOptionsLogic) ArticleCategoryOptions(req *types.Category | @@ -32,7 +32,7 @@ func (l *ArticleCategoryOptionsLogic) ArticleCategoryOptions(req *types.Category | ||
| 32 | userToken = contextdata.GetUserTokenFromCtx(l.ctx) | 32 | userToken = contextdata.GetUserTokenFromCtx(l.ctx) |
| 33 | ) | 33 | ) |
| 34 | 34 | ||
| 35 | - queryOptions := domain.NewQueryOptions().WithKV("enable", 1) | 35 | + queryOptions := domain.NewQueryOptions().WithKV("enable", req.Enable) |
| 36 | 36 | ||
| 37 | _, dms, err = l.svcCtx.ArticleCategoryRepository.Find(l.ctx, conn, userToken.CompanyId, queryOptions) | 37 | _, dms, err = l.svcCtx.ArticleCategoryRepository.Find(l.ctx, conn, userToken.CompanyId, queryOptions) |
| 38 | list := make([]types.CategoryOptions, 0) | 38 | list := make([]types.CategoryOptions, 0) |
| @@ -83,13 +83,14 @@ func NewServiceContext(c config.Config) *ServiceContext { | @@ -83,13 +83,14 @@ func NewServiceContext(c config.Config) *ServiceContext { | ||
| 83 | LogRequest: middleware.NewLogRequestMiddleware(c.LogRequest).Handle, | 83 | LogRequest: middleware.NewLogRequestMiddleware(c.LogRequest).Handle, |
| 84 | MiniProgram: miniProgram, | 84 | MiniProgram: miniProgram, |
| 85 | 85 | ||
| 86 | - ArticleBackupRepository: repository.NewArticleBackupRepository(cache.NewCachedRepository(mlCache)), | ||
| 87 | - ArticleCommentRepository: repository.NewArticleCommentRepository(cache.NewCachedRepository(mlCache)), | ||
| 88 | - ArticleDraftRepository: repository.NewArticleDraftRepository(cache.NewCachedRepository(mlCache)), | ||
| 89 | - ArticleRepository: repository.NewArticleRepository(cache.NewCachedRepository(mlCache)), | ||
| 90 | - ArticleSectionRepository: repository.NewArticleSectionRepository(cache.NewCachedRepository(mlCache)), | ||
| 91 | - ArticleAndTagRepository: repository.NewArticleAndTagRepository(cache.NewCachedRepository(mlCache)), | ||
| 92 | - ArticleCategoryRepository: repository.NewArticleCategoryRepository(cache.NewCachedRepository(mlCache)), | 86 | + ArticleBackupRepository: repository.NewArticleBackupRepository(cache.NewCachedRepository(mlCache)), |
| 87 | + ArticleCommentRepository: repository.NewArticleCommentRepository(cache.NewCachedRepository(mlCache)), | ||
| 88 | + ArticleDraftRepository: repository.NewArticleDraftRepository(cache.NewCachedRepository(mlCache)), | ||
| 89 | + ArticleRepository: repository.NewArticleRepository(cache.NewCachedRepository(mlCache)), | ||
| 90 | + ArticleSectionRepository: repository.NewArticleSectionRepository(cache.NewCachedRepository(mlCache)), | ||
| 91 | + ArticleAndTagRepository: repository.NewArticleAndTagRepository(cache.NewCachedRepository(mlCache)), | ||
| 92 | + ArticleCategoryRepository: repository.NewArticleCategoryRepository(cache.NewCachedRepository(mlCache)), | ||
| 93 | + ArticleDraftOperationRepository: repository.NewArticleDraftOperationRepository(cache.NewCachedRepository(mlCache)), | ||
| 93 | 94 | ||
| 94 | CompanyRepository: repository.NewCompanyRepository(cache.NewCachedRepository(mlCache)), | 95 | CompanyRepository: repository.NewCompanyRepository(cache.NewCachedRepository(mlCache)), |
| 95 | DepartmentRepository: repository.NewDepartmentRepository(cache.NewCachedRepository(mlCache)), | 96 | DepartmentRepository: repository.NewDepartmentRepository(cache.NewCachedRepository(mlCache)), |
| @@ -1756,7 +1756,7 @@ type ArticleCategoryItem struct { | @@ -1756,7 +1756,7 @@ type ArticleCategoryItem struct { | ||
| 1756 | } | 1756 | } |
| 1757 | 1757 | ||
| 1758 | type CategoryOptionsRequest struct { | 1758 | type CategoryOptionsRequest struct { |
| 1759 | - CompanyId int64 `path:",optional"` // 公司ID | 1759 | + Enable int `form:"enable,optional"` // 启用状态 1:启用 |
| 1760 | } | 1760 | } |
| 1761 | 1761 | ||
| 1762 | type CategoryOptionsResponse struct { | 1762 | type CategoryOptionsResponse struct { |
-
请 注册 或 登录 后发表评论