27 lines
819 B
Go
27 lines
819 B
Go
package config
|
|
|
|
import (
|
|
"context"
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
"sundynix-micro-go/app/plant/api/internal/svc"
|
|
"sundynix-micro-go/app/plant/api/internal/types"
|
|
plantPb "sundynix-micro-go/app/plant/rpc/plant"
|
|
)
|
|
|
|
type CreateLevelConfigLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewCreateLevelConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateLevelConfigLogic {
|
|
return &CreateLevelConfigLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
|
|
}
|
|
|
|
func (l *CreateLevelConfigLogic) CreateLevelConfig(req *types.CreateLevelConfigReq) error {
|
|
_, err := l.svcCtx.PlantRpc.CreateLevelConfig(l.ctx, &plantPb.CreateLevelConfigReq{
|
|
Level: int32(req.Level), Title: req.Title, MinSunlight: req.MinSunlight, Perks: req.Perks,
|
|
})
|
|
return err
|
|
}
|