feat:完善项目信息

This commit is contained in:
henry
2022-01-11 14:54:20 +08:00
parent 8006d57506
commit 72c2cb091d
15 changed files with 299 additions and 38 deletions

View File

@ -143,19 +143,21 @@ func (*Service) SolutionCaseDetail(c *gin.Context) {
func (*Service) SolutionCaseForm(c *gin.Context) {
form := &struct {
api.IDStringForm
KindID string `json:"kind_id" form:"kind_id" binding:"required"`
Title string `json:"title" form:"title" binding:"required"`
Content string `json:"content" form:"content" binding:"required"`
Tags []string `json:"tags" form:"tags"`
Sort int `json:"sort" form:"sort"`
api.TenantIDStringForm
KindID string `json:"kind_id" form:"kind_id" binding:"required"`
Title string `json:"title" form:"title" binding:"required"`
api.ImageForm
Description string `json:"description" form:"description" binding:"description"`
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 := service.NewSolutionCase()(api.GetSession()(c).(*session.Admin)).Form(&service.SolutionCaseParams{
ID: form.Convert(), KindID: (&api.IDStringForm{ID: form.KindID}).Convert(),
Title: form.Title, Content: form.Content, Sort: form.Sort,
ID: form.IDStringForm.Convert(), TenantID: form.TenantIDStringForm.Convert(), KindID: (&api.IDStringForm{ID: form.KindID}).Convert(),
Image: form.FilterImageURL(), Title: form.Title, Description: form.Description, Content: form.Content, Sort: form.Sort,
})
api.APIResponse(err)(c)
}
@ -194,6 +196,7 @@ func (*Service) SolutionCaseKindSelect(c *gin.Context) {
func (*Service) SolutionCaseKindForm(c *gin.Context) {
form := &struct {
api.IDStringForm
api.TenantIDStringForm
Mode int `json:"mode" form:"mode" binding:"required"`
Title string `json:"title" form:"title" binding:"required"`
api.ImageForm
@ -204,7 +207,8 @@ func (*Service) SolutionCaseKindForm(c *gin.Context) {
return
}
err := service.NewSolutionCase()(api.GetSession()(c).(*session.Admin)).KindForm(&service.SolutionCaseKindParams{
ID: form.Convert(), Mode: form.Mode, Image: form.FilterImageURL(), Title: form.Title, Sort: form.Sort,
ID: form.IDStringForm.Convert(), TenantID: form.TenantIDStringForm.Convert(), Mode: form.Mode,
Image: form.FilterImageURL(), Title: form.Title, Sort: form.Sort,
})
api.APIResponse(err)(c)
}
@ -219,3 +223,33 @@ func (*Service) SolutionCaseKindDelete(c *gin.Context) {
err := service.NewSolutionCase()(api.GetSession()(c).(*session.Admin)).KindDelete(form.Convert())
api.APIResponse(err)(c)
}
func (*Service) Message(c *gin.Context) {
form := &struct {
api.TenantIDStringForm
Name string `json:"name" form:"name"`
Status int `json:"status" form:"status"`
Content string `json:"content" form:"content"`
api.PageForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
data, err := service.NewMessage()(api.GetSession()(c).(*session.Admin)).Instance(form.TenantIDStringForm.Convert(),
form.Name, form.Status, form.Content, form.Page, form.PageSize)
api.APIResponse(err, data)(c)
}
func (*Service) MessageHandle(c *gin.Context) {
form := &struct {
api.IDStringForm
Content string `json:"content" form:"content"`
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := service.NewMessage()(api.GetSession()(c).(*session.Admin)).Handle(form.Convert(), form.Content)
api.APIResponse(err)(c)
}