init: init refactor

This commit is contained in:
Blizzard
2026-04-27 00:02:18 +08:00
commit e515f6a287
360 changed files with 30713 additions and 0 deletions
@@ -0,0 +1,29 @@
// Code scaffolded by goctl. Safe to edit.
package dict
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"
)
type CreateDictLogic struct {
logx.Logger
ctx context.Context
svcCtx *svc.ServiceContext
}
func NewCreateDictLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateDictLogic {
return &CreateDictLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
}
func (l *CreateDictLogic) CreateDict(req *types.DictReq) error {
dict := sysModel.SundynixDict{Type: req.Type, Label: req.Label, Value: req.Value, Sort: req.Sort, Desc: req.Desc}
if err := l.svcCtx.DB.Create(&dict).Error; err != nil {
return fmt.Errorf("创建字典失败")
}
return nil
}