feat:完善项目管理,增加网站活动管理

This commit is contained in:
henry
2021-12-15 17:36:56 +08:00
parent ba62a25e4b
commit a59759379c
13 changed files with 281 additions and 26 deletions

View File

@ -0,0 +1,47 @@
package api
import (
"SciencesServer/app/api/website/controller"
"SciencesServer/app/basic/api"
"github.com/gin-gonic/gin"
)
type Activity struct{}
func (*Activity) Instance(c *gin.Context) {
form := &struct {
Title string `json:"title" form:"title"`
Mode int `json:"mode" form:"mode"`
api.PageForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
data, err := controller.NewActivity()(nil, "").Instance(form.Title, form.Mode, form.Page, form.PageSize)
api.APIResponse(err, data)(c)
}
func (*Activity) Detail(c *gin.Context) {
form := &struct {
api.IDStringForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
data, err := controller.NewActivity()(nil, "").Detail(form.Convert())
api.APIResponse(err, data)(c)
}
func (*Activity) Join(c *gin.Context) {
form := &struct {
api.IDStringForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := controller.NewActivity()(nil, "").Join(form.Convert())
api.APIResponse(err)(c)
}

View File

@ -0,0 +1 @@
package api