63 lines
1.6 KiB
Go
63 lines
1.6 KiB
Go
package api
|
|
|
|
import (
|
|
"SciencesServer/app/api/website/controller/technology"
|
|
"SciencesServer/app/basic/api"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type Technology struct{}
|
|
|
|
func (*Technology) Patent(c *gin.Context) {
|
|
form := &struct {
|
|
Title string `json:"title" form:"title"`
|
|
Industry string `json:"industry" form:"industry"`
|
|
api.PageForm
|
|
}{}
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
data, err := technology.NewPatent()().Instance(form.Title, form.Industry, form.Page, form.PageSize)
|
|
api.APIResponse(err, data)(c)
|
|
}
|
|
|
|
func (*Technology) PatentDetail(c *gin.Context) {
|
|
form := &struct {
|
|
api.IDStringForm
|
|
}{}
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
data, err := technology.NewPatent()().Detail(form.Convert())
|
|
api.APIResponse(err, data)(c)
|
|
}
|
|
|
|
func (*Technology) Demand(c *gin.Context) {
|
|
form := &struct {
|
|
Title string `json:"title" form:"title"`
|
|
Industry string `json:"industry" form:"industry"`
|
|
Kind string `json:"kind" form:"kind"`
|
|
api.PageForm
|
|
}{}
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
data, err := technology.NewDemand()(nil).Instance(form.Title, form.Industry, form.Kind, form.Page, form.PageSize)
|
|
api.APIResponse(err, data)(c)
|
|
}
|
|
|
|
func (*Technology) DemandDetail(c *gin.Context) {
|
|
form := &struct {
|
|
api.IDStringForm
|
|
}{}
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
data, err := technology.NewDemand()(nil).Detail(form.Convert())
|
|
api.APIResponse(err, data)(c)
|
|
}
|