Files
sundynix-micro-be/app/plant/api/internal/logic/config/updatelevelconfiglogic.go
T
2026-05-23 13:55:05 +08:00

27 lines
831 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 UpdateLevelConfigLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewUpdateLevelConfigLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateLevelConfigLogic {
return &UpdateLevelConfigLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
}
func (l *UpdateLevelConfigLogic) UpdateLevelConfig(req *types.UpdateLevelConfigReq) error {
_, err := l.svcCtx.PlantRpc.UpdateLevelConfig(l.ctx, &plantPb.UpdateLevelConfigReq{
Id: req.Id, Level: int32(req.Level), Title: req.Title, MinSunlight: req.MinSunlight, Perks: req.Perks,
})
return err
}