73 lines
1.9 KiB
Go
73 lines
1.9 KiB
Go
package api
|
|
|
|
import (
|
|
"SciencesServer/app/api/website/controller/service"
|
|
"SciencesServer/app/basic/api"
|
|
"SciencesServer/app/session"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type Service struct{}
|
|
|
|
func (*Service) SolutionCase(c *gin.Context) {
|
|
data, err := service.NewSolutionCase()(nil, 0).Instance()
|
|
api.APIResponse(err, data)(c)
|
|
}
|
|
|
|
func (*Service) SolutionCaseList(c *gin.Context) {
|
|
form := &struct {
|
|
KindID string `json:"kind_id" form:"kind_id"`
|
|
api.PageForm
|
|
}{}
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
data, err := service.NewSolutionCase()(nil, 0).List((&api.IDStringForm{ID: form.KindID}).Convert(),
|
|
form.Page, form.PageSize)
|
|
api.APIResponse(err, data)(c)
|
|
}
|
|
|
|
func (*Service) SolutionCaseDetail(c *gin.Context) {
|
|
form := new(api.IDStringForm)
|
|
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
data, err := service.NewSolutionCase()(api.GetSession()(c).(*session.Enterprise),
|
|
api.GetTenantID()(c).(uint64)).Detail(form.Convert())
|
|
api.APIResponse(err, data)(c)
|
|
}
|
|
|
|
func (*Service) Innovate(c *gin.Context) {
|
|
form := &struct {
|
|
KindID string `json:"kind_id" form:"kind_id"`
|
|
Title string `json:"title" form:"title"`
|
|
api.PageForm
|
|
}{}
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
data, err := service.NewInnovate()(nil, 0).Instance((&api.IDStringForm{ID: form.KindID}).Convert(),
|
|
form.Title, form.Page, form.PageSize)
|
|
api.APIResponse(err, data)(c)
|
|
}
|
|
|
|
func (*Service) InnovateKind(c *gin.Context) {
|
|
data, err := service.NewInnovate()(nil, 0).Kind()
|
|
api.APIResponse(err, data)(c)
|
|
}
|
|
|
|
func (*Service) InnovateDetail(c *gin.Context) {
|
|
form := new(api.IDStringForm)
|
|
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
data, err := service.NewInnovate()(nil, 0).Detail(form.Convert())
|
|
api.APIResponse(err, data)(c)
|
|
}
|