feat:完善项目

This commit is contained in:
henry
2021-11-12 14:08:42 +08:00
parent a8259f53a2
commit a22029f4a3
9 changed files with 102 additions and 34 deletions

View File

@ -27,6 +27,11 @@ type (
Remark string `json:"remark" form:"remark"`
Unit int `json:"unit" form:"Unit" binding:"required"`
}
// manageNoticeForm 公告参数信息
manageNoticeForm struct {
Title string `json:"title" form:"title" binding:"required"`
Content string `json:"content" form:"content" binding:"required"`
}
)
/**
@ -444,20 +449,59 @@ func (*Manage) MaterialSupplierDelete(c *gin.Context) {
}
func (*Manage) Notice(c *gin.Context) {
form := &struct {
PageForm
}{}
if err := bind(form)(c); err != nil {
APIFailure(err.(error))(c)
return
}
data, err := manage.NewNotice()(getSession()(c).(*service.Session)).List(form.Page, form.PageSize)
APIResponse(err, data)(c)
}
func (*Manage) NoticeDetail(c *gin.Context) {
form := new(IDStringForm)
if err := bind(form)(c); err != nil {
APIFailure(err.(error))(c)
return
}
data, err := manage.NewNotice()(getSession()(c).(*service.Session)).Detail(form.Convert())
APIResponse(err, data)(c)
}
func (*Manage) NoticeAdd(c *gin.Context) {
form := new(manageNoticeForm)
if err := bind(form)(c); err != nil {
APIFailure(err.(error))(c)
return
}
err := manage.NewNotice()(getSession()(c).(*service.Session)).Form(0, form.Title, form.Content)
APIResponse(err)(c)
}
func (*Manage) NoticeEdit(c *gin.Context) {
form := &struct {
IDStringForm
manageNoticeForm
}{}
if err := bind(form)(c); err != nil {
APIFailure(err.(error))(c)
return
}
err := manage.NewNotice()(getSession()(c).(*service.Session)).Form(form.Convert(), form.Title, form.Content)
APIResponse(err)(c)
}
func (*Manage) NoticeDelete(c *gin.Context) {
form := new(IDStringForm)
if err := bind(form)(c); err != nil {
APIFailure(err.(error))(c)
return
}
err := manage.NewNotice()(getSession()(c).(*service.Session)).Delete(form.Convert())
APIResponse(err)(c)
}