feat:完善信息

This commit is contained in:
henry
2021-10-18 11:57:12 +08:00
parent 282448ab6e
commit fdda4b0209
6 changed files with 316 additions and 0 deletions

View File

@ -55,6 +55,19 @@ type (
DemandBenefit string `json:"demand_benefit" form:"demand_benefit"` // 效益
Status int `json:"status" form:"status"`
}
// topicForm 课题参数
topicForm struct {
Title string `json:"title" form:"title" binding:"required"`
Emcee string `json:"emcee" form:"emcee" binding:"required"`
Mechanism string `json:"mechanism" form:"mechanism" binding:"required"`
Code string `json:"code" form:"code" binding:"required"`
BeginAt string `json:"begin_at" form:"begin_at" binding:"required"`
FinishAt string `json:"finish_at" form:"finish_at" binding:"required"`
Amount float64 `json:"amount" form:"amount" binding:"required"`
Source int `json:"source" form:"source" binding:"required"`
Kind int `json:"kind" form:"kind" binding:"required"`
Keywords []string `json:"keywords" form:"keywords"`
}
)
func (a *Technology) Paper(c *gin.Context) {
@ -268,3 +281,71 @@ func (a *Technology) DemandDelete(c *gin.Context) {
Delete(form.Convert())
api.APIResponse(err)(c)
}
func (a *Technology) Topic(c *gin.Context) {
form := &struct {
Status int `json:"status" form:"status"`
api.PageForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
data, err := technology2.NewTopic()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
List(form.Status, form.Page, form.PageSize)
api.APIResponse(err, data)(c)
}
func (a *Technology) TopicDetail(c *gin.Context) {
form := new(api.IDStringForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
data, err := technology2.NewTopic()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
Detail(form.Convert())
api.APIResponse(err, data)(c)
}
func (a *Technology) TopicAdd(c *gin.Context) {
form := new(topicForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewTopic()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
Form(&technology2.TopicParams{Title: form.Title, Emcee: form.Emcee, Mechanism: form.Mechanism, Code: form.Code,
BeginAt: form.BeginAt, FinishAt: form.FinishAt, Amount: form.Amount, Source: form.Source, Kind: form.Kind,
Keywords: form.Keywords})
api.APIResponse(err)(c)
}
func (a *Technology) TopicEdit(c *gin.Context) {
form := &struct {
api.IDStringForm
topicForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewTopic()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
Form(&technology2.TopicParams{ID: form.Convert(), Title: form.Title, Emcee: form.Emcee, Mechanism: form.Mechanism,
Code: form.Code, BeginAt: form.BeginAt, FinishAt: form.FinishAt, Amount: form.Amount, Source: form.Source,
Kind: form.Kind, Keywords: form.Keywords})
api.APIResponse(err)(c)
}
func (a *Technology) TopicDelete(c *gin.Context) {
form := new(api.IDStringForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology2.NewTopic()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
Delete(form.Convert())
api.APIResponse(err)(c)
}