feat:完善项目

This commit is contained in:
henry
2022-01-17 11:34:39 +08:00
parent b50fdb0d44
commit 8fd5283b0e
6 changed files with 187 additions and 10 deletions

View File

@ -165,3 +165,39 @@ func (*Technology) PaperDelete(c *gin.Context) {
err := technology.NewPaper()(api.GetSession()(c).(*session.Admin)).Delete(form.Convert())
api.APIResponse(err)(c)
}
func (*Technology) Product(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 := technology.NewProduct()(api.GetSession()(c).(*session.Admin)).Instance(form.Convert(), form.Title, form.Page, form.PageSize)
api.APIResponse(err, data)(c)
}
func (*Technology) ProductDetail(c *gin.Context) {
form := new(api.IDStringForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
data, err := technology.NewProduct()(api.GetSession()(c).(*session.Admin)).Detail(form.Convert())
api.APIResponse(err, data)(c)
}
func (*Technology) ProductDelete(c *gin.Context) {
form := new(api.IDStringForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology.NewProduct()(api.GetSession()(c).(*session.Admin)).Delete(form.Convert())
api.APIResponse(err)(c)
}