31 lines
645 B
Go
31 lines
645 B
Go
package handler
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
"kra/internal/service/dto"
|
|
service "kra/internal/service/platformsetting"
|
|
)
|
|
|
|
type PlatformSetting struct{ s *service.Service }
|
|
|
|
func NewPlatformSetting(s *service.Service) *PlatformSetting { return &PlatformSetting{s: s} }
|
|
func (h *PlatformSetting) Get(c *gin.Context) {
|
|
v, e := h.s.Get(c.Request.Context())
|
|
if e != nil {
|
|
businessFail(c, e)
|
|
return
|
|
}
|
|
OKWithData(c, v)
|
|
}
|
|
func (h *PlatformSetting) Save(c *gin.Context) {
|
|
in, ok := bindJSON[dto.PlatformSetting](c)
|
|
if !ok {
|
|
return
|
|
}
|
|
if e := h.s.Save(c.Request.Context(), in); e != nil {
|
|
businessFail(c, e)
|
|
return
|
|
}
|
|
OK(c)
|
|
}
|