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

34 lines
807 B
Go

// Code scaffolded by goctl. Safe to edit.
// goctl 1.10.1
package config
import (
"net/http"
"github.com/zeromicro/go-zero/rest/httpx"
"sundynix-micro-go/app/plant/api/internal/logic/config"
"sundynix-micro-go/app/plant/api/internal/svc"
"sundynix-micro-go/app/plant/api/internal/types"
"sundynix-micro-go/common/response"
)
// 创建等级配置
func CreateLevelConfigHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
var req types.CreateLevelConfigReq
if err := httpx.Parse(r, &req); err != nil {
response.Fail(w, err.Error())
return
}
l := config.NewCreateLevelConfigLogic(r.Context(), svcCtx)
err := l.CreateLevelConfig(&req)
if err != nil {
response.Fail(w, err.Error())
} else {
response.Ok(w)
}
}
}