feat: 结构整理

This commit is contained in:
2021-12-14 14:31:18 +08:00
parent 28fdd5a348
commit e321686d4b
5 changed files with 42 additions and 29 deletions
+5 -8
View File
@@ -1,23 +1,20 @@
package handler
import (
"bgm/consts"
bgm "bgm/helper"
"bgm/model"
"bgm/service"
"errors"
"github.com/gofiber/fiber/v2"
"github.com/rs/xid"
"gorm.io/gorm"
)
func CreateCategoryH(ctx *fiber.Ctx) error {
i := ctx.UserContext().Value("local")
func CreateCategoryH(ctx *fiber.Ctx, mysqlMap bgm.MysqlMap) error {
category := &model.Category{
Key: 1,
Value: "默认",
Gid: xid.New().String(),
}
if k, ok := i.(*gorm.DB); ok {
return service.CreateCategory(category, k)
}
return errors.New("")
return service.CreateCategory(category, mysqlMap[consts.TestDB])
}