94 lines
2.6 KiB
Go
94 lines
2.6 KiB
Go
package api
|
|
|
|
import (
|
|
"SciencesServer/app/api/website/controller"
|
|
"SciencesServer/app/basic/api"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type Index struct{}
|
|
|
|
func (*Index) Instance(c *gin.Context) {
|
|
data, err := controller.NewIndex()(nil).Instance()
|
|
api.APIResponse(err, data)(c)
|
|
}
|
|
|
|
func (*Index) DistributionExpert(c *gin.Context) {
|
|
form := &struct {
|
|
Province string `json:"province" form:"province"`
|
|
City string `json:"city" form:"city"`
|
|
}{}
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
data, err := controller.NewIndex()(nil).DistributionExpert(form.Province, form.City)
|
|
api.APIResponse(err, data)(c)
|
|
}
|
|
|
|
func (*Index) DistributionLaboratory(c *gin.Context) {
|
|
form := &struct {
|
|
Province string `json:"province" form:"province"`
|
|
City string `json:"city" form:"city"`
|
|
}{}
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
data, err := controller.NewIndex()(nil).DistributionLaboratory(form.Province, form.City)
|
|
api.APIResponse(err, data)(c)
|
|
}
|
|
|
|
func (*Index) DistributionDemand(c *gin.Context) {
|
|
form := &struct {
|
|
Province string `json:"province" form:"province"`
|
|
City string `json:"city" form:"city"`
|
|
}{}
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
data, err := controller.NewIndex()(nil).DistributionDemand(form.Province, form.City)
|
|
api.APIResponse(err, data)(c)
|
|
}
|
|
|
|
func (*Index) DistributionPatent(c *gin.Context) {
|
|
form := &struct {
|
|
Province string `json:"province" form:"province"`
|
|
City string `json:"city" form:"city"`
|
|
}{}
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
data, err := controller.NewIndex()(nil).DistributionPatent(form.Province, form.City)
|
|
api.APIResponse(err, data)(c)
|
|
}
|
|
|
|
func (*Index) DistributionAchievement(c *gin.Context) {
|
|
form := &struct {
|
|
Province string `json:"province" form:"province"`
|
|
City string `json:"city" form:"city"`
|
|
}{}
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
//data, err := controller.NewIndex()(nil).DistributionAchievement(form.Province, form.City)
|
|
data, err := controller.NewIndex()(nil).DistributionAchievementAndPatent(form.Province, form.City)
|
|
api.APIResponse(err, data)(c)
|
|
}
|
|
|
|
func (*Index) DistributionCompany(c *gin.Context) {
|
|
form := &struct {
|
|
Province string `json:"province" form:"province"`
|
|
City string `json:"city" form:"city"`
|
|
}{}
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
data, err := controller.NewIndex()(nil).DistributionCompany(form.Province, form.City)
|
|
api.APIResponse(err, data)(c)
|
|
}
|