feat: 添加独立其他设置菜单及有效端参数保存
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
package handler
|
||||
|
||||
import (
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/go-kratos/kratos/v3/errors"
|
||||
"kra/internal/service/business"
|
||||
"kra/internal/service/dto"
|
||||
)
|
||||
|
||||
type OtherSettings struct {
|
||||
service *business.OtherSettingsService
|
||||
}
|
||||
|
||||
func NewOtherSettings(service *business.OtherSettingsService) *OtherSettings {
|
||||
return &OtherSettings{service: service}
|
||||
}
|
||||
|
||||
func (h *OtherSettings) Get(c *gin.Context) {
|
||||
value, err := h.service.Get(c.Request.Context())
|
||||
if err != nil {
|
||||
Fail(c, errors.FromError(err).Message)
|
||||
return
|
||||
}
|
||||
OKWithData(c, value)
|
||||
}
|
||||
|
||||
func (h *OtherSettings) Save(c *gin.Context) {
|
||||
var req dto.OtherSettingsRequest
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
Fail(c, "请输入完整的整数金额和天数")
|
||||
return
|
||||
}
|
||||
value, err := h.service.Save(c.Request.Context(), &req)
|
||||
if err != nil {
|
||||
Fail(c, errors.FromError(err).Message)
|
||||
return
|
||||
}
|
||||
OKWithData(c, value)
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import "github.com/google/wire"
|
||||
// ProviderSet wires the system HTTP handlers. Set itself is filled field by
|
||||
// field so adding a handler only means adding its constructor here.
|
||||
var ProviderSet = wire.NewSet(
|
||||
NewOtherSettings,
|
||||
NewBusiness,
|
||||
NewBusinessPassword,
|
||||
NewBusinessPromote,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package handler
|
||||
|
||||
type Set struct {
|
||||
OtherSettings *OtherSettings
|
||||
Ranking *Ranking
|
||||
Workbench *Workbench
|
||||
ServerAnalysis *ServerAnalysis
|
||||
|
||||
Reference in New Issue
Block a user