feat:完善用户专利数据模型

This commit is contained in:
henry
2021-11-29 13:31:33 +08:00
parent dabb567d41
commit fb5a3d910b
9 changed files with 298 additions and 266 deletions

View File

@ -44,19 +44,20 @@ type (
}
// patentForm 专利参数
patentForm struct {
Title string `json:"title" form:"title" binding:"required"`
IPCCode string `json:"ipc_code" form:"ipc_code" binding:"required"`
CPCCode string `json:"cpc_code" form:"cpc_code" binding:"required"`
ApplyCode string `json:"apply_code" form:"apply_code" binding:"required"`
ApplyName string `json:"apply_name" form:"apply_name" binding:"required"`
ApplyAddress string `json:"apply_address" form:"apply_address" binding:"required"`
ApplyZipCode string `json:"apply_zip_code" form:"apply_zip_code" binding:"required"`
Inventor string `json:"inventor" form:"inventor" binding:"required"`
PriorityCode string `json:"priority_code" form:"priority_code" binding:"required"`
OpenCode string `json:"open_code" form:"open_code" binding:"required"`
ApplyAt string `json:"apply_at" form:"apply_at" binding:"required"`
PriorityAt string `json:"priority_at" form:"priority_at" binding:"required"`
OpenAt string `json:"open_at" form:"open_at" binding:"required"`
Kind int `json:"kind" form:"kind" binding:"kind"`
Title string `json:"title" form:"title" binding:"required"`
FileUrl string `json:"file_url" form:"file_url"`
ApplyCode string `json:"apply_code" form:"apply_code" binding:"required"`
ApplyName string `json:"apply_name" form:"apply_name" binding:"required"`
ApplyAddress string `json:"apply_address" form:"apply_address" binding:"required"`
ApplyAt string `json:"apply_at" form:"apply_at" binding:"required"`
OpenCode string `json:"open_code" form:"open_code" binding:"required"`
OpenAt string `json:"open_at" form:"open_at" binding:"required"`
IPCCode string `json:"ipc_code" form:"ipc_code"`
Inventor string `json:"inventor" form:"inventor"`
PrincipalClaim string `json:"principal_claim" form:"principal_claim"`
Description string `json:"description" form:"description"`
Status int `json:"status" form:"status" binding:"status"`
}
// demandForm 需求参数
demandForm struct {
@ -261,7 +262,11 @@ func (a *Technology) PaperDelete(c *gin.Context) {
func (a *Technology) Patent(c *gin.Context) {
form := &struct {
Title string `json:"title" form:"title"`
Kind int `json:"kind" form:"kind"`
Title string `json:"title" form:"title"`
ApplyCode string `json:"apply_code" form:"apply_code"`
OpenCode string `json:"open_code" form:"open_code"`
IPCCode string `json:"ipc_code" form:"ipc_code"`
api.PageForm
}{}
if err := api.Bind(form)(c); err != nil {
@ -269,7 +274,7 @@ func (a *Technology) Patent(c *gin.Context) {
return
}
data, err := technology2.NewPatent()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
List(form.Title, form.Page, form.PageSize)
List(form.Kind, form.Title, form.ApplyCode, form.OpenCode, form.IPCCode, form.Page, form.PageSize)
api.APIResponse(err, data)(c)
}
@ -293,11 +298,10 @@ func (a *Technology) PatentAdd(c *gin.Context) {
return
}
err := technology2.NewPatent()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Form(&technology2.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,
Form(&technology2.PatentParams{Kind: form.Kind, Title: form.Title, FileUrl: (&api.FileForm{File: form.FileUrl}).FilterURL(),
ApplyCode: form.ApplyCode, ApplyName: form.ApplyName, ApplyAddress: form.ApplyAddress, ApplyAt: form.ApplyAt,
OpenCode: form.OpenCode, OpenAt: form.OpenAt, Inventor: form.Inventor, IPCCode: form.IPCCode,
Description: form.Description, PrincipalClaim: form.PrincipalClaim,
})
api.APIResponse(err)(c)
}
@ -312,11 +316,11 @@ func (a *Technology) PatentEdit(c *gin.Context) {
return
}
err := technology2.NewPatent()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
Form(&technology2.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,
Form(&technology2.PatentParams{ID: form.Convert(), Kind: form.Kind, Title: form.Title,
FileUrl: (&api.FileForm{File: form.FileUrl}).FilterURL(), ApplyCode: form.ApplyCode,
ApplyName: form.ApplyName, ApplyAddress: form.ApplyAddress, ApplyAt: form.ApplyAt, OpenCode: form.OpenCode,
OpenAt: form.OpenAt, Inventor: form.Inventor, IPCCode: form.IPCCode, Description: form.Description,
PrincipalClaim: form.PrincipalClaim, Status: form.Status,
})
api.APIResponse(err)(c)
}