feat:完善入驻信息管理
This commit is contained in:
@ -3,21 +3,110 @@ package api
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/controller/settled"
|
||||
"SciencesServer/app/basic/api"
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/session"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type Settled struct{}
|
||||
|
||||
type (
|
||||
// settledForm 入驻平台参数
|
||||
settledForm struct {
|
||||
api.ImageForm
|
||||
Name string `json:"name" form:"name"`
|
||||
Code string `json:"code" form:"code"`
|
||||
Mobile string `json:"mobile" form:"mobile"`
|
||||
config.Area
|
||||
Industrys []string `json:"industrys" form:"industrys"`
|
||||
Keywords []string `json:"keywords" form:"keywords"`
|
||||
Introduce string `json:"introduce" form:"introduce"`
|
||||
}
|
||||
)
|
||||
|
||||
func (c *settledForm) bind() *settled.BasicParams {
|
||||
return &settled.BasicParams{Name: c.Name, Image: c.FilterImageURL(), Code: c.Code, Mobile: c.Mobile,
|
||||
Introduce: c.Introduce, Area: c.Area, Industrys: c.Industrys, Keywords: c.Keywords,
|
||||
}
|
||||
}
|
||||
|
||||
// Index 入驻信息
|
||||
func (*Settled) Index(c *gin.Context) {
|
||||
settled.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).Index()
|
||||
}
|
||||
|
||||
// Company 公司入驻信息
|
||||
func (*Settled) Company(c *gin.Context) {
|
||||
settled.NewCompany()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Launch(nil, 0, nil)
|
||||
form := &struct {
|
||||
settledForm
|
||||
InviterCode string `json:"inviter_code" form:"inviter_code"`
|
||||
config.IdentityForCompany
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := settled.NewCompany()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Launch(form.settledForm.bind(), (&api.IDStringForm{ID: form.InviterCode}).Convert(), &form.IdentityForCompany)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
// Expert 专家入驻信息
|
||||
func (*Settled) Expert(c *gin.Context) {
|
||||
|
||||
form := &struct {
|
||||
settledForm
|
||||
config.IdentityForExpert
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := settled.NewExpert()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Launch(form.settledForm.bind(), &form.IdentityForExpert)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
// Research 研究机构入驻信息
|
||||
func (*Settled) Research(c *gin.Context) {
|
||||
form := &struct {
|
||||
settledForm
|
||||
config.IdentityForResearch
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := settled.NewResearch()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Launch(form.settledForm.bind(), &form.IdentityForResearch)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
// Laboratory 实验室入驻信息
|
||||
func (*Settled) Laboratory(c *gin.Context) {
|
||||
form := &struct {
|
||||
settledForm
|
||||
config.IdentityForLaboratory
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := settled.NewLaboratory()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Launch(form.settledForm.bind(), &form.IdentityForLaboratory)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
// Agent 经纪人入驻信息
|
||||
func (*Settled) Agent(c *gin.Context) {
|
||||
form := &struct {
|
||||
settledForm
|
||||
config.IdentityForAgent
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := settled.NewAgent()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Launch(form.settledForm.bind(), &form.IdentityForAgent)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
28
app/api/enterprise/controller/settled/agent.go
Normal file
28
app/api/enterprise/controller/settled/agent.go
Normal file
@ -0,0 +1,28 @@
|
||||
package settled
|
||||
|
||||
import (
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/session"
|
||||
)
|
||||
|
||||
// Company 经纪人入驻信息
|
||||
type Agent struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
}
|
||||
|
||||
type AgentHandle func(session *session.Enterprise, local string) *Agent
|
||||
|
||||
// Launch 经纪人入驻
|
||||
func (c *Agent) Launch(params *BasicParams, other *config.IdentityForAgent) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func NewAgent() AgentHandle {
|
||||
return func(session *session.Enterprise, local string) *Agent {
|
||||
return &Agent{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
}
|
||||
}
|
||||
}
|
@ -16,8 +16,7 @@ import (
|
||||
|
||||
// BasicParams 基本信息
|
||||
type BasicParams struct {
|
||||
ID uint64
|
||||
Name, Image, Code, Introduce string
|
||||
Name, Image, Code, Mobile, Introduce string
|
||||
config.Area
|
||||
Industrys, Keywords []string
|
||||
}
|
||||
|
@ -47,6 +47,7 @@ func (c *Company) Launch(params *BasicParams, inviterID uint64, other *config.Id
|
||||
return err
|
||||
}
|
||||
}
|
||||
mManageCompany.ID = 0
|
||||
}
|
||||
mManageCompany.Local.Local = c.local
|
||||
mManageCompany.InviterID = inviterID
|
||||
@ -56,7 +57,7 @@ func (c *Company) Launch(params *BasicParams, inviterID uint64, other *config.Id
|
||||
mManageCompany.Area = model2.Area{
|
||||
Province: params.Area.Province, City: params.Area.City, District: params.Area.District, Address: params.Area.Address,
|
||||
}
|
||||
mManageCompany.WebUrl = other.WebUrl
|
||||
mManageCompany.Url = other.Url
|
||||
mManageCompany.SetIndustryAttribute(params.Industrys)
|
||||
mManageCompany.SetKeywordAttribute(params.Keywords)
|
||||
mManageCompany.Introduce = params.Introduce
|
||||
@ -67,10 +68,8 @@ func (c *Company) Launch(params *BasicParams, inviterID uint64, other *config.Id
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local)}, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
if mManageCompany.ID <= 0 {
|
||||
if err = model2.Create(mManageCompany.ManageCompany, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = model2.Create(mManageCompany.ManageCompany, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := model2.UpdatesWhere(mUserCompany.UserCompany, map[string]interface{}{
|
||||
"status": model2.InvalidStatusForYes, "updated_at": time.Now(),
|
||||
|
@ -1,3 +1,100 @@
|
||||
package settled
|
||||
|
||||
type Expert struct{}
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
"SciencesServer/serve/orm"
|
||||
"SciencesServer/utils"
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Expert 专家入驻信息
|
||||
type Expert struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
}
|
||||
|
||||
type ExpertHandle func(session *session.Enterprise, local string) *Expert
|
||||
|
||||
// Launch 发起入驻
|
||||
func (c *Expert) Launch(params *BasicParams, other *config.IdentityForExpert) error {
|
||||
if c.Identity&config.TenantUserIdentityForExpert > 0 {
|
||||
return errors.New("操作错误,不可重复申请入驻")
|
||||
}
|
||||
mManageExpert := model.NewManageExpert()
|
||||
// 查询相应专家入驻信息
|
||||
isExist, err := model2.FirstField(mManageExpert.ManageExpert, []string{"id", "status"},
|
||||
model2.NewWhere("mobile", params.Mobile), model2.NewWhere("local", c.local))
|
||||
|
||||
mUserExpert := model.NewUserExpert()
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
} else if isExist {
|
||||
// 审核中
|
||||
if mManageExpert.Status == model2.ExamineStatusForOngoing {
|
||||
return errors.New("操作错误,当前该专家信息审核中,不可入驻")
|
||||
}
|
||||
// 审核通过
|
||||
if mManageExpert.Status == model2.ExamineStatusForAgree {
|
||||
// 筛选企业条件
|
||||
if err = params.filter(config.TenantUserIdentityForCompany,
|
||||
model2.NewWhere("expert_id", mManageExpert.ID)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
mUserExpert.ID = 0
|
||||
}
|
||||
mManageExpert.Local.Local = c.local
|
||||
mManageExpert.ResearchID = other.ResearchID
|
||||
mManageExpert.LaboratoryID = other.LaboratoryID
|
||||
mManageExpert.Image.Image = params.Image
|
||||
mManageExpert.Name = params.Name
|
||||
mManageExpert.Mobile = params.Mobile
|
||||
mManageExpert.Area = model2.Area{
|
||||
Province: params.Area.Province, City: params.Area.City, District: params.Area.District, Address: params.Area.Address,
|
||||
}
|
||||
//mManageExpert.Position = params.Mobile
|
||||
mManageExpert.School = other.School
|
||||
mManageExpert.Major = other.Major
|
||||
mManageExpert.Job = other.Job
|
||||
mManageExpert.Title = other.Title
|
||||
mManageExpert.Gender = model2.Gender{Gender: model2.GenderKind(other.Gender)}
|
||||
mManageExpert.WorkAt = utils.DataTimeToDate(other.WorkAt)
|
||||
mManageExpert.SetIndustryAttribute(params.Industrys)
|
||||
mManageExpert.SetKeywordAttribute(params.Keywords)
|
||||
mManageExpert.SetResearchAttribute(other.Researchs)
|
||||
mManageExpert.Introduce = params.Introduce
|
||||
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
// 删除区域相同编码公司信息
|
||||
if err = model2.DeleteWhere(mManageExpert.ManageExpert, []*model2.ModelWhere{
|
||||
model2.NewWhere("mobile", params.Mobile), model2.NewWhere("local", c.local)}, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = model2.Create(mManageExpert.ManageExpert, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := model2.UpdatesWhere(mUserExpert.UserExpert, map[string]interface{}{
|
||||
"status": model2.InvalidStatusForYes, "updated_at": time.Now(),
|
||||
}, []*model2.ModelWhere{model2.NewWhere("uid", c.UID)}, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
mUserExpert.UID = c.UID
|
||||
mUserExpert.ExpertID = mManageExpert.ID
|
||||
return model2.Create(mUserExpert.UserExpert, tx)
|
||||
})
|
||||
}
|
||||
|
||||
func NewExpert() ExpertHandle {
|
||||
return func(session *session.Enterprise, local string) *Expert {
|
||||
return &Expert{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
93
app/api/enterprise/controller/settled/laboratory.go
Normal file
93
app/api/enterprise/controller/settled/laboratory.go
Normal file
@ -0,0 +1,93 @@
|
||||
package settled
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
"SciencesServer/serve/orm"
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Laboratory 实验室入驻信息
|
||||
type Laboratory struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
}
|
||||
|
||||
type LaboratoryHandle func(session *session.Enterprise, local string) *Laboratory
|
||||
|
||||
// Launch 实验室入驻
|
||||
func (c *Laboratory) Launch(params *BasicParams, other *config.IdentityForLaboratory) error {
|
||||
if c.Identity&config.TenantUserIdentityForLaboratory > 0 {
|
||||
return errors.New("操作错误,不可重复申请入驻")
|
||||
}
|
||||
mManageLaboratory := model.NewManageLaboratory()
|
||||
// 查询相应专家入驻信息
|
||||
isExist, err := model2.FirstField(mManageLaboratory.ManageLaboratory, []string{"id", "status"},
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local))
|
||||
|
||||
mUserLaboratory := model.NewUserLaboratory()
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
} else if isExist {
|
||||
// 审核中
|
||||
if mManageLaboratory.Status == model2.ExamineStatusForOngoing {
|
||||
return errors.New("操作错误,当前该实验室信息审核中,不可入驻")
|
||||
}
|
||||
// 审核通过
|
||||
if mManageLaboratory.Status == model2.ExamineStatusForAgree {
|
||||
// 筛选企业条件
|
||||
if err = params.filter(config.TenantUserIdentityForCompany,
|
||||
model2.NewWhere("laboratory_id", mManageLaboratory.ID)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
mManageLaboratory.ID = 0
|
||||
}
|
||||
mManageLaboratory.Local.Local = c.local
|
||||
mManageLaboratory.ResearchID = other.ResearchID
|
||||
mManageLaboratory.Image.Image = params.Image
|
||||
mManageLaboratory.Name = params.Name
|
||||
mManageLaboratory.Code = params.Code
|
||||
mManageLaboratory.Area = model2.Area{
|
||||
Province: params.Area.Province, City: params.Area.City, District: params.Area.District, Address: params.Area.Address,
|
||||
}
|
||||
//mManageExpert.Position = params.Mobile
|
||||
mManageLaboratory.Url = other.Url
|
||||
mManageLaboratory.SetIndustryAttribute(params.Industrys)
|
||||
mManageLaboratory.SetKeywordAttribute(params.Keywords)
|
||||
mManageLaboratory.SetResearchAttribute(other.Researchs)
|
||||
mManageLaboratory.Introduce = params.Introduce
|
||||
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
// 删除区域相同编码公司信息
|
||||
if err = model2.DeleteWhere(mManageLaboratory.ManageLaboratory, []*model2.ModelWhere{
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local)}, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = model2.Create(mManageLaboratory.ManageLaboratory, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := model2.UpdatesWhere(mUserLaboratory.UserLaboratory, map[string]interface{}{
|
||||
"status": model2.InvalidStatusForYes, "updated_at": time.Now(),
|
||||
}, []*model2.ModelWhere{model2.NewWhere("uid", c.UID)}, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
mUserLaboratory.UID = c.UID
|
||||
mUserLaboratory.LaboratoryID = mManageLaboratory.ID
|
||||
return model2.Create(mUserLaboratory.UserLaboratory, tx)
|
||||
})
|
||||
}
|
||||
|
||||
func NewLaboratory() LaboratoryHandle {
|
||||
return func(session *session.Enterprise, local string) *Laboratory {
|
||||
return &Laboratory{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
}
|
||||
}
|
||||
}
|
91
app/api/enterprise/controller/settled/research.go
Normal file
91
app/api/enterprise/controller/settled/research.go
Normal file
@ -0,0 +1,91 @@
|
||||
package settled
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
"SciencesServer/serve/orm"
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Research 研究机构入驻信息
|
||||
type Research struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
}
|
||||
|
||||
type ResearchHandle func(session *session.Enterprise, local string) *Research
|
||||
|
||||
// Launch 研究机构入驻
|
||||
func (c *Research) Launch(params *BasicParams, other *config.IdentityForResearch) error {
|
||||
if c.Identity&config.TenantUserIdentityForResearch > 0 {
|
||||
return errors.New("操作错误,不可重复申请入驻")
|
||||
}
|
||||
mManageResearch := model.NewManageResearch()
|
||||
// 查询相应专家入驻信息
|
||||
isExist, err := model2.FirstField(mManageResearch.ManageResearch, []string{"id", "status"},
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local))
|
||||
|
||||
mUserResearch := model.NewUserResearch()
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
} else if isExist {
|
||||
// 审核中
|
||||
if mManageResearch.Status == model2.ExamineStatusForOngoing {
|
||||
return errors.New("操作错误,当前该研究机构信息审核中,不可入驻")
|
||||
}
|
||||
// 审核通过
|
||||
if mManageResearch.Status == model2.ExamineStatusForAgree {
|
||||
// 筛选企业条件
|
||||
if err = params.filter(config.TenantUserIdentityForCompany,
|
||||
model2.NewWhere("research_id", mManageResearch.ID)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
mManageResearch.ID = 0
|
||||
}
|
||||
mManageResearch.Local.Local = c.local
|
||||
mManageResearch.Image.Image = params.Image
|
||||
mManageResearch.Name = params.Name
|
||||
mManageResearch.Code = params.Code
|
||||
mManageResearch.Area = model2.Area{
|
||||
Province: params.Area.Province, City: params.Area.City, District: params.Area.District, Address: params.Area.Address,
|
||||
}
|
||||
//mManageExpert.Position = params.Mobile
|
||||
mManageResearch.SetIndustryAttribute(params.Industrys)
|
||||
mManageResearch.SetKeywordAttribute(params.Keywords)
|
||||
mManageResearch.SetResearchAttribute(other.Researchs)
|
||||
mManageResearch.Introduce = params.Introduce
|
||||
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
// 删除区域相同编码公司信息
|
||||
if err = model2.DeleteWhere(mManageResearch.ManageResearch, []*model2.ModelWhere{
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local)}, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = model2.Create(mManageResearch.ManageResearch, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := model2.UpdatesWhere(mUserResearch.UserResearch, map[string]interface{}{
|
||||
"status": model2.InvalidStatusForYes, "updated_at": time.Now(),
|
||||
}, []*model2.ModelWhere{model2.NewWhere("uid", c.UID)}, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
mUserResearch.UID = c.UID
|
||||
mUserResearch.ResearchID = mManageResearch.ID
|
||||
return model2.Create(mUserResearch.UserResearch, tx)
|
||||
})
|
||||
}
|
||||
|
||||
func NewResearch() ResearchHandle {
|
||||
return func(session *session.Enterprise, local string) *Research {
|
||||
return &Research{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
}
|
||||
}
|
||||
}
|
14
app/api/enterprise/model/manage_agent.go
Normal file
14
app/api/enterprise/model/manage_agent.go
Normal file
@ -0,0 +1,14 @@
|
||||
package model
|
||||
|
||||
import (
|
||||
"SciencesServer/app/common/model"
|
||||
)
|
||||
|
||||
// ManageAgent 经纪人入驻数据信息
|
||||
type ManageAgent struct {
|
||||
*model.ManageAgent
|
||||
}
|
||||
|
||||
func NewManageAgent() *ManageAgent {
|
||||
return &ManageAgent{model.NewManageAgent()}
|
||||
}
|
11
app/api/enterprise/model/user_agent.go
Normal file
11
app/api/enterprise/model/user_agent.go
Normal file
@ -0,0 +1,11 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/app/common/model"
|
||||
|
||||
type UserAgent struct {
|
||||
*model.UserAgent
|
||||
}
|
||||
|
||||
func NewUserAgent() *UserAgent {
|
||||
return &UserAgent{model.NewUserAgent()}
|
||||
}
|
11
app/api/enterprise/model/user_expert.go
Normal file
11
app/api/enterprise/model/user_expert.go
Normal file
@ -0,0 +1,11 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/app/common/model"
|
||||
|
||||
type UserExpert struct {
|
||||
*model.UserExpert
|
||||
}
|
||||
|
||||
func NewUserExpert() *UserExpert {
|
||||
return &UserExpert{model.NewUserExpert()}
|
||||
}
|
11
app/api/enterprise/model/user_laboratory.go
Normal file
11
app/api/enterprise/model/user_laboratory.go
Normal file
@ -0,0 +1,11 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/app/common/model"
|
||||
|
||||
type UserLaboratory struct {
|
||||
*model.UserLaboratory
|
||||
}
|
||||
|
||||
func NewUserLaboratory() *UserLaboratory {
|
||||
return &UserLaboratory{model.NewUserLaboratory()}
|
||||
}
|
11
app/api/enterprise/model/user_research.go
Normal file
11
app/api/enterprise/model/user_research.go
Normal file
@ -0,0 +1,11 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/app/common/model"
|
||||
|
||||
type UserResearch struct {
|
||||
*model.UserResearch
|
||||
}
|
||||
|
||||
func NewUserResearch() *UserResearch {
|
||||
return &UserResearch{model.NewUserResearch()}
|
||||
}
|
@ -11,32 +11,41 @@ type Area struct {
|
||||
type (
|
||||
// IdentityForCompany 公司附加信息
|
||||
IdentityForCompany struct {
|
||||
WebUrl string `json:"web_url" form:"web_url"`
|
||||
Url string `json:"url" form:"url"` // 企业网站
|
||||
}
|
||||
// IdentityForExpert 专家附加信息
|
||||
IdentityForExpert struct {
|
||||
TenantID uint64 `json:"tenant_id" form:"tenant_id"`
|
||||
Longitude float64 `json:"longitude" form:"longitude"` // 经度
|
||||
Latitude float64 `json:"latitude" form:"latitude"` // 纬度
|
||||
School string `json:"school" form:"school"`
|
||||
Major string `json:"major" form:"major"`
|
||||
Job string `json:"job" form:"job"`
|
||||
Title string `json:"title" form:"title"`
|
||||
WorkAt string `json:"work_at" form:"work_at"`
|
||||
Research string `json:"research" form:"research"` // 研究方向
|
||||
ResearchID uint64 `json:"research_id" form:"research_id" binding:"required"` // 科研机构ID
|
||||
LaboratoryID uint64 `json:"laboratory_id" form:"laboratory_id"` // 实验室ID
|
||||
School string `json:"school" form:"school"` // 毕业院校
|
||||
Major string `json:"major" form:"major"` // 专业
|
||||
Job string `json:"job" form:"job"` // 职务
|
||||
Title string `json:"title" form:"title"` // 职称
|
||||
WorkAt string `json:"work_at" form:"work_at"` // 从业时间
|
||||
Gender int `json:"gender" form:"gender"` // 性别
|
||||
Researchs []string `json:"researchs" form:"researchs"` // 研究方向
|
||||
}
|
||||
// IdentityForResearch 研究机构
|
||||
IdentityForResearch struct {
|
||||
Longitude float64 `json:"longitude" form:"longitude"` // 经度
|
||||
Latitude float64 `json:"latitude" form:"latitude"` // 纬度
|
||||
Research string `json:"research" form:"research"` // 研究领域方向
|
||||
Longitude float64 `json:"longitude" form:"longitude"` // 经度
|
||||
Latitude float64 `json:"latitude" form:"latitude"` // 纬度
|
||||
Researchs []string `json:"researchs" form:"researchs"` // 研究方向
|
||||
}
|
||||
// IdentityForLaboratory 实验室
|
||||
IdentityForLaboratory struct {
|
||||
TenantID uint64 `json:"tenant_id" form:"tenant_id"`
|
||||
Longitude float64 `json:"longitude" form:"longitude"` // 经度
|
||||
Latitude float64 `json:"latitude" form:"latitude"` // 纬度
|
||||
Research string `json:"research" form:"research"` // 研究领域方向
|
||||
ResearchID uint64 `json:"research_id" form:"research_id" binding:"required"` // 科研机构ID
|
||||
Url string `json:"url" form:"url"` // 实验室网站
|
||||
Longitude float64 `json:"longitude" form:"longitude"` // 经度
|
||||
Latitude float64 `json:"latitude" form:"latitude"` // 纬度
|
||||
Researchs []string `json:"researchs" form:"researchs"` // 研究方向
|
||||
}
|
||||
// IdentityForAgent 经纪人
|
||||
IdentityForAgent struct {
|
||||
ResearchID uint64 `json:"research_id" form:"research_id" binding:"required"` // 科研机构ID
|
||||
Url string `json:"url" form:"url"` // 实验室网站
|
||||
Longitude float64 `json:"longitude" form:"longitude"` // 经度
|
||||
Latitude float64 `json:"latitude" form:"latitude"` // 纬度
|
||||
Researchs []string `json:"researchs" form:"researchs"` // 研究方向
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -1,7 +1,20 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/utils"
|
||||
|
||||
// ManageAgent 经纪人入驻信息管理
|
||||
type ManageAgent struct {
|
||||
Model
|
||||
Local
|
||||
Name string `gorm:"column:name;type:varchar(30);default:null;comment:姓名" json:"name"`
|
||||
Mobile string `gorm:"column:mobile;type:varchar(15);default:null;comment:联系方式" json:"mobile"`
|
||||
IDCard string `gorm:"column:id_card;type:varchar(18);default:null;comment:身份证号" json:"id_card"`
|
||||
Industry string `gorm:"column:industry;type:varchar(255);default:null;comment:行业领域" json:"industry"`
|
||||
Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"-"`
|
||||
WorkExperience string `gorm:"column:work_experience;type:varchar(255);default:null;comment:工作经历" json:"work_experience"`
|
||||
WorkPlace string `gorm:"column:work_place;type:varchar(255);default:0;comment:工作地点" json:"work_place"`
|
||||
IDImage string `gorm:"column:id_image;type:text;default:null;comment:身份证图片" json:"-"`
|
||||
CredentialImage string `gorm:"column:credential_image;type:varchar(255);default:null;comment:资格证书" json:"credential_image"`
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
@ -10,6 +23,26 @@ func (m *ManageAgent) TableName() string {
|
||||
return "manage_agent"
|
||||
}
|
||||
|
||||
func (m *ManageAgent) GetIndustryAttribute() []string {
|
||||
out := make([]string, 0)
|
||||
_ = utils.FromJSON(m.Industry, &out)
|
||||
return out
|
||||
}
|
||||
|
||||
func (m *ManageAgent) SetIndustryAttribute(value []string) {
|
||||
m.Industry = utils.AnyToJSON(value)
|
||||
}
|
||||
|
||||
func (m *ManageAgent) GetKeywordAttribute() []string {
|
||||
out := make([]string, 0)
|
||||
_ = utils.FromJSON(m.Keyword, &out)
|
||||
return out
|
||||
}
|
||||
|
||||
func (m *ManageAgent) SetKeywordAttribute(value []string) {
|
||||
m.Keyword = utils.AnyToJSON(value)
|
||||
}
|
||||
|
||||
func NewManageAgent() *ManageAgent {
|
||||
return &ManageAgent{}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package model
|
||||
|
||||
import "SciencesServer/utils"
|
||||
|
||||
// ManageCompany 公司企业入住信息管理
|
||||
// ManageCompany 公司企业入驻信息管理
|
||||
type ManageCompany struct {
|
||||
Model
|
||||
Local
|
||||
@ -11,7 +11,7 @@ type ManageCompany struct {
|
||||
Code string `gorm:"column:code;type:varchar(30);default:null;comment:信用代码" json:"code"`
|
||||
Image
|
||||
Area
|
||||
WebUrl string `gorm:"column:web_url;type:varchar(255);default:null;comment:企业网站" json:"web_url"`
|
||||
Url string `gorm:"column:url;type:varchar(255);default:null;comment:企业网站" json:"url"`
|
||||
Industry string `gorm:"column:industry;type:varchar(255);default:null;comment:行业领域" json:"industry"`
|
||||
Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"keyword"`
|
||||
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
|
||||
|
@ -9,15 +9,20 @@ import (
|
||||
type ManageExpert struct {
|
||||
Model
|
||||
Local
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
Image
|
||||
ResearchID uint64 `gorm:"column:research_id;type:int(11);default:0;comment:科研机构ID" json:"-"`
|
||||
LaboratoryID uint64 `gorm:"column:laboratory_id;type:int(11);default:0;comment:实验室ID" json:"-"`
|
||||
Name string `gorm:"column:name;type:varchar(30);default:null;comment:专家名称" json:"name"`
|
||||
Mobile string `gorm:"column:mobile;type:varchar(15);default:null;comment:专家联系方式" json:"mobile"`
|
||||
Area
|
||||
Position string `gorm:"column:position;type:varchar(50);default:null;comment:坐标" json:"-"`
|
||||
School string `gorm:"column:school;type:varchar(50);default:null;comment:院校" json:"school"`
|
||||
Major string `gorm:"column:major;type:varchar(50);default:null;comment:专业" json:"major"`
|
||||
Job string `gorm:"column:job;type:varchar(50);default:null;comment:职务" json:"job"`
|
||||
Title string `gorm:"column:title;type:varchar(50);default:null;comment:职称" json:"title"`
|
||||
Position string `gorm:"column:position;type:varchar(50);default:null;comment:坐标" json:"-"`
|
||||
School string `gorm:"column:school;type:varchar(50);default:null;comment:院校" json:"school"`
|
||||
Major string `gorm:"column:major;type:varchar(50);default:null;comment:专业" json:"major"`
|
||||
Job string `gorm:"column:job;type:varchar(50);default:null;comment:职务" json:"job"`
|
||||
Title string `gorm:"column:title;type:varchar(50);default:null;comment:职称" json:"title"`
|
||||
Gender
|
||||
WorkAt time.Time `gorm:"column:work_at;type:date;not null;comment:从业时间" json:"work_at"`
|
||||
Industry string `gorm:"column:industry;type:varchar(30);default:0;comment:行业领域" json:"industry"`
|
||||
Industry string `gorm:"column:industry;type:varchar(255);default:null;comment:行业领域" json:"industry"`
|
||||
Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"keyword"`
|
||||
Research string `gorm:"column:research;type:varchar(255);default:null;comment:研究信息" json:"research"`
|
||||
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
|
||||
@ -40,6 +45,16 @@ func (m *ManageExpert) SetIndustryAttribute(value []string) {
|
||||
m.Industry = utils.AnyToJSON(value)
|
||||
}
|
||||
|
||||
func (m *ManageExpert) GetResearchAttribute() []string {
|
||||
out := make([]string, 0)
|
||||
_ = utils.FromJSON(m.Research, &out)
|
||||
return out
|
||||
}
|
||||
|
||||
func (m *ManageExpert) SetResearchAttribute(value []string) {
|
||||
m.Research = utils.AnyToJSON(value)
|
||||
}
|
||||
|
||||
func (m *ManageExpert) GetKeywordAttribute() []string {
|
||||
keywords := make([]string, 0)
|
||||
_ = utils.FromJSON(m.Keyword, &keywords)
|
||||
|
@ -8,13 +8,14 @@ import (
|
||||
type ManageLaboratory struct {
|
||||
Model
|
||||
Local
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
Name string `gorm:"column:name;type:varchar(30);default:null;comment:名称" json:"name"`
|
||||
Code string `gorm:"column:code;type:varchar(30);default:null;comment:信用代码" json:"code"`
|
||||
ResearchID uint64 `gorm:"column:research_id;type:int(11);default:0;comment:科研机构ID" json:"-"`
|
||||
Name string `gorm:"column:name;type:varchar(30);default:null;comment:名称" json:"name"`
|
||||
Code string `gorm:"column:code;type:varchar(30);default:null;comment:信用代码" json:"code"`
|
||||
Image
|
||||
Area
|
||||
Url string `gorm:"column:url;type:varchar(255);default:null;comment:实验室网站" json:"url"`
|
||||
Position string `gorm:"column:position;type:varchar(50);default:null;comment:坐标" json:"-"`
|
||||
Industry string `gorm:"column:industry;type:varchar(30);default:0;comment:行业领域" json:"industry"`
|
||||
Industry string `gorm:"column:industry;type:varchar(255);default:null;comment:行业领域" json:"industry"`
|
||||
Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"keyword"`
|
||||
Research string `gorm:"column:research;type:varchar(255);default:null;comment:研究信息" json:"research"`
|
||||
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
|
||||
@ -27,14 +28,34 @@ func (m *ManageLaboratory) TableName() string {
|
||||
return "manage_laboratory"
|
||||
}
|
||||
|
||||
func (m *ManageLaboratory) GetKeywordAttribute() []string {
|
||||
keywords := make([]string, 0)
|
||||
_ = utils.FromJSON(m.Keyword, &keywords)
|
||||
return keywords
|
||||
func (m *ManageLaboratory) GetIndustryAttribute() []string {
|
||||
out := make([]string, 0)
|
||||
_ = utils.FromJSON(m.Industry, &out)
|
||||
return out
|
||||
}
|
||||
|
||||
func (m *ManageLaboratory) SetKeywordAttribute(keywords []string) {
|
||||
m.Keyword = utils.AnyToJSON(keywords)
|
||||
func (m *ManageLaboratory) SetIndustryAttribute(value []string) {
|
||||
m.Industry = utils.AnyToJSON(value)
|
||||
}
|
||||
|
||||
func (m *ManageLaboratory) GetKeywordAttribute() []string {
|
||||
out := make([]string, 0)
|
||||
_ = utils.FromJSON(m.Keyword, &out)
|
||||
return out
|
||||
}
|
||||
|
||||
func (m *ManageLaboratory) SetKeywordAttribute(value []string) {
|
||||
m.Keyword = utils.AnyToJSON(value)
|
||||
}
|
||||
|
||||
func (m *ManageLaboratory) GetResearchAttribute() []string {
|
||||
out := make([]string, 0)
|
||||
_ = utils.FromJSON(m.Research, &out)
|
||||
return out
|
||||
}
|
||||
|
||||
func (m *ManageLaboratory) SetResearchAttribute(value []string) {
|
||||
m.Research = utils.AnyToJSON(value)
|
||||
}
|
||||
|
||||
func NewManageLaboratory() *ManageLaboratory {
|
||||
|
@ -7,13 +7,13 @@ import (
|
||||
// ManageResearch 科研机构入住信息管理
|
||||
type ManageResearch struct {
|
||||
Model
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
Local
|
||||
Name string `gorm:"column:name;type:varchar(30);default:null;comment:名称" json:"name"`
|
||||
Code string `gorm:"column:code;type:varchar(30);default:null;comment:信用代码" json:"code"`
|
||||
Image
|
||||
Area
|
||||
Position string `gorm:"column:position;type:varchar(50);default:null;comment:坐标" json:"-"`
|
||||
Industry string `gorm:"column:industry;type:int(11);default:0;comment:行业领域" json:"industry"`
|
||||
Industry string `gorm:"column:industry;type:varchar(255);default:null;comment:所属领域;行业信息" json:"industry"`
|
||||
Keyword string `gorm:"column:keyword;type:varchar(255);default:null;comment:关键词" json:"keyword"`
|
||||
Research string `gorm:"column:research;type:varchar(255);default:null;comment:研究信息" json:"research"`
|
||||
Introduce string `gorm:"column:introduce;type:text;comment:介绍描述" json:"introduce"`
|
||||
@ -26,14 +26,34 @@ func (m *ManageResearch) TableName() string {
|
||||
return "manage_expert"
|
||||
}
|
||||
|
||||
func (m *ManageResearch) GetKeywordAttribute() []string {
|
||||
keywords := make([]string, 0)
|
||||
_ = utils.FromJSON(m.Keyword, &keywords)
|
||||
return keywords
|
||||
func (m *ManageResearch) GetIndustryAttribute() []string {
|
||||
out := make([]string, 0)
|
||||
_ = utils.FromJSON(m.Industry, &out)
|
||||
return out
|
||||
}
|
||||
|
||||
func (m *ManageResearch) SetKeywordAttribute(keywords []string) {
|
||||
m.Keyword = utils.AnyToJSON(keywords)
|
||||
func (m *ManageResearch) SetIndustryAttribute(value []string) {
|
||||
m.Industry = utils.AnyToJSON(value)
|
||||
}
|
||||
|
||||
func (m *ManageResearch) GetKeywordAttribute() []string {
|
||||
out := make([]string, 0)
|
||||
_ = utils.FromJSON(m.Keyword, &out)
|
||||
return out
|
||||
}
|
||||
|
||||
func (m *ManageResearch) SetKeywordAttribute(value []string) {
|
||||
m.Keyword = utils.AnyToJSON(value)
|
||||
}
|
||||
|
||||
func (m *ManageResearch) GetResearchAttribute() []string {
|
||||
out := make([]string, 0)
|
||||
_ = utils.FromJSON(m.Research, &out)
|
||||
return out
|
||||
}
|
||||
|
||||
func (m *ManageResearch) SetResearchAttribute(value []string) {
|
||||
m.Research = utils.AnyToJSON(value)
|
||||
}
|
||||
|
||||
func NewManageResearch() *ManageResearch {
|
||||
|
@ -1,7 +1,11 @@
|
||||
package model
|
||||
|
||||
// UserAgent 用户经纪人数据模型
|
||||
type UserAgent struct {
|
||||
Model
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
AgentID uint64 `gorm:"column:agent_id;type:int(11);default:0;comment:经纪人模型ID" json:"-"`
|
||||
InvalidStatus
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
@ -1,7 +1,11 @@
|
||||
package model
|
||||
|
||||
// UserExpert 用户专家数据模型
|
||||
type UserExpert struct {
|
||||
Model
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
ExpertID uint64 `gorm:"column:expert_id;type:int(11);default:0;comment:专家模型ID" json:"-"`
|
||||
InvalidStatus
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
@ -1,7 +1,11 @@
|
||||
package model
|
||||
|
||||
// UserLaboratory 用户实验室数据模型
|
||||
type UserLaboratory struct {
|
||||
Model
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
LaboratoryID uint64 `gorm:"column:laboratory_id;type:int(11);default:0;comment:实验室模型ID" json:"-"`
|
||||
InvalidStatus
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
@ -1,7 +1,11 @@
|
||||
package model
|
||||
|
||||
// UserResearch 用户研究机构数据模型
|
||||
type UserResearch struct {
|
||||
Model
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
ResearchID uint64 `gorm:"column:research_id;type:int(11);default:0;comment:研究机构模型ID" json:"-"`
|
||||
InvalidStatus
|
||||
ModelDeleted
|
||||
ModelAt
|
||||
}
|
||||
|
@ -161,6 +161,9 @@ func registerEnterpriseAPI(app *gin.Engine) {
|
||||
settledV1.GET("", _api.Index)
|
||||
settledV1.POST("/company", _api.Company)
|
||||
settledV1.POST("/expert", _api.Expert)
|
||||
settledV1.POST("/research", _api.Research)
|
||||
settledV1.POST("/laboratory", _api.Laboratory)
|
||||
settledV1.POST("/agent", _api.Agent)
|
||||
}
|
||||
// Technology 技术管理
|
||||
technologyV1 := g.Group("/technology")
|
||||
|
Reference in New Issue
Block a user