初始化项目
This commit is contained in:
@@ -3,19 +3,20 @@ package controller
|
||||
import (
|
||||
"context"
|
||||
|
||||
"cidService/model/dto"
|
||||
"cidService/service"
|
||||
"cidservice/model/dto"
|
||||
"cidservice/service"
|
||||
|
||||
"github.com/gogf/gf/v2/errors/gerror"
|
||||
)
|
||||
|
||||
var (
|
||||
Strategy = cStrategy{}
|
||||
Strategy = strategy{}
|
||||
)
|
||||
|
||||
type cStrategy struct{}
|
||||
type strategy struct{}
|
||||
|
||||
// Create 创建策略
|
||||
func (c *cStrategy) Create(ctx context.Context, req *dto.CreateStrategyReq) (res *dto.StrategyRes, err error) {
|
||||
func (c *strategy) Create(ctx context.Context, req *dto.CreateStrategyReq) (res *dto.StrategyRes, err error) {
|
||||
id, err := service.Strategy.CreateStrategy(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -30,7 +31,7 @@ func (c *cStrategy) Create(ctx context.Context, req *dto.CreateStrategyReq) (res
|
||||
}
|
||||
|
||||
// Update 更新策略
|
||||
func (c *cStrategy) Update(ctx context.Context, req *dto.UpdateStrategyReq) (res *dto.StrategyRes, err error) {
|
||||
func (c *strategy) Update(ctx context.Context, req *dto.UpdateStrategyReq) (res *dto.StrategyRes, err error) {
|
||||
affected, err := service.Strategy.UpdateStrategy(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -48,7 +49,7 @@ func (c *cStrategy) Update(ctx context.Context, req *dto.UpdateStrategyReq) (res
|
||||
}
|
||||
|
||||
// Delete 删除策略
|
||||
func (c *cStrategy) Delete(ctx context.Context, req *dto.DeleteStrategyReq) (res *dto.DeleteStrategyRes, err error) {
|
||||
func (c *strategy) Delete(ctx context.Context, req *dto.DeleteStrategyReq) (res *dto.DeleteStrategyRes, err error) {
|
||||
affected, err := service.Strategy.DeleteStrategy(ctx, req.Id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -63,7 +64,7 @@ func (c *cStrategy) Delete(ctx context.Context, req *dto.DeleteStrategyReq) (res
|
||||
}
|
||||
|
||||
// GetByID 根据ID获取策略
|
||||
func (c *cStrategy) GetByID(ctx context.Context, req *dto.GetStrategyReq) (res *dto.StrategyRes, err error) {
|
||||
func (c *strategy) GetByID(ctx context.Context, req *dto.GetStrategyReq) (res *dto.StrategyRes, err error) {
|
||||
strategy, err := service.Strategy.GetStrategyByID(ctx, req.Id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -73,6 +74,6 @@ func (c *cStrategy) GetByID(ctx context.Context, req *dto.GetStrategyReq) (res *
|
||||
}
|
||||
|
||||
// GetList 获取策略列表
|
||||
func (c *cStrategy) GetList(ctx context.Context, req *dto.GetStrategyListReq) (res *dto.GetStrategyListRes, err error) {
|
||||
func (c *strategy) GetList(ctx context.Context, req *dto.GetStrategyListReq) (res *dto.GetStrategyListRes, err error) {
|
||||
return service.Strategy.GetStrategyList(ctx, req)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user