feat:完善信息

This commit is contained in:
henry
2021-10-15 11:05:38 +08:00
parent 1fa9adbd25
commit 4fc13250f1
6 changed files with 288 additions and 14 deletions

View File

@ -21,6 +21,22 @@ type (
Tags []string `json:"tags" form:"tags"` // 标签
Remark string `json:"remark" form:"remark"` // 备注
}
// patentForm 专利参数
patentForm struct {
Title string `json:"title" form:"title"`
IPCCode string `json:"ipc_code" form:"ipc_code"`
CPCCode string `json:"cpc_code" form:"cpc_code"`
ApplyCode string `json:"apply_code" form:"apply_code"`
ApplyName string `json:"apply_name" form:"apply_name"`
ApplyAddress string `json:"apply_address" form:"apply_address"`
ApplyZipCode string `json:"apply_zip_code" form:"apply_zip_code"`
Inventor string `json:"inventor" form:"inventor"`
PriorityCode string `json:"priority_code" form:"priority_code"`
OpenCode string `json:"open_code" form:"open_code"`
ApplyAt string `json:"apply_at" form:"apply_at"`
PriorityAt string `json:"priority_at" form:"priority_at"`
OpenAt string `json:"open_at" form:"open_at"`
}
// demandForm 需求参数
demandForm struct {
Title string `json:"title"`
@ -99,6 +115,80 @@ func (a *Technology) PaperDelete(c *gin.Context) {
api.APIResponse(err)(c)
}
func (a *Technology) Patent(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 := technology.NewPatent()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
List(form.Title, form.Page, form.PageSize)
api.APIResponse(err, data)(c)
}
func (a *Technology) PatentDetail(c *gin.Context) {
form := new(api.IDStringForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
data, err := technology.NewPatent()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
Detail(form.Convert())
api.APIResponse(err, data)(c)
}
func (a *Technology) PatentAdd(c *gin.Context) {
form := new(patentForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology.NewPatent()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
Form(&technology.PatentParams{
Title: form.Title, IPCCode: form.IPCCode, CPCCode: form.CPCCode, ApplyCode: form.ApplyCode,
ApplyName: form.ApplyName, ApplyAddress: form.ApplyAddress, ApplyZipCode: form.ApplyZipCode,
Inventor: form.Inventor, PriorityCode: form.PriorityCode, OpenCode: form.OpenCode, ApplyAt: form.ApplyAt,
PriorityAt: form.PriorityAt, OpenAt: form.OpenAt,
})
api.APIResponse(err)(c)
}
func (a *Technology) PatentEdit(c *gin.Context) {
form := &struct {
api.IDStringForm
patentForm
}{}
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology.NewPatent()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
Form(&technology.PatentParams{
ID: form.Convert(), Title: form.Title, IPCCode: form.IPCCode, CPCCode: form.CPCCode,
ApplyCode: form.ApplyCode, ApplyName: form.ApplyName, ApplyAddress: form.ApplyAddress,
ApplyZipCode: form.ApplyZipCode, Inventor: form.Inventor, PriorityCode: form.PriorityCode, OpenCode: form.OpenCode,
ApplyAt: form.ApplyAt, PriorityAt: form.PriorityAt, OpenAt: form.OpenAt,
})
api.APIResponse(err)(c)
}
func (a *Technology) PatentDelete(c *gin.Context) {
form := new(api.IDStringForm)
if err := api.Bind(form)(c); err != nil {
api.APIFailure(err.(error))(c)
return
}
err := technology.NewPatent()(api.GetSession()(c).(*service.SessionEnterprise), api.GetLocal()(c).(string)).
Delete(form.Convert())
api.APIResponse(err)(c)
}
func (a *Technology) Demand(c *gin.Context) {
form := &struct {
Status int `json:"status" form:"status"`