117 lines
2.8 KiB
Go
117 lines
2.8 KiB
Go
package api
|
|
|
|
import (
|
|
"SciencesServer/app/api/manage/controller/manage"
|
|
"SciencesServer/app/basic/api"
|
|
"SciencesServer/app/basic/config"
|
|
"SciencesServer/app/service"
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
type Manage struct{}
|
|
|
|
type (
|
|
// manageExamineForm 审核处理
|
|
manageExamineForm struct {
|
|
api.IDStringForm
|
|
Identity int
|
|
Status int `json:"status" form:"status" binding:"required"`
|
|
}
|
|
)
|
|
|
|
// handle 审核处理
|
|
func (a *manageExamineForm) handle(session *service.Session, local string) error {
|
|
return manage.NewExamine()(session, local).Launch(a.Convert(), a.Identity, a.Status)
|
|
}
|
|
|
|
func (*Manage) Company(c *gin.Context) {
|
|
|
|
}
|
|
|
|
func (*Manage) CompanyExamine(c *gin.Context) {
|
|
form := new(manageExamineForm)
|
|
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
form.Identity = config.TenantUserIdentityForCompany
|
|
err := form.handle(api.GetSession()(c).(*service.Session), api.GetLocal()(c).(string))
|
|
api.APIResponse(err)
|
|
}
|
|
|
|
func (*Manage) Expert(c *gin.Context) {
|
|
form := &struct {
|
|
Name string `json:"name" form:"name"`
|
|
Status int `json:"status" form:"status"`
|
|
api.PageForm
|
|
}{}
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
data, err := manage.NewInstance()(api.GetSession()(c).(*service.Session), api.GetLocal()(c).(string)).
|
|
Expert(form.Name, form.Status, form.Page, form.PageSize)
|
|
api.APIResponse(err, data)
|
|
}
|
|
|
|
func (*Manage) ExpertExamine(c *gin.Context) {
|
|
form := new(manageExamineForm)
|
|
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
form.Identity = config.TenantUserIdentityForExpert
|
|
err := form.handle(api.GetSession()(c).(*service.Session), api.GetLocal()(c).(string))
|
|
api.APIResponse(err)
|
|
}
|
|
|
|
func (*Manage) Laboratory(c *gin.Context) {
|
|
|
|
}
|
|
|
|
func (*Manage) LaboratoryExamine(c *gin.Context) {
|
|
form := new(manageExamineForm)
|
|
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
form.Identity = config.TenantUserIdentityForLaboratory
|
|
err := form.handle(api.GetSession()(c).(*service.Session), api.GetLocal()(c).(string))
|
|
api.APIResponse(err)
|
|
}
|
|
|
|
func (*Manage) Research(c *gin.Context) {
|
|
|
|
}
|
|
|
|
func (*Manage) ResearchExamine(c *gin.Context) {
|
|
form := new(manageExamineForm)
|
|
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
form.Identity = config.TenantUserIdentityForResearch
|
|
err := form.handle(api.GetSession()(c).(*service.Session), api.GetLocal()(c).(string))
|
|
api.APIResponse(err)
|
|
}
|
|
|
|
func (*Manage) Agent(c *gin.Context) {
|
|
|
|
}
|
|
|
|
func (*Manage) AgentExamine(c *gin.Context) {
|
|
form := new(manageExamineForm)
|
|
|
|
if err := api.Bind(form)(c); err != nil {
|
|
api.APIFailure(err.(error))(c)
|
|
return
|
|
}
|
|
form.Identity = config.TenantUserIdentityForAgent
|
|
err := form.handle(api.GetSession()(c).(*service.Session), api.GetLocal()(c).(string))
|
|
api.APIResponse(err)
|
|
}
|