feat:完善网站信息
This commit is contained in:
40
app/api/website/api/es.go
Normal file
40
app/api/website/api/es.go
Normal file
@ -0,0 +1,40 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"SciencesServer/app/basic/api"
|
||||
"SciencesServer/app/service"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type ES struct{}
|
||||
|
||||
func (*ES) Create(c *gin.Context) {
|
||||
form := &struct {
|
||||
ID uint64 `json:"id" form:"id"`
|
||||
Title string `json:"title" form:"title"`
|
||||
Keyword string `json:"keyword" form:"keyword"`
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
manage := service.NewManage(
|
||||
service.WithManageID(form.ID),
|
||||
service.WithManageTitle(form.Title),
|
||||
service.WithManageKeyword(form.Keyword),
|
||||
)
|
||||
api.APIResponse(manage.Create())(c)
|
||||
}
|
||||
|
||||
func (*ES) Search(c *gin.Context) {
|
||||
form := &struct {
|
||||
Params map[string]interface{} `json:"params" form:"params"`
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
manage := service.NewManage()
|
||||
data, err := manage.Search(form.Params)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
62
app/api/website/api/technology.go
Normal file
62
app/api/website/api/technology.go
Normal file
@ -0,0 +1,62 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user