feat:完善项目管理,增加网站活动管理
This commit is contained in:
47
app/api/website/api/activity.go
Normal file
47
app/api/website/api/activity.go
Normal 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)
|
||||
}
|
||||
1
app/api/website/api/config.go
Normal file
1
app/api/website/api/config.go
Normal file
@ -0,0 +1 @@
|
||||
package api
|
||||
Reference in New Issue
Block a user