feat:完善项目信息
This commit is contained in:
@ -53,7 +53,7 @@ func (*Sys) BannerForm(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
err := sys.NewBanner()(api.GetSession()(c).(*session.Admin)).Form(&sys.BannerParams{
|
||||
ID: form.IDStringForm.Convert(), TenantID: form.IDStringForm.Convert(),
|
||||
ID: form.IDStringForm.Convert(), TenantID: form.TenantIDStringForm.Convert(),
|
||||
Title: form.Title, Local: form.Local, Size: form.Size, Remark: form.Remark, Images: form.FilterImageURL(),
|
||||
IsMultiple: form.IsMultiple,
|
||||
})
|
||||
|
@ -120,7 +120,7 @@ func (*Manage) Equipment(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := manage.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
List(form.Kind, form.Code, form.Title, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -132,7 +132,7 @@ func (*Manage) EquipmentAdd(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := manage.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := manage.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Form(&manage.EquipmentParams{Kind: form.Kind, Code: form.Code, Title: form.Title, Params: form.Params, Description: form.Description})
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -146,7 +146,7 @@ func (*Manage) EquipmentEdit(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := manage.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := manage.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Form(&manage.EquipmentParams{ID: form.Convert(), Kind: form.Kind, Code: form.Code, Title: form.Title,
|
||||
Params: form.Params, Description: form.Description})
|
||||
|
||||
@ -160,7 +160,7 @@ func (*Manage) EquipmentDelete(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := manage.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := manage.NewEquipment()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -172,8 +172,7 @@ func (*Manage) CompanyDetail(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewCompany()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
Detail(form.Convert())
|
||||
data, err := manage.NewCompany()(api.GetSession()(c).(*session.Enterprise)).Detail(form.Convert())
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
@ -186,7 +185,7 @@ func (*Manage) CompanyProduct(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewCompany()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := manage.NewCompany()(api.GetSession()(c).(*session.Enterprise)).
|
||||
Product(form.Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -203,7 +202,7 @@ func (*Manage) Expert(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewExpert()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := manage.NewExpert()(api.GetSession()(c).(*session.Enterprise)).
|
||||
Instance(form.Name, form.Mobile, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -217,7 +216,7 @@ func (*Manage) ExpertAchievement(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewExpert()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := manage.NewExpert()(api.GetSession()(c).(*session.Enterprise)).
|
||||
Achievement(form.Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -231,7 +230,7 @@ func (*Manage) ExpertProject(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewExpert()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := manage.NewExpert()(api.GetSession()(c).(*session.Enterprise)).
|
||||
Project(form.Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -245,7 +244,7 @@ func (*Manage) ExpertPatent(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewExpert()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := manage.NewExpert()(api.GetSession()(c).(*session.Enterprise)).
|
||||
Patent(form.Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -259,7 +258,7 @@ func (*Manage) ExpertPaper(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewExpert()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := manage.NewExpert()(api.GetSession()(c).(*session.Enterprise)).
|
||||
Paper(form.Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -273,7 +272,7 @@ func (*Manage) ExpertCooperate(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewExpert()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := manage.NewExpert()(api.GetSession()(c).(*session.Enterprise)).
|
||||
Cooperate(form.Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -287,7 +286,7 @@ func (*Manage) ResearchLaboratory(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewResearch()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := manage.NewResearch()(api.GetSession()(c).(*session.Enterprise)).
|
||||
Laboratory(form.Name, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -301,7 +300,7 @@ func (*Manage) ResearchVisit(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewResearch()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := manage.NewResearch()(api.GetSession()(c).(*session.Enterprise)).
|
||||
Visit(form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -315,7 +314,7 @@ func (*Manage) LaboratoryAchievement(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewLaboratory()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := manage.NewLaboratory()(api.GetSession()(c).(*session.Enterprise)).
|
||||
Achievement(form.Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -329,7 +328,7 @@ func (*Manage) LaboratoryProject(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewLaboratory()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := manage.NewLaboratory()(api.GetSession()(c).(*session.Enterprise)).
|
||||
Project(form.Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -343,7 +342,7 @@ func (*Manage) LaboratoryPatent(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewLaboratory()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := manage.NewLaboratory()(api.GetSession()(c).(*session.Enterprise)).
|
||||
Patent(form.Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -357,7 +356,7 @@ func (*Manage) LaboratoryPaper(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewLaboratory()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := manage.NewLaboratory()(api.GetSession()(c).(*session.Enterprise)).
|
||||
Paper(form.Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -371,7 +370,7 @@ func (*Manage) LaboratoryCooperate(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewLaboratory()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := manage.NewLaboratory()(api.GetSession()(c).(*session.Enterprise)).
|
||||
Cooperate(form.Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -383,7 +382,7 @@ func (*Manage) LaboratoryCooperateDetail(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewLaboratory()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := manage.NewLaboratory()(api.GetSession()(c).(*session.Enterprise)).
|
||||
CooperateDetail(form.Convert())
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -397,7 +396,7 @@ func (*Manage) AgentCompany(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewAgent()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := manage.NewAgent()(api.GetSession()(c).(*session.Enterprise)).
|
||||
Company(form.Name, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -411,7 +410,7 @@ func (*Manage) AgentCompanyAdd(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := manage.NewAgent()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := manage.NewAgent()(api.GetSession()(c).(*session.Enterprise)).
|
||||
Form(0, form.Name, form.Industrys)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -426,7 +425,7 @@ func (*Manage) AgentCompanyEdit(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := manage.NewAgent()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := manage.NewAgent()(api.GetSession()(c).(*session.Enterprise)).
|
||||
Form(form.Convert(), form.Name, form.Industrys)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ func (*Settled) Company(c *gin.Context) {
|
||||
}
|
||||
form.License = (&api.ImageForm{Image: form.License}).FilterImageURL()
|
||||
|
||||
err := settled.NewCompany()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := settled.NewCompany()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Launch(form.settledForm.bind(), (&api.IDStringForm{ID: form.InviterCode}).Convert(), &form.IdentityForCompany)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -63,7 +63,7 @@ func (*Settled) CompanyGet(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := settled.NewCompany()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).Get(form.Code)
|
||||
data, err := settled.NewCompany()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).Get(form.Code)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ func (*Settled) Expert(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := settled.NewExpert()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := settled.NewExpert()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Launch(form.settledForm.bind(), &form.IdentityForExpert)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -92,7 +92,7 @@ func (*Settled) Research(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := settled.NewResearch()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := settled.NewResearch()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Launch(form.settledForm.bind(), &form.IdentityForResearch)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -107,7 +107,7 @@ func (*Settled) Laboratory(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := settled.NewLaboratory()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := settled.NewLaboratory()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Launch(form.settledForm.bind(), &form.IdentityForLaboratory)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -133,7 +133,7 @@ func (*Settled) Agent(c *gin.Context) {
|
||||
form.IDImage.Behind = (&api.ImageForm{Image: form.IDImage.Behind}).FilterImageURL()
|
||||
form.IDImage.Hold = (&api.ImageForm{Image: form.IDImage.Hold}).FilterImageURL()
|
||||
|
||||
err := settled.NewAgent()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := settled.NewAgent()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Launch(form.settledForm.bind(), &form.IdentityForAgent)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
@ -10,10 +10,9 @@ import (
|
||||
|
||||
type Agent struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
}
|
||||
|
||||
type AgentHandle func(session *session.Enterprise, local string) *Agent
|
||||
type AgentHandle func(session *session.Enterprise) *Agent
|
||||
|
||||
type (
|
||||
// AgentCompany 经纪人公司信息
|
||||
@ -120,10 +119,9 @@ func (c *Agent) Delete(id uint64) error {
|
||||
}
|
||||
|
||||
func NewAgent() AgentHandle {
|
||||
return func(session *session.Enterprise, local string) *Agent {
|
||||
return func(session *session.Enterprise) *Agent {
|
||||
return &Agent{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,10 +14,9 @@ import (
|
||||
// Company 公司信息
|
||||
type Company struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
}
|
||||
|
||||
type CompanyHandle func(session *session.Enterprise, local string) *Company
|
||||
type CompanyHandle func(session *session.Enterprise) *Company
|
||||
|
||||
type (
|
||||
// CompanyDetail 详细信息
|
||||
@ -150,10 +149,9 @@ func (c *Company) Match(title string, industrys, keywords []string) ([]*CompanyM
|
||||
}
|
||||
|
||||
func NewCompany() CompanyHandle {
|
||||
return func(session *session.Enterprise, local string) *Company {
|
||||
return func(session *session.Enterprise) *Company {
|
||||
return &Company{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,10 +11,10 @@ import (
|
||||
// Equipment 设备信息
|
||||
type Equipment struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type EquipmentHandle func(session *session.Enterprise, local string) *Equipment
|
||||
type EquipmentHandle func(session *session.Enterprise, tenantID uint64) *Equipment
|
||||
|
||||
type (
|
||||
EquipmentInstance struct {
|
||||
@ -35,7 +35,7 @@ func (c *Equipment) List(kind int, code, title string, page, pageSize int) (*con
|
||||
|
||||
where := []*model2.ModelWhereOrder{
|
||||
&model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("local", c.local),
|
||||
Where: model2.NewWhere("tenant_id", c.tenantID),
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
},
|
||||
&model2.ModelWhereOrder{
|
||||
@ -94,7 +94,7 @@ func (c *Equipment) Form(params *EquipmentParams) error {
|
||||
if mManageEquipment.ID > 0 {
|
||||
return model2.Updates(mManageEquipment.ManageEquipment, mManageEquipment.ManageEquipment)
|
||||
}
|
||||
mManageEquipment.Local.Local = c.local
|
||||
mManageEquipment.TenantID = c.tenantID
|
||||
mManageEquipment.UID = c.UID
|
||||
return model2.Create(mManageEquipment.ManageEquipment)
|
||||
}
|
||||
@ -117,10 +117,10 @@ func (c *Equipment) Delete(id uint64) error {
|
||||
}
|
||||
|
||||
func NewEquipment() EquipmentHandle {
|
||||
return func(session *session.Enterprise, local string) *Equipment {
|
||||
return func(session *session.Enterprise, tenantID uint64) *Equipment {
|
||||
return &Equipment{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
tenantID: tenantID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,10 +14,9 @@ import (
|
||||
|
||||
type Expert struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
}
|
||||
|
||||
type ExpertHandle func(session *session.Enterprise, local string) *Expert
|
||||
type ExpertHandle func(session *session.Enterprise) *Expert
|
||||
|
||||
type (
|
||||
// ExpertInfo 专家信息
|
||||
@ -294,10 +293,9 @@ func (c *Expert) CooperateDetail(id uint64) (*CooperateDetailInfo, error) {
|
||||
}
|
||||
|
||||
func NewExpert() ExpertHandle {
|
||||
return func(session *session.Enterprise, local string) *Expert {
|
||||
return func(session *session.Enterprise) *Expert {
|
||||
return &Expert{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,10 +12,9 @@ import (
|
||||
|
||||
type Laboratory struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
}
|
||||
|
||||
type LaboratoryHandle func(session *session.Enterprise, local string) *Laboratory
|
||||
type LaboratoryHandle func(session *session.Enterprise) *Laboratory
|
||||
|
||||
type (
|
||||
// LaboratoryMatchInfo 实验室匹配信息
|
||||
@ -194,10 +193,9 @@ func (c *Laboratory) Equipment(id uint64, page, pageSize int) (*controller.Retur
|
||||
}
|
||||
|
||||
func NewLaboratory() LaboratoryHandle {
|
||||
return func(session *session.Enterprise, local string) *Laboratory {
|
||||
return func(session *session.Enterprise) *Laboratory {
|
||||
return &Laboratory{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,10 +12,9 @@ import (
|
||||
|
||||
type Research struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
}
|
||||
|
||||
type ResearchHandle func(session *session.Enterprise, local string) *Research
|
||||
type ResearchHandle func(session *session.Enterprise) *Research
|
||||
|
||||
type (
|
||||
// ResearchLaboratory 科研机构下实验室信息
|
||||
@ -120,10 +119,9 @@ func (c *Research) Visit(page, pageSize int) (*controller.ReturnPages, error) {
|
||||
}
|
||||
|
||||
func NewResearch() ResearchHandle {
|
||||
return func(session *session.Enterprise, local string) *Research {
|
||||
return func(session *session.Enterprise) *Research {
|
||||
return &Research{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,10 +14,10 @@ import (
|
||||
// Agent 经纪人入驻信息
|
||||
type Agent struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type AgentHandle func(session *session.Enterprise, local string) *Agent
|
||||
type AgentHandle func(session *session.Enterprise, tenantID uint64) *Agent
|
||||
|
||||
// Launch 经纪人入驻
|
||||
func (c *Agent) Launch(params *BasicParams, other *config.IdentityForAgent) error {
|
||||
@ -27,7 +27,7 @@ func (c *Agent) Launch(params *BasicParams, other *config.IdentityForAgent) erro
|
||||
mManageAgent := model.NewManageAgent()
|
||||
// 查询相应的经纪人入驻信息
|
||||
isExist, err := model2.FirstField(mManageAgent.ManageAgent, []string{"id", "examine_status"},
|
||||
model2.NewWhere("id_card", other.IDCard), model2.NewWhere("local", c.local))
|
||||
model2.NewWhere("id_card", other.IDCard), model2.NewWhere("tenant_id", c.tenantID))
|
||||
|
||||
// 用户经纪人入驻信息
|
||||
mUserAgent := model.NewUserAgent()
|
||||
@ -49,7 +49,7 @@ func (c *Agent) Launch(params *BasicParams, other *config.IdentityForAgent) erro
|
||||
}
|
||||
mManageAgent.ID = 0
|
||||
}
|
||||
mManageAgent.Local.Local = c.local
|
||||
mManageAgent.TenantID = c.tenantID
|
||||
mManageAgent.Name = params.Name
|
||||
mManageAgent.Mobile = params.Mobile
|
||||
mManageAgent.IDCard = other.IDCard
|
||||
@ -67,7 +67,7 @@ func (c *Agent) Launch(params *BasicParams, other *config.IdentityForAgent) erro
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
// 删除区域相同身份证经纪人信息
|
||||
if err = model2.DeleteWhere(mManageAgent.ManageAgent, []*model2.ModelWhere{
|
||||
model2.NewWhere("id_card", other.IDCard), model2.NewWhere("local", c.local)}, tx); err != nil {
|
||||
model2.NewWhere("id_card", other.IDCard), model2.NewWhere("tenant_id", c.tenantID)}, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = model2.Create(mManageAgent.ManageAgent, tx); err != nil {
|
||||
@ -85,10 +85,10 @@ func (c *Agent) Launch(params *BasicParams, other *config.IdentityForAgent) erro
|
||||
}
|
||||
|
||||
func NewAgent() AgentHandle {
|
||||
return func(session *session.Enterprise, local string) *Agent {
|
||||
return func(session *session.Enterprise, tenantID uint64) *Agent {
|
||||
return &Agent{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
tenantID: tenantID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,10 +15,10 @@ import (
|
||||
// Company 公司企业入驻信息
|
||||
type Company struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type CompanyHandle func(session *session.Enterprise, local string) *Company
|
||||
type CompanyHandle func(session *session.Enterprise, tenantID uint64) *Company
|
||||
|
||||
type CompanyInfo struct {
|
||||
ID string `json:"id"`
|
||||
@ -58,7 +58,7 @@ func (c *Company) Launch(params *BasicParams, inviterID uint64, other *config.Id
|
||||
mManageCompany := model.NewManageCompany()
|
||||
// 查询相应的企业入驻信息
|
||||
isExist, err := model2.FirstField(mManageCompany.ManageCompany, []string{"id", "examine_status"},
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local))
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("tenant_id", c.tenantID))
|
||||
|
||||
// 过滤用户其他公司入驻信息
|
||||
mUserCompany := model.NewUserCompany()
|
||||
@ -80,7 +80,7 @@ func (c *Company) Launch(params *BasicParams, inviterID uint64, other *config.Id
|
||||
}
|
||||
mManageCompany.ID = 0
|
||||
}
|
||||
mManageCompany.Local.Local = c.local
|
||||
mManageCompany.TenantID = c.tenantID
|
||||
mManageCompany.InviterID = inviterID
|
||||
mManageCompany.Kind = model2.ManageCompanyKind(other.Kind)
|
||||
mManageCompany.Name = params.Name
|
||||
@ -100,7 +100,7 @@ func (c *Company) Launch(params *BasicParams, inviterID uint64, other *config.Id
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
// 删除区域相同编码公司信息
|
||||
if err = model2.DeleteWhere(mManageCompany.ManageCompany, []*model2.ModelWhere{
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local)}, tx); err != nil {
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("tenant_id", c.tenantID)}, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = model2.Create(mManageCompany.ManageCompany, tx); err != nil {
|
||||
@ -118,10 +118,10 @@ func (c *Company) Launch(params *BasicParams, inviterID uint64, other *config.Id
|
||||
}
|
||||
|
||||
func NewCompany() CompanyHandle {
|
||||
return func(session *session.Enterprise, local string) *Company {
|
||||
return func(session *session.Enterprise, tenantID uint64) *Company {
|
||||
return &Company{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
tenantID: tenantID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,10 +15,10 @@ import (
|
||||
// Expert 专家入驻信息
|
||||
type Expert struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type ExpertHandle func(session *session.Enterprise, local string) *Expert
|
||||
type ExpertHandle func(session *session.Enterprise, tenantID uint64) *Expert
|
||||
|
||||
// Launch 发起入驻
|
||||
func (c *Expert) Launch(params *BasicParams, other *config.IdentityForExpert) error {
|
||||
@ -28,7 +28,7 @@ func (c *Expert) Launch(params *BasicParams, other *config.IdentityForExpert) er
|
||||
mManageExpert := model.NewManageExpert()
|
||||
// 查询相应专家入驻信息
|
||||
isExist, err := model2.FirstField(mManageExpert.ManageExpert, []string{"id", "examine_status"},
|
||||
model2.NewWhere("mobile", params.Mobile), model2.NewWhere("local", c.local))
|
||||
model2.NewWhere("mobile", params.Mobile), model2.NewWhere("tenant_id", c.tenantID))
|
||||
|
||||
mUserExpert := model.NewUserExpert()
|
||||
|
||||
@ -49,7 +49,7 @@ func (c *Expert) Launch(params *BasicParams, other *config.IdentityForExpert) er
|
||||
}
|
||||
mUserExpert.ID = 0
|
||||
}
|
||||
mManageExpert.Local.Local = c.local
|
||||
mManageExpert.TenantID = c.tenantID
|
||||
mManageExpert.ResearchID = other.ResearchID
|
||||
mManageExpert.LaboratoryID = other.LaboratoryID
|
||||
mManageExpert.Image.Image = params.Image
|
||||
@ -73,7 +73,7 @@ func (c *Expert) Launch(params *BasicParams, other *config.IdentityForExpert) er
|
||||
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 {
|
||||
model2.NewWhere("mobile", params.Mobile), model2.NewWhere("tenant_id", c.tenantID)}, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = model2.Create(mManageExpert.ManageExpert, tx); err != nil {
|
||||
@ -91,10 +91,10 @@ func (c *Expert) Launch(params *BasicParams, other *config.IdentityForExpert) er
|
||||
}
|
||||
|
||||
func NewExpert() ExpertHandle {
|
||||
return func(session *session.Enterprise, local string) *Expert {
|
||||
return func(session *session.Enterprise, tenantID uint64) *Expert {
|
||||
return &Expert{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
tenantID: tenantID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,10 +14,10 @@ import (
|
||||
// Laboratory 实验室入驻信息
|
||||
type Laboratory struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type LaboratoryHandle func(session *session.Enterprise, local string) *Laboratory
|
||||
type LaboratoryHandle func(session *session.Enterprise, tenantID uint64) *Laboratory
|
||||
|
||||
// Launch 实验室入驻
|
||||
func (c *Laboratory) Launch(params *BasicParams, other *config.IdentityForLaboratory) error {
|
||||
@ -27,7 +27,7 @@ func (c *Laboratory) Launch(params *BasicParams, other *config.IdentityForLabora
|
||||
mManageLaboratory := model.NewManageLaboratory()
|
||||
// 查询相应专家入驻信息
|
||||
isExist, err := model2.FirstField(mManageLaboratory.ManageLaboratory, []string{"id", "examine_status"},
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local))
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("tenant_id", c.tenantID))
|
||||
|
||||
mUserLaboratory := model.NewUserLaboratory()
|
||||
|
||||
@ -48,7 +48,7 @@ func (c *Laboratory) Launch(params *BasicParams, other *config.IdentityForLabora
|
||||
}
|
||||
mManageLaboratory.ID = 0
|
||||
}
|
||||
mManageLaboratory.Local.Local = c.local
|
||||
mManageLaboratory.TenantID = c.tenantID
|
||||
mManageLaboratory.ResearchID = other.ResearchID
|
||||
mManageLaboratory.Image.Image = params.Image
|
||||
mManageLaboratory.Name = params.Name
|
||||
@ -66,7 +66,7 @@ func (c *Laboratory) Launch(params *BasicParams, other *config.IdentityForLabora
|
||||
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 {
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("tenant_id", c.tenantID)}, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = model2.Create(mManageLaboratory.ManageLaboratory, tx); err != nil {
|
||||
@ -84,10 +84,10 @@ func (c *Laboratory) Launch(params *BasicParams, other *config.IdentityForLabora
|
||||
}
|
||||
|
||||
func NewLaboratory() LaboratoryHandle {
|
||||
return func(session *session.Enterprise, local string) *Laboratory {
|
||||
return func(session *session.Enterprise, tenantID uint64) *Laboratory {
|
||||
return &Laboratory{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
tenantID: tenantID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,10 +14,10 @@ import (
|
||||
// Research 研究机构入驻信息
|
||||
type Research struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type ResearchHandle func(session *session.Enterprise, local string) *Research
|
||||
type ResearchHandle func(session *session.Enterprise, tenantID uint64) *Research
|
||||
|
||||
// Launch 研究机构入驻
|
||||
func (c *Research) Launch(params *BasicParams, other *config.IdentityForResearch) error {
|
||||
@ -27,7 +27,7 @@ func (c *Research) Launch(params *BasicParams, other *config.IdentityForResearch
|
||||
mManageResearch := model.NewManageResearch()
|
||||
// 查询相应专家入驻信息
|
||||
isExist, err := model2.FirstField(mManageResearch.ManageResearch, []string{"id", "examine_status"},
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local))
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("tenant_id", c.tenantID))
|
||||
|
||||
mUserResearch := model.NewUserResearch()
|
||||
|
||||
@ -48,7 +48,7 @@ func (c *Research) Launch(params *BasicParams, other *config.IdentityForResearch
|
||||
}
|
||||
mManageResearch.ID = 0
|
||||
}
|
||||
mManageResearch.Local.Local = c.local
|
||||
mManageResearch.TenantID = c.tenantID
|
||||
mManageResearch.Image.Image = params.Image
|
||||
mManageResearch.Name = params.Name
|
||||
mManageResearch.Code = params.Code
|
||||
@ -64,7 +64,7 @@ func (c *Research) Launch(params *BasicParams, other *config.IdentityForResearch
|
||||
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 {
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("tenant_id", c.tenantID)}, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
if err = model2.Create(mManageResearch.ManageResearch, tx); err != nil {
|
||||
@ -82,10 +82,10 @@ func (c *Research) Launch(params *BasicParams, other *config.IdentityForResearch
|
||||
}
|
||||
|
||||
func NewResearch() ResearchHandle {
|
||||
return func(session *session.Enterprise, local string) *Research {
|
||||
return func(session *session.Enterprise, tenantID uint64) *Research {
|
||||
return &Research{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
tenantID: tenantID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,15 +19,3 @@ func (*Config) Index(c *gin.Context) {
|
||||
data, err := controller.NewConfig()(nil).Instance(form.Kind)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
func (*Config) Area(c *gin.Context) {
|
||||
form := &struct {
|
||||
Code string `json:"code" form:"code"`
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data := controller.NewConfig()(nil).Area(form.Code)
|
||||
api.APIResponse(nil, data)(c)
|
||||
}
|
||||
|
@ -10,6 +10,6 @@ type Docking struct{}
|
||||
|
||||
// Launch 联系客服对接
|
||||
func (*Docking) Launch(c *gin.Context) {
|
||||
err := controller.NewDocking()(nil, "").Form()
|
||||
err := controller.NewDocking()(nil).Form()
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
@ -2,15 +2,13 @@ package controller
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/admin/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
config2 "SciencesServer/config"
|
||||
)
|
||||
|
||||
type Config struct{ *session.Admin }
|
||||
type Config struct{ *session.Enterprise }
|
||||
|
||||
type ConfigHandle func(session *session.Admin) *Config
|
||||
type ConfigHandle func(session *session.Enterprise) *Config
|
||||
|
||||
type (
|
||||
ConfigInfo struct {
|
||||
@ -33,16 +31,8 @@ func (c *Config) Instance(kind int) ([]*ConfigInfo, error) {
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Area 区域信息
|
||||
func (c *Config) Area(key string) map[string]string {
|
||||
if key == "" {
|
||||
key = config2.DefaultChinaAreaCode
|
||||
}
|
||||
return config.MemoryForAreaInfo[key]
|
||||
}
|
||||
|
||||
func NewConfig() ConfigHandle {
|
||||
return func(session *session.Admin) *Config {
|
||||
return &Config{Admin: session}
|
||||
return func(session *session.Enterprise) *Config {
|
||||
return &Config{Enterprise: session}
|
||||
}
|
||||
}
|
||||
|
@ -8,10 +8,9 @@ import (
|
||||
|
||||
type Docking struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
}
|
||||
|
||||
type DockingHandle func(session *session.Enterprise, local string) *Docking
|
||||
type DockingHandle func(session *session.Enterprise) *Docking
|
||||
|
||||
// Form 联系客服对接
|
||||
func (c *Docking) Form() error {
|
||||
@ -24,10 +23,9 @@ func (c *Docking) Form() error {
|
||||
}
|
||||
|
||||
func NewDocking() DockingHandle {
|
||||
return func(session *session.Enterprise, local string) *Docking {
|
||||
return func(session *session.Enterprise) *Docking {
|
||||
return &Docking{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
// ManageAgent 经纪人入驻信息管理
|
||||
type ManageAgent struct {
|
||||
Model
|
||||
Local
|
||||
ModelTenant
|
||||
Name string `gorm:"column:name;type:varchar(30);default:'';comment:姓名" json:"name"`
|
||||
Mobile string `gorm:"column:mobile;type:varchar(15);default:'';comment:联系方式" json:"mobile"`
|
||||
IDCard string `gorm:"column:id_card;type:varchar(18);default:'';comment:身份证号" json:"id_card"`
|
||||
|
@ -5,7 +5,7 @@ import "SciencesServer/utils"
|
||||
// ManageCompany 公司企业入驻信息管理
|
||||
type ManageCompany struct {
|
||||
Model
|
||||
Local
|
||||
ModelTenant
|
||||
InviterID uint64 `gorm:"column:inviter_id;type:int;default:0;comment:邀请人ID" json:"inviter_id"`
|
||||
Kind ManageCompanyKind `gorm:"column:kind;type:tinyint(1);default:0;comment:企业类型" json:"kind"`
|
||||
Name string `gorm:"column:name;type:varchar(30);default:'';comment:企业名称" json:"name"`
|
||||
|
@ -5,7 +5,7 @@ import "time"
|
||||
// ManageEquipment 器材数据模型管理
|
||||
type ManageEquipment struct {
|
||||
Model
|
||||
Local
|
||||
ModelTenant
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
Kind ManageEquipmentKind `gorm:"column:kind;type:tinyint(1);default:0;comment:器材类型" json:"kind"`
|
||||
Code string `gorm:"column:code;type:varchar(30);default:'';comment:器材编号" json:"code"`
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
// ManageExpert 专家入驻信息管理
|
||||
type ManageExpert struct {
|
||||
Model
|
||||
Local
|
||||
ModelTenant
|
||||
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:"-"`
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
// ManageLaboratory 实验室入住信息管理
|
||||
type ManageLaboratory struct {
|
||||
Model
|
||||
Local
|
||||
ModelTenant
|
||||
ResearchID uint64 `gorm:"column:research_id;type:int(11);default:0;comment:科研机构ID" json:"-"`
|
||||
Name string `gorm:"column:name;type:varchar(30);default:'';comment:名称" json:"name"`
|
||||
Code string `gorm:"column:code;type:varchar(30);default:'';comment:信用代码" json:"code"`
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
// ManageResearch 科研机构入住信息管理
|
||||
type ManageResearch struct {
|
||||
Model
|
||||
Local
|
||||
ModelTenant
|
||||
Name string `gorm:"column:name;type:varchar(30);default:'';comment:名称" json:"name"`
|
||||
Code string `gorm:"column:code;type:varchar(30);default:'';comment:信用代码" json:"code"`
|
||||
Image
|
||||
|
@ -40,7 +40,8 @@ func registerAPI(app *gin.Engine) {
|
||||
{
|
||||
_api := new(api2.Config)
|
||||
configV1.GET("", _api.Index)
|
||||
configV1.POST("/area", _api.Area)
|
||||
_api2 := new(api.Config)
|
||||
configV1.POST("/area", _api2.Area)
|
||||
}
|
||||
// User 用户信息管理
|
||||
userV1 := v1.Group("/user")
|
||||
|
Reference in New Issue
Block a user