feat:优化信息,完善es查询,完善网站首页公司信息查询
This commit is contained in:
@ -11,6 +11,7 @@ type ES struct{}
|
||||
func (*ES) Create(c *gin.Context) {
|
||||
form := &struct {
|
||||
ID uint64 `json:"id" form:"id"`
|
||||
Identity int `json:"identity" form:"identity"`
|
||||
Title string `json:"title" form:"title"`
|
||||
Keyword string `json:"keyword" form:"keyword"`
|
||||
Research string `json:"research" form:"research"`
|
||||
@ -19,8 +20,9 @@ func (*ES) Create(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
manage := service.NewManage(
|
||||
manage := service.NewESManage(
|
||||
service.WithManageID(form.ID),
|
||||
service.WithManageIdentity(form.Identity),
|
||||
service.WithManageTitle(form.Title),
|
||||
service.WithManageKeyword(form.Keyword),
|
||||
service.WithManageResearch(form.Research),
|
||||
@ -30,13 +32,19 @@ func (*ES) Create(c *gin.Context) {
|
||||
|
||||
func (*ES) Search(c *gin.Context) {
|
||||
form := &struct {
|
||||
Params map[string]interface{} `json:"params" form:"params"`
|
||||
Identity int `json:"identity" form:"identity" binding:"required"`
|
||||
Industry string `json:"industry" form:"industry"`
|
||||
Param string `json:"param" form:"params"`
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
manage := service.NewManage()
|
||||
data, err := manage.Search(1, 10, form.Params)
|
||||
manage := service.NewESManage(service.WithManageIdentity(form.Identity),
|
||||
service.WithManageTitle(form.Param),
|
||||
service.WithManageIndustry(form.Industry),
|
||||
service.WithManageKeyword(form.Param),
|
||||
service.WithManageResearch(form.Param))
|
||||
data, err := manage.Search(1, 1)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
49
app/api/website/api/manage.go
Normal file
49
app/api/website/api/manage.go
Normal file
@ -0,0 +1,49 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/website/controller/manage"
|
||||
"SciencesServer/app/basic/api"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type Manage struct{}
|
||||
|
||||
func (*Manage) Search(c *gin.Context) {
|
||||
form := &struct {
|
||||
Identity int `json:"identity" form:"identity" binding:"required"`
|
||||
Param string `json:"param" form:"param" binding:"required"`
|
||||
Industry string `json:"industry" form:"industry"`
|
||||
api.PageForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewSearch()().Launch(form.Identity, form.Param, form.Industry, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Manage) Company(c *gin.Context) {
|
||||
form := &struct {
|
||||
CompanyID string `json:"company_id" form:"company_id" binding:"required"`
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewCompany()(nil).Instance((&api.IDStringForm{ID: form.CompanyID}).Convert())
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Manage) CompanyProduct(c *gin.Context) {
|
||||
form := &struct {
|
||||
CompanyID string `json:"company_id" form:"company_id" binding:"required"`
|
||||
api.PageForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewCompany()(nil).Product((&api.IDStringForm{ID: form.CompanyID}).Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
Reference in New Issue
Block a user