chenyang
11 months ago
14 changed files with 334 additions and 2 deletions
-
19app/api/category/category.go
-
62app/api/category/v1/category.go
-
15app/api/collect/v1/collect.go
-
5app/controller/category/category.go
-
15app/controller/category/category_new.go
-
14app/controller/category/category_v1_batch_delete.go
-
14app/controller/category/category_v1_create.go
-
14app/controller/category/category_v1_delete.go
-
14app/controller/category/category_v1_get_list.go
-
14app/controller/category/category_v1_update.go
-
50app/logic/category/category.go
-
51app/logic/collect/collect.go
-
5app/logic/logic.go
-
44app/service/category.go
@ -0,0 +1,19 @@ |
|||||
|
// =================================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package category |
||||
|
|
||||
|
import ( |
||||
|
"context" |
||||
|
|
||||
|
"xgit.pub/module/cms/app/api/category/v1" |
||||
|
) |
||||
|
|
||||
|
type ICategoryV1 interface { |
||||
|
GetList(ctx context.Context, req *v1.GetListReq) (res *v1.GetListRes, err error) |
||||
|
Create(ctx context.Context, req *v1.CreateReq) (res *v1.CreateRes, err error) |
||||
|
Update(ctx context.Context, req *v1.UpdateReq) (res *v1.UpdateRes, err error) |
||||
|
Delete(ctx context.Context, req *v1.DeleteReq) (res *v1.DeleteRes, err error) |
||||
|
BatchDelete(ctx context.Context, req *v1.BatchDeleteReq) (res *v1.BatchDeleteRes, err error) |
||||
|
} |
@ -0,0 +1,62 @@ |
|||||
|
package v1 |
||||
|
|
||||
|
import ( |
||||
|
"github.com/gogf/gf/v2/frame/g" |
||||
|
"xgit.pub/st52/xcore/dto" |
||||
|
) |
||||
|
|
||||
|
// GetTreeReq 获取分类树请求参数
|
||||
|
type GetTreeReq struct { |
||||
|
g.Meta `path:"/category/tree" method:"post" summary:"获取树" tags:"分类"` |
||||
|
} |
||||
|
|
||||
|
// GetTreeRes 获取分类树返回参数
|
||||
|
type GetTreeRes struct { |
||||
|
Data interface{} `json:"data"` |
||||
|
} |
||||
|
|
||||
|
// GetListReq 获取分类列表
|
||||
|
type GetListReq struct { |
||||
|
g.Meta `path:"/category/list" method:"post" summary:"获取列表" tags:"分类"` |
||||
|
Key string `json:"key"` |
||||
|
dto.PageReq |
||||
|
} |
||||
|
|
||||
|
// GetListRes 获取分类列表返回参数
|
||||
|
type GetListRes struct { |
||||
|
dto.PageRes |
||||
|
} |
||||
|
|
||||
|
// CreateReq 创建分类请求参数
|
||||
|
type CreateReq struct { |
||||
|
g.Meta `path:"/category/create" method:"post" summary:"创建" tags:"分类"` |
||||
|
} |
||||
|
|
||||
|
// CreateRes 创建分类返回参数
|
||||
|
type CreateRes struct{} |
||||
|
|
||||
|
// UpdateReq 更新分类请求参数
|
||||
|
type UpdateReq struct { |
||||
|
g.Meta `path:"/category/update" method:"post" summary:"更新" tags:"分类"` |
||||
|
} |
||||
|
|
||||
|
// UpdateRes 更新分类返回参数
|
||||
|
type UpdateRes struct{} |
||||
|
|
||||
|
// DeleteReq 删除分类请求参数
|
||||
|
type DeleteReq struct { |
||||
|
g.Meta `path:"/category/delete" method:"post" summary:"删除" tags:"分类"` |
||||
|
Id uint `json:"id"` |
||||
|
} |
||||
|
|
||||
|
// DeleteRes 删除分类返回参数
|
||||
|
type DeleteRes struct{} |
||||
|
|
||||
|
// BatchDeleteReq 批量删除分类请求参数
|
||||
|
type BatchDeleteReq struct { |
||||
|
g.Meta `path:"/category/batch/delete" method:"post" summary:"批量删除" tags:"分类"` |
||||
|
Ids []uint `json:"ids"` |
||||
|
} |
||||
|
|
||||
|
// BatchDeleteRes 批量删除分类返回参数
|
||||
|
type BatchDeleteRes struct{} |
@ -0,0 +1,5 @@ |
|||||
|
// =================================================================================
|
||||
|
// This is auto-generated by GoFrame CLI tool only once. Fill this file as you wish.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package category |
@ -0,0 +1,15 @@ |
|||||
|
// =================================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// =================================================================================
|
||||
|
|
||||
|
package category |
||||
|
|
||||
|
import ( |
||||
|
"xgit.pub/module/cms/app/api/category" |
||||
|
) |
||||
|
|
||||
|
type ControllerV1 struct{} |
||||
|
|
||||
|
func NewV1() category.ICategoryV1 { |
||||
|
return &ControllerV1{} |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
package category |
||||
|
|
||||
|
import ( |
||||
|
"context" |
||||
|
|
||||
|
"github.com/gogf/gf/v2/errors/gcode" |
||||
|
"github.com/gogf/gf/v2/errors/gerror" |
||||
|
|
||||
|
"xgit.pub/module/cms/app/api/category/v1" |
||||
|
) |
||||
|
|
||||
|
func (c *ControllerV1) BatchDelete(ctx context.Context, req *v1.BatchDeleteReq) (res *v1.BatchDeleteRes, err error) { |
||||
|
return nil, gerror.NewCode(gcode.CodeNotImplemented) |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
package category |
||||
|
|
||||
|
import ( |
||||
|
"context" |
||||
|
|
||||
|
"github.com/gogf/gf/v2/errors/gcode" |
||||
|
"github.com/gogf/gf/v2/errors/gerror" |
||||
|
|
||||
|
"xgit.pub/module/cms/app/api/category/v1" |
||||
|
) |
||||
|
|
||||
|
func (c *ControllerV1) Create(ctx context.Context, req *v1.CreateReq) (res *v1.CreateRes, err error) { |
||||
|
return nil, gerror.NewCode(gcode.CodeNotImplemented) |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
package category |
||||
|
|
||||
|
import ( |
||||
|
"context" |
||||
|
|
||||
|
"github.com/gogf/gf/v2/errors/gcode" |
||||
|
"github.com/gogf/gf/v2/errors/gerror" |
||||
|
|
||||
|
"xgit.pub/module/cms/app/api/category/v1" |
||||
|
) |
||||
|
|
||||
|
func (c *ControllerV1) Delete(ctx context.Context, req *v1.DeleteReq) (res *v1.DeleteRes, err error) { |
||||
|
return nil, gerror.NewCode(gcode.CodeNotImplemented) |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
package category |
||||
|
|
||||
|
import ( |
||||
|
"context" |
||||
|
|
||||
|
"github.com/gogf/gf/v2/errors/gcode" |
||||
|
"github.com/gogf/gf/v2/errors/gerror" |
||||
|
|
||||
|
"xgit.pub/module/cms/app/api/category/v1" |
||||
|
) |
||||
|
|
||||
|
func (c *ControllerV1) GetList(ctx context.Context, req *v1.GetListReq) (res *v1.GetListRes, err error) { |
||||
|
return nil, gerror.NewCode(gcode.CodeNotImplemented) |
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
package category |
||||
|
|
||||
|
import ( |
||||
|
"context" |
||||
|
|
||||
|
"github.com/gogf/gf/v2/errors/gcode" |
||||
|
"github.com/gogf/gf/v2/errors/gerror" |
||||
|
|
||||
|
"xgit.pub/module/cms/app/api/category/v1" |
||||
|
) |
||||
|
|
||||
|
func (c *ControllerV1) Update(ctx context.Context, req *v1.UpdateReq) (res *v1.UpdateRes, err error) { |
||||
|
return nil, gerror.NewCode(gcode.CodeNotImplemented) |
||||
|
} |
@ -0,0 +1,50 @@ |
|||||
|
package category |
||||
|
|
||||
|
import ( |
||||
|
"context" |
||||
|
v1 "xgit.pub/module/cms/app/api/category/v1" |
||||
|
"xgit.pub/module/cms/app/service" |
||||
|
) |
||||
|
|
||||
|
type sCategory struct { |
||||
|
} |
||||
|
|
||||
|
func init() { |
||||
|
Category := New() |
||||
|
service.RegisterCategory(Category) |
||||
|
} |
||||
|
|
||||
|
func New() *sCategory { |
||||
|
return &sCategory{} |
||||
|
} |
||||
|
|
||||
|
// GetTree 获取树
|
||||
|
func (s *sCategory) GetTree(ctx context.Context, req *v1.GetTreeReq) (res *v1.GetTreeRes, err error) { |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// GetList 获取列表
|
||||
|
func (s *sCategory) GetList(ctx context.Context, req *v1.GetListReq) (res *v1.GetListRes, err error) { |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// Create 创建
|
||||
|
func (s *sCategory) Create(ctx context.Context, req *v1.CreateReq) (res *v1.CreateRes, err error) { |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// Update 更新
|
||||
|
func (s *sCategory) Update(ctx context.Context, req *v1.UpdateReq) (res *v1.UpdateRes, err error) { |
||||
|
|
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// Delete 删除
|
||||
|
func (s *sCategory) Delete(ctx context.Context, req *v1.DeleteReq) (res *v1.DeleteRes, err error) { |
||||
|
return |
||||
|
} |
||||
|
|
||||
|
// BatchDelete 批量删除
|
||||
|
func (s *sCategory) BatchDelete(ctx context.Context, req *v1.BatchDeleteReq) (res *v1.BatchDeleteRes, err error) { |
||||
|
return |
||||
|
} |
@ -1 +1,6 @@ |
|||||
package logic |
package logic |
||||
|
|
||||
|
import ( |
||||
|
_ "xgit.pub/module/cms/app/logic/category" |
||||
|
_ "xgit.pub/module/cms/app/logic/collect" |
||||
|
) |
@ -0,0 +1,44 @@ |
|||||
|
// ================================================================================
|
||||
|
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
|
// You can delete these comments if you wish manually maintain this interface file.
|
||||
|
// ================================================================================
|
||||
|
|
||||
|
package service |
||||
|
|
||||
|
import ( |
||||
|
"context" |
||||
|
|
||||
|
v1 "xgit.pub/module/cms/app/api/category/v1" |
||||
|
) |
||||
|
|
||||
|
type ( |
||||
|
ICategory interface { |
||||
|
// GetTree 获取树
|
||||
|
GetTree(ctx context.Context, req *v1.GetTreeReq) (res *v1.GetTreeRes, err error) |
||||
|
// GetList 获取列表
|
||||
|
GetList(ctx context.Context, req *v1.GetListReq) (res *v1.GetListRes, err error) |
||||
|
// Create 创建
|
||||
|
Create(ctx context.Context, req *v1.CreateReq) (res *v1.CreateRes, err error) |
||||
|
// Update 更新
|
||||
|
Update(ctx context.Context, req *v1.UpdateReq) (res *v1.UpdateRes, err error) |
||||
|
// Delete 删除
|
||||
|
Delete(ctx context.Context, req *v1.DeleteReq) (res *v1.DeleteRes, err error) |
||||
|
// BatchDelete 批量删除
|
||||
|
BatchDelete(ctx context.Context, req *v1.BatchDeleteReq) (res *v1.BatchDeleteRes, err error) |
||||
|
} |
||||
|
) |
||||
|
|
||||
|
var ( |
||||
|
localCategory ICategory |
||||
|
) |
||||
|
|
||||
|
func Category() ICategory { |
||||
|
if localCategory == nil { |
||||
|
panic("implement not found for interface ICategory, forgot register?") |
||||
|
} |
||||
|
return localCategory |
||||
|
} |
||||
|
|
||||
|
func RegisterCategory(i ICategory) { |
||||
|
localCategory = i |
||||
|
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue