feat:完善项目信息

This commit is contained in:
henry
2022-01-13 16:50:38 +08:00
parent 0494bbf5d0
commit 4637a5fb4b
10 changed files with 326 additions and 37 deletions

View File

@ -25,6 +25,18 @@ func (*Sys) Banner(c *gin.Context) {
api.APIResponse(err, data)(c)
}
func (*Sys) BannerLocal(c *gin.Context) {
form := &struct {
api.TenantIDStringForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
data, err := sys.NewBanner()(api.GetSession()(c).(*session.Admin)).Local(form.Convert())
api.APIResponse(err, data)(c)
}
func (*Sys) BannerForm(c *gin.Context) {
form := &struct {
api.IDStringForm
@ -136,3 +148,59 @@ func (*Sys) NavigationDelete(c *gin.Context) {
err := sys.NewNavigation()(api.GetSession()(c).(*session.Admin)).Delete(form.Convert())
api.APIResponse(err)(c)
}
func (*Sys) Agreement(c *gin.Context) {
form := &struct {
api.TenantIDStringForm
Title string `json:"title" form:"title"`
api.PageForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
data, err := sys.NewAgreement()(api.GetSession()(c).(*session.Admin)).Instance(form.Convert(), form.Title,
form.Page, form.PageSize)
api.APIResponse(err, data)(c)
}
func (*Sys) AgreementDetail(c *gin.Context) {
form := new(api.IDStringForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
data, err := sys.NewAgreement()(api.GetSession()(c).(*session.Admin)).Detail(form.Convert())
api.APIResponse(err, data)(c)
}
func (*Sys) AgreementForm(c *gin.Context) {
form := &struct {
api.IDStringForm
api.TenantIDStringForm
Title string `json:"title" form:"title" binding:"required"`
Content string `json:"content" form:"content" binding:"required"`
Status int `json:"status" form:"status" binding:"required"`
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := sys.NewAgreement()(api.GetSession()(c).(*session.Admin)).Form(&sys.AgreementParams{
ID: form.IDStringForm.Convert(), TenantID: form.TenantIDStringForm.Convert(),
Title: form.Title, Content: form.Content, Status: form.Status,
})
api.APIResponse(err)(c)
}
func (*Sys) AgreementDelete(c *gin.Context) {
form := new(api.IDStringForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := sys.NewAgreement()(api.GetSession()(c).(*session.Admin)).Delete(form.Convert())
api.APIResponse(err)(c)
}