package api import ( "SciencesServer/app/basic/api" "SciencesServer/app/basic/config" "SciencesServer/app/enterprise/controller/tenant" "SciencesServer/app/service" "github.com/gin-gonic/gin" ) type Tenant struct{} type SettledBasic struct { api.IDStringForm api.ImageForm Name string `json:"name" form:"name"` Code string `json:"code" form:"code"` config.Area Introduce string `json:"introduce" form:"introduce"` Industry uint64 `json:"industry" form:"industry"` Keywords []string `json:"keywords" form:"keywords"` } func (a *Tenant) SettledCompany(c *gin.Context) { form := &struct { SettledBasic }{} if err := api.Bind(form)(c); err != nil { api.APIFailure(err.(error))(c) return } err := tenant.NewSettled()(api.GetSession()(c).(*service.SessionEnterprise)).Company(&tenant.SettledParams{ ID: form.Convert(), Image: form.FilterImageURL(), Name: form.Name, Code: form.Code, Area: form.Area, Introduce: form.Introduce, Industry: form.Industry, Keywords: form.Keywords, }, nil) api.APIResponse(err)(c) } func (a *Tenant) SettledExpert(c *gin.Context) { form := &struct { SettledBasic config.IdentityForExpert }{} if err := api.Bind(form)(c); err != nil { api.APIFailure(err.(error))(c) return } err := tenant.NewSettled()(api.GetSession()(c).(*service.SessionEnterprise)).Expert(&tenant.SettledParams{ ID: form.Convert(), Area: form.Area, Introduce: form.Introduce, Industry: form.Industry, Keywords: form.Keywords, }, &form.IdentityForExpert) api.APIResponse(err)(c) } func (a *Tenant) SettledResearch(c *gin.Context) { form := &struct { SettledBasic config.IdentityForResearch }{} if err := api.Bind(form)(c); err != nil { api.APIFailure(err.(error))(c) return } err := tenant.NewSettled()(api.GetSession()(c).(*service.SessionEnterprise)).Research(&tenant.SettledParams{ ID: form.Convert(), Image: form.FilterImageURL(), Name: form.Name, Code: form.Code, Area: form.Area, Introduce: form.Introduce, Industry: form.Industry, Keywords: form.Keywords, }, &form.IdentityForResearch) api.APIResponse(err)(c) } func (a *Tenant) SettledLaboratory(c *gin.Context) { form := &struct { SettledBasic config.IdentityForLaboratory }{} if err := api.Bind(form)(c); err != nil { api.APIFailure(err.(error))(c) return } err := tenant.NewSettled()(api.GetSession()(c).(*service.SessionEnterprise)).Laboratory(&tenant.SettledParams{ ID: form.Convert(), Image: form.FilterImageURL(), Name: form.Name, Code: form.Code, Area: form.Area, Introduce: form.Introduce, Industry: form.Industry, Keywords: form.Keywords, }, &form.IdentityForLaboratory) api.APIResponse(err)(c) }