feat:完善信息
This commit is contained in:
@ -89,6 +89,12 @@ type (
|
||||
Kind int `json:"kind" form:"kind" binding:"required"`
|
||||
Keywords []string `json:"keywords" form:"keywords"`
|
||||
}
|
||||
// equipmentForm 设备参数
|
||||
equipmentForm struct {
|
||||
Title string `json:"title" form:"title" binding:"required"`
|
||||
Research string `json:"research" form:"research" binding:"required"`
|
||||
Describe string `json:"describe" form:"describe"`
|
||||
}
|
||||
)
|
||||
|
||||
func (a *instanceForm) FilterProveImages() string {
|
||||
@ -451,3 +457,55 @@ func (a *Technology) TopicDelete(c *gin.Context) {
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (a *Technology) Equipment(c *gin.Context) {
|
||||
form := &struct {
|
||||
Title string `json:"title" form:"title"`
|
||||
api.PageForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology2.NewEquipment()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
List(form.Title, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (a *Technology) EquipmentAdd(c *gin.Context) {
|
||||
form := new(equipmentForm)
|
||||
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewEquipment()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology2.EquipmentParams{Title: form.Title, Research: form.Research, Describe: form.Describe})
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (a *Technology) EquipmentEdit(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
equipmentForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewEquipment()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Form(&technology2.EquipmentParams{ID: form.Convert(), Title: form.Title, Research: form.Research, Describe: form.Describe})
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (a *Technology) EquipmentDelete(c *gin.Context) {
|
||||
form := new(api.IDStringForm)
|
||||
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewEquipment()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
Reference in New Issue
Block a user