101 lines
2.9 KiB
Go
101 lines
2.9 KiB
Go
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)
|
|
}
|
|
|
|
func (*Manage) Expert(c *gin.Context) {
|
|
form := &struct {
|
|
ExpertID string `json:"expert_id" form:"expert_id" binding:"required"`
|
|
}{}
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
data, err := manage.NewExpert()(nil).Instance((&api.IDStringForm{ID: form.ExpertID}).Convert())
|
|
api.APIResponse(err, data)(c)
|
|
}
|
|
|
|
func (*Manage) ExpertAchievement(c *gin.Context) {
|
|
form := &struct {
|
|
ExpertID string `json:"expert_id" form:"expert_id" binding:"required"`
|
|
api.PageForm
|
|
}{}
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
data, err := manage.NewExpert()(nil).Achievement((&api.IDStringForm{ID: form.ExpertID}).Convert(), form.Page, form.PageSize)
|
|
api.APIResponse(err, data)(c)
|
|
}
|
|
|
|
func (*Manage) ExpertProject(c *gin.Context) {
|
|
form := &struct {
|
|
ExpertID string `json:"expert_id" form:"expert_id" binding:"required"`
|
|
api.PageForm
|
|
}{}
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
data, err := manage.NewExpert()(nil).Project((&api.IDStringForm{ID: form.ExpertID}).Convert(), form.Page, form.PageSize)
|
|
api.APIResponse(err, data)(c)
|
|
}
|
|
|
|
func (*Manage) ExpertPatent(c *gin.Context) {
|
|
form := &struct {
|
|
ExpertID string `json:"expert_id" form:"expert_id" binding:"required"`
|
|
api.PageForm
|
|
}{}
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
data, err := manage.NewExpert()(nil).Patent((&api.IDStringForm{ID: form.ExpertID}).Convert(), form.Page, form.PageSize)
|
|
api.APIResponse(err, data)(c)
|
|
}
|