34 lines
716 B
Go
34 lines
716 B
Go
package api
|
|
|
|
import (
|
|
"SciencesServer/app/api/admin/controller"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type Config struct{}
|
|
|
|
func (a *Config) List(c *gin.Context) {
|
|
form := &struct {
|
|
Kind int `json:"kind" form:"kind"`
|
|
pageForm
|
|
}{}
|
|
if err := bind(form)(c); err != nil {
|
|
APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
data, err := controller.NewConfig()().Config(form.Kind, form.Page, form.PageSize)
|
|
APIResponse(err, data)
|
|
}
|
|
|
|
func (a *Config) Edit(c *gin.Context) {
|
|
form := &struct {
|
|
Params map[string]interface{} `json:"params" form:"params" binding:"required"`
|
|
}{}
|
|
if err := bind(form)(c); err != nil {
|
|
APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
err := controller.NewConfig()().Form(form.Params)
|
|
APIResponse(err)
|
|
}
|