feat: 初次启动
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
// Code scaffolded by goctl. Safe to edit.
|
||||
package menu
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
"sundynix-micro-go/app/system/api/internal/svc"
|
||||
"sundynix-micro-go/app/system/api/internal/types"
|
||||
sysModel "sundynix-micro-go/app/system/model"
|
||||
"sundynix-micro-go/app/system/rpc/system"
|
||||
)
|
||||
|
||||
type CreateMenuLogic struct {
|
||||
@@ -21,16 +19,10 @@ func NewCreateMenuLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Create
|
||||
}
|
||||
|
||||
func (l *CreateMenuLogic) CreateMenu(req *types.MenuReq) error {
|
||||
menu := sysModel.SundynixMenu{
|
||||
ParentID: req.ParentId, Category: req.Category, Name: req.Name, Title: req.Title,
|
||||
_, err := l.svcCtx.SystemRpc.CreateMenu(l.ctx, &system.MenuReq{
|
||||
ParentId: req.ParentId, Category: int32(req.Category), Name: req.Name, Title: req.Title,
|
||||
Code: req.Code, Path: req.Path, Permission: req.Permission, Locale: req.Locale,
|
||||
Icon: req.Icon, Sort: req.Sort,
|
||||
}
|
||||
if menu.ParentID == "" {
|
||||
menu.ParentID = "0"
|
||||
}
|
||||
if err := l.svcCtx.DB.Create(&menu).Error; err != nil {
|
||||
return fmt.Errorf("创建菜单失败")
|
||||
}
|
||||
return nil
|
||||
Icon: req.Icon, Sort: int32(req.Sort),
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user