feat:完善项目信息

This commit is contained in:
henry
2022-01-13 20:37:05 +08:00
parent 7492c67378
commit 97fd9ab278
11 changed files with 367 additions and 15 deletions

View File

@ -204,3 +204,60 @@ func (*Sys) AgreementDelete(c *gin.Context) {
err := sys.NewAgreement()(api.GetSession()(c).(*session.Admin)).Delete(form.Convert())
api.APIResponse(err)(c)
}
func (*Sys) About(c *gin.Context) {
form := &struct {
api.TenantIDStringForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
data, err := sys.NewAbout()(api.GetSession()(c).(*session.Admin)).Instance(form.Convert())
api.APIResponse(err, data)(c)
}
func (*Sys) AboutDetail(c *gin.Context) {
form := new(api.IDStringForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
data, err := sys.NewAbout()(api.GetSession()(c).(*session.Admin)).Instance(form.Convert())
api.APIResponse(err, data)(c)
}
func (*Sys) AboutForm(c *gin.Context) {
form := &struct {
api.IDStringForm
api.TenantIDStringForm
ParentID string `json:"parent_id" form:"parent_id"`
Title string `json:"title" form:"title" binding:"required"`
Content string `json:"content" form:"content" binding:"required"`
Sort int `json:"sort" form:"sort"`
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := sys.NewAbout()(api.GetSession()(c).(*session.Admin)).Form(&sys.AboutParams{
ID: form.IDStringForm.Convert(),
TenantID: form.TenantIDStringForm.Convert(),
ParentID: (&api.IDStringForm{ID: form.ParentID}).Convert(),
Title: form.Title, Content: form.Content, Sort: form.Sort,
})
api.APIResponse(err)(c)
}
func (*Sys) AboutDelete(c *gin.Context) {
form := &struct {
api.TenantIDStringForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
data, err := sys.NewAbout()(api.GetSession()(c).(*session.Admin)).Instance(form.Convert())
api.APIResponse(err, data)(c)
}