feat:完善项目
This commit is contained in:
@ -50,7 +50,7 @@ func (*Manage) Expert(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewInstance()(api.GetSession()(c).(*session.Admin), api.GetTenantID()(c).(string)).
|
||||
data, err := manage.NewInstance()(api.GetSession()(c).(*session.Admin), api.GetTenantID()(c).(uint64)).
|
||||
Expert(form.Name, form.Status, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)
|
||||
}
|
||||
|
28
app/api/admin/controller/manage/es.go
Normal file
28
app/api/admin/controller/manage/es.go
Normal file
@ -0,0 +1,28 @@
|
||||
package manage
|
||||
|
||||
import (
|
||||
"SciencesServer/app/basic/config"
|
||||
"SciencesServer/app/service"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type ESParams struct {
|
||||
Identity int
|
||||
Name string
|
||||
Keywords, Industrys, Researchs []string
|
||||
}
|
||||
|
||||
func (this *ESParams) Set() {
|
||||
_identitys := make([]string, 0)
|
||||
|
||||
for _, v := range this.Industrys {
|
||||
_identitys = append(_identitys, config.GetIndustryInfo(v, "-", "-"))
|
||||
}
|
||||
_ = service.NewESManage(
|
||||
service.WithManageIdentity(this.Identity),
|
||||
service.WithManageTitle(this.Name),
|
||||
service.WithManageIndustry(strings.Join(_identitys, ";")),
|
||||
service.WithManageKeyword(strings.Join(this.Keywords, ";")),
|
||||
service.WithManageResearch(strings.Join(this.Researchs, ";")),
|
||||
).Create()
|
||||
}
|
@ -20,6 +20,8 @@ type ExamineHandle func(session *session.Admin) *Examine
|
||||
type ExamineManageInfo struct {
|
||||
IModel model2.IModel
|
||||
UIDs []uint64 // 用户表UUID
|
||||
Name string
|
||||
Keywords, Industrys, Researchs []string
|
||||
}
|
||||
|
||||
// examineHandle 审核处理
|
||||
@ -60,7 +62,9 @@ func examineCompany(id, tenantID uint64) (*ExamineManageInfo, error) {
|
||||
model2.NewWhere("invalid_status", model2.InvalidStatusForNot)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ExamineManageInfo{IModel: mManageCompany.ManageCompany, UIDs: uids}, nil
|
||||
return &ExamineManageInfo{IModel: mManageCompany.ManageCompany, UIDs: uids,
|
||||
Name: mManageCompany.Name, Industrys: mManageCompany.GetIndustryAttribute(),
|
||||
Keywords: mManageCompany.GetKeywordAttribute()}, nil
|
||||
}
|
||||
|
||||
func examineExpert(id, tenantID uint64) (*ExamineManageInfo, error) {
|
||||
@ -82,7 +86,9 @@ func examineExpert(id, tenantID uint64) (*ExamineManageInfo, error) {
|
||||
model2.NewWhere("invalid_status", model2.InvalidStatusForNot)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ExamineManageInfo{IModel: mManageExpert.ManageExpert, UIDs: uids}, nil
|
||||
return &ExamineManageInfo{IModel: mManageExpert.ManageExpert, UIDs: uids,
|
||||
Name: mManageExpert.Name, Industrys: mManageExpert.GetIndustryAttribute(),
|
||||
Keywords: mManageExpert.GetKeywordAttribute(), Researchs: mManageExpert.GetResearchAttribute()}, nil
|
||||
}
|
||||
|
||||
func examineResearch(id, tenantID uint64) (*ExamineManageInfo, error) {
|
||||
@ -105,7 +111,9 @@ func examineResearch(id, tenantID uint64) (*ExamineManageInfo, error) {
|
||||
model2.NewWhere("invalid_status", model2.InvalidStatusForNot)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ExamineManageInfo{IModel: mManageResearch.ManageResearch, UIDs: uids}, nil
|
||||
return &ExamineManageInfo{IModel: mManageResearch.ManageResearch, UIDs: uids,
|
||||
Name: mManageResearch.Name, Industrys: mManageResearch.GetIndustryAttribute(),
|
||||
Keywords: mManageResearch.GetKeywordAttribute(), Researchs: mManageResearch.GetResearchAttribute()}, nil
|
||||
}
|
||||
|
||||
func examineLaboratory(id, tenantID uint64) (*ExamineManageInfo, error) {
|
||||
@ -128,7 +136,9 @@ func examineLaboratory(id, tenantID uint64) (*ExamineManageInfo, error) {
|
||||
model2.NewWhere("invalid_status", model2.InvalidStatusForNot)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ExamineManageInfo{IModel: mManageLaboratory.ManageLaboratory, UIDs: uids}, nil
|
||||
return &ExamineManageInfo{IModel: mManageLaboratory.ManageLaboratory, UIDs: uids,
|
||||
Name: mManageLaboratory.Name, Industrys: mManageLaboratory.GetIndustryAttribute(),
|
||||
Keywords: mManageLaboratory.GetKeywordAttribute(), Researchs: mManageLaboratory.GetResearchAttribute()}, nil
|
||||
}
|
||||
|
||||
func examineAgent(id, tenantID uint64) (*ExamineManageInfo, error) {
|
||||
@ -151,7 +161,9 @@ func examineAgent(id, tenantID uint64) (*ExamineManageInfo, error) {
|
||||
model2.NewWhere("invalid_status", model2.InvalidStatusForNot)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ExamineManageInfo{IModel: mManageAgent.ManageAgent, UIDs: uids}, nil
|
||||
return &ExamineManageInfo{IModel: mManageAgent.ManageAgent, UIDs: uids,
|
||||
Name: mManageAgent.Name, Industrys: mManageAgent.GetIndustryAttribute(),
|
||||
Keywords: mManageAgent.GetKeywordAttribute()}, nil
|
||||
}
|
||||
|
||||
// Launch 发起审核
|
||||
@ -210,6 +222,11 @@ func (c *Examine) Launch(id uint64, identity, status int) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// 存放es中
|
||||
(&ESParams{
|
||||
Identity: identity, Name: data.Name, Keywords: data.Keywords,
|
||||
Industrys: data.Industrys, Researchs: data.Researchs,
|
||||
}).Set()
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
@ -14,10 +14,10 @@ import (
|
||||
type Instance struct {
|
||||
*session.Admin
|
||||
gorm.Model
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type InstanceHandle func(session *session.Admin, local string) *Instance
|
||||
type InstanceHandle func(session *session.Admin, tenantID uint64) *Instance
|
||||
|
||||
type (
|
||||
// InstanceForExpert 专家信息
|
||||
@ -87,10 +87,10 @@ func (c *Instance) Expert(name string, status int, page, pageSize int) (*control
|
||||
}
|
||||
|
||||
func NewInstance() InstanceHandle {
|
||||
return func(session *session.Admin, local string) *Instance {
|
||||
return func(session *session.Admin, tenantID uint64) *Instance {
|
||||
return &Instance{
|
||||
Admin: session,
|
||||
local: local,
|
||||
tenantID: tenantID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ func (a *Account) Login(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := account.NewLogin()(api.GetTenantID()(c).(string)).Launch(account.LoginMode(form.Mode), &account.LoginParams{
|
||||
data, err := account.NewLogin()(api.GetTenantID()(c).(uint64)).Launch(account.LoginMode(form.Mode), &account.LoginParams{
|
||||
Captcha: struct {
|
||||
Mobile string
|
||||
Captcha string
|
||||
@ -54,7 +54,7 @@ func (a *Account) Register(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := account.NewRegister()(api.GetTenantID()(c).(string)).Launch(&account.RegisterParams{
|
||||
data, err := account.NewRegister()(api.GetTenantID()(c).(uint64)).Launch(&account.RegisterParams{
|
||||
Name: form.Name, Mobile: form.Mobile, Captcha: form.Captcha,
|
||||
Password: form.Password, RepeatPass: form.RepeatPass,
|
||||
})
|
||||
|
@ -10,6 +10,6 @@ import (
|
||||
type Home struct{}
|
||||
|
||||
func (*Home) Instance(c *gin.Context) {
|
||||
data, err := home.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).Instance()
|
||||
data, err := home.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).Instance()
|
||||
api.APIResponse(err, data)
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ func (*Manage) Enterprise(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := manage.NewEnterprise()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := manage.NewEnterprise()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
List(form.Mode, form.Title, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -74,7 +74,7 @@ func (*Manage) EnterpriseAdd(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := manage.NewEnterprise()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := manage.NewEnterprise()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Form(&manage.EnterpriseParams{Mode: form.Mode, Title: form.Title, Name: form.Name, Mobile: form.Mobile,
|
||||
Papers: form.paperInfo(), Patents: form.PatentInfo(), Content: form.Content,
|
||||
})
|
||||
@ -90,7 +90,7 @@ func (*Manage) EnterpriseEdit(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := manage.NewEnterprise()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := manage.NewEnterprise()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Form(&manage.EnterpriseParams{ID: form.Convert(), Mode: form.Mode, Title: form.Title, Name: form.Name,
|
||||
Mobile: form.Mobile, Papers: form.paperInfo(), Patents: form.PatentInfo(), Content: form.Content,
|
||||
})
|
||||
@ -104,7 +104,7 @@ func (*Manage) EnterpriseDelete(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := manage.NewEnterprise()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := manage.NewEnterprise()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ func (*Service) Demand(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := service.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := service.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
List(form.Title, form.Status, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -43,7 +43,7 @@ func (*Service) DemandDetail(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := service.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := service.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Detail(form.Convert())
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -55,7 +55,7 @@ func (*Service) DemandAdd(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := service.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := service.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Form(&service.DemandParams{Kinds: form.Kinds, IsSubmit: form.IsSubmit, Title: form.Title,
|
||||
Name: form.Name, Mobile: form.Mobile, Description: form.Description,
|
||||
})
|
||||
@ -71,7 +71,7 @@ func (*Service) DemandEdit(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := service.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := service.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Form(&service.DemandParams{ID: form.Convert(), Kinds: form.Kinds, IsSubmit: form.IsSubmit, Title: form.Title,
|
||||
Name: form.Name, Mobile: form.Mobile, Description: form.Description,
|
||||
})
|
||||
@ -85,7 +85,7 @@ func (*Service) DemandDelete(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := service.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := service.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ func (c *settledForm) bind() *settled.BasicParams {
|
||||
|
||||
// Index 入驻信息
|
||||
func (*Settled) Index(c *gin.Context) {
|
||||
data, err := settled.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).Index()
|
||||
data, err := settled.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).Index()
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
|
@ -156,7 +156,7 @@ func (a *Technology) Instance(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology2.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := technology2.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
List(form.Status, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -168,7 +168,7 @@ func (a *Technology) InstanceAdd(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Form(&technology2.InstanceParams{
|
||||
PatentID: form.PatentID, Territory: form.Territory, Title: form.Title, Company: form.Company,
|
||||
Images: form.FilterImageURL(), ProveImages: form.FilterProveImages(), Introduce: form.Introduce, Purpose: form.Purpose,
|
||||
@ -187,7 +187,7 @@ func (a *Technology) InstanceEdit(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Form(&technology2.InstanceParams{
|
||||
ID: form.Convert(),
|
||||
PatentID: form.PatentID, Territory: form.Territory, Title: form.Title, Company: form.Company,
|
||||
@ -207,7 +207,7 @@ func (a *Technology) InstanceShelf(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Shelf(form.Convert(), form.Status)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -219,7 +219,7 @@ func (a *Technology) InstanceDelete(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -233,7 +233,7 @@ func (a *Technology) Paper(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology2.NewPaper()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := technology2.NewPaper()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
List(form.Title, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -245,7 +245,7 @@ func (a *Technology) PaperAdd(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewPaper()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewPaper()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Form(&technology2.PaperParams{
|
||||
Title: form.Title, Ext: form.Ext, Author: form.Author, PublishAt: form.PublishAt,
|
||||
Keywords: form.Keywords, Tags: form.Tags, Remark: form.Remark,
|
||||
@ -262,7 +262,7 @@ func (a *Technology) PaperEdit(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewPaper()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewPaper()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Form(&technology2.PaperParams{
|
||||
ID: form.Convert(), Title: form.Title, Ext: form.Ext, Author: form.Author, PublishAt: form.PublishAt,
|
||||
Keywords: form.Keywords, Tags: form.Tags, Remark: form.Remark,
|
||||
@ -277,7 +277,7 @@ func (a *Technology) PaperDelete(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewPaper()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewPaper()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -295,7 +295,7 @@ func (a *Technology) Patent(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology2.NewPatent()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := technology2.NewPatent()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
List(form.Kind, form.Title, form.ApplyCode, form.OpenCode, form.IPCCode, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -307,7 +307,7 @@ func (a *Technology) PatentDetail(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology2.NewPatent()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := technology2.NewPatent()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Detail(form.Convert())
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -319,7 +319,7 @@ func (a *Technology) PatentAdd(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewPatent()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewPatent()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Form(&technology2.PatentParams{Kind: form.Kind, Title: form.Title, FileUrl: (&api.FileForm{File: form.FileUrl}).FilterURL(),
|
||||
ApplyCode: form.ApplyCode, ApplyName: form.ApplyName, ApplyAddress: form.ApplyAddress, ApplyAt: form.ApplyAt,
|
||||
OpenCode: form.OpenCode, OpenAt: form.OpenAt, Inventor: form.Inventor, IPCCode: form.IPCCode,
|
||||
@ -337,7 +337,7 @@ func (a *Technology) PatentEdit(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewPatent()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewPatent()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Form(&technology2.PatentParams{ID: form.Convert(), Kind: form.Kind, Title: form.Title,
|
||||
FileUrl: (&api.FileForm{File: form.FileUrl}).FilterURL(), ApplyCode: form.ApplyCode,
|
||||
ApplyName: form.ApplyName, ApplyAddress: form.ApplyAddress, ApplyAt: form.ApplyAt, OpenCode: form.OpenCode,
|
||||
@ -354,7 +354,7 @@ func (a *Technology) PatentDelete(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewPatent()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewPatent()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -368,7 +368,7 @@ func (a *Technology) Demand(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology2.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := technology2.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
List(form.Status, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -380,7 +380,7 @@ func (a *Technology) DemandDetail(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology2.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := technology2.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Detail(form.Convert())
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -392,7 +392,7 @@ func (a *Technology) DemandAdd(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Form(&technology2.DemandParams{
|
||||
Title: form.Title, Introduce: form.Introduce, Name: form.Name, Mobile: form.Mobile, Deadline: form.Deadline,
|
||||
Industry: form.Industry, Kinds: form.Kinds, Budget: form.Budget, BudgetMode: form.BudgetMode,
|
||||
@ -414,7 +414,7 @@ func (a *Technology) DemandEdit(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Form(&technology2.DemandParams{
|
||||
ID: form.Convert(), Title: form.Title, Introduce: form.Introduce, Name: form.Name, Mobile: form.Mobile, Deadline: form.Deadline,
|
||||
Industry: form.Industry, Kinds: form.Kinds, Budget: form.Budget, BudgetMode: form.BudgetMode,
|
||||
@ -434,7 +434,7 @@ func (a *Technology) DemandDelete(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewDemand()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -448,7 +448,7 @@ func (a *Technology) Topic(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology2.NewTopic()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := technology2.NewTopic()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
List(form.Status, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -460,7 +460,7 @@ func (a *Technology) TopicDetail(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology2.NewTopic()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := technology2.NewTopic()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Detail(form.Convert())
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -472,7 +472,7 @@ func (a *Technology) TopicAdd(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewTopic()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewTopic()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Form(&technology2.TopicParams{Title: form.Title, Emcee: form.Emcee, Mechanism: form.Mechanism, Code: form.Code,
|
||||
BeginAt: form.BeginAt, FinishAt: form.FinishAt, Amount: form.Amount, Source: form.Source, Kind: form.Kind,
|
||||
Keywords: form.Keywords})
|
||||
@ -488,7 +488,7 @@ func (a *Technology) TopicEdit(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewTopic()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewTopic()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Form(&technology2.TopicParams{ID: form.Convert(), Title: form.Title, Emcee: form.Emcee, Mechanism: form.Mechanism,
|
||||
Code: form.Code, BeginAt: form.BeginAt, FinishAt: form.FinishAt, Amount: form.Amount, Source: form.Source,
|
||||
Kind: form.Kind, Keywords: form.Keywords})
|
||||
@ -502,7 +502,7 @@ func (a *Technology) TopicDelete(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewTopic()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewTopic()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -517,7 +517,7 @@ func (*Technology) Product(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology2.NewProduct()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := technology2.NewProduct()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Instance(form.Title, form.Status, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -531,7 +531,7 @@ func (*Technology) ProductVisit(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology2.NewProduct()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := technology2.NewProduct()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Visit(form.Convert(), form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -543,7 +543,7 @@ func (*Technology) ProductAdd(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewProduct()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewProduct()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Form(&technology2.ProductParams{
|
||||
Title: form.Title, Image: form.FilterImageURL(), Video: form.FilterVideo(),
|
||||
Material: form.FilterMaterial(), Introduce: form.Introduce, Industrys: form.Industrys,
|
||||
@ -562,7 +562,7 @@ func (*Technology) ProductEdit(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewProduct()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewProduct()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Form(&technology2.ProductParams{
|
||||
ID: form.Convert(), Title: form.Title, Image: form.FilterImageURL(), Video: form.FilterVideo(),
|
||||
Material: form.FilterMaterial(), Introduce: form.Introduce, Industrys: form.Industrys,
|
||||
@ -581,7 +581,7 @@ func (*Technology) ProductShelf(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewProduct()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewProduct()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Shelf(form.Convert(), form.Status)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -593,7 +593,7 @@ func (*Technology) ProductDelete(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewProduct()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewProduct()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -607,7 +607,7 @@ func (a *Technology) Project(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology2.NewProject()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := technology2.NewProject()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
List(form.Title, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -619,7 +619,7 @@ func (a *Technology) ProjectAdd(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewProject()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewProject()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Form(&technology2.ProjectParams{
|
||||
Title: form.Title, Kind: form.Kind, Source: form.Source, Director: form.Director,
|
||||
BeginAt: form.BeginAt, FinishAt: form.FinishAt, Amount: form.Amount, Role: form.Role,
|
||||
@ -636,7 +636,7 @@ func (a *Technology) ProjectEdit(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewProject()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewProject()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Form(&technology2.ProjectParams{ID: form.Convert(),
|
||||
Title: form.Title, Kind: form.Kind, Source: form.Source, Director: form.Director,
|
||||
BeginAt: form.BeginAt, FinishAt: form.FinishAt, Amount: form.Amount, Role: form.Role,
|
||||
@ -653,7 +653,7 @@ func (*Technology) ProjectShelf(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewProject()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewProject()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Shelf(form.Convert(), form.Status)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -665,7 +665,7 @@ func (a *Technology) ProjectDelete(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewProject()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewProject()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -679,7 +679,7 @@ func (*Technology) Achievement(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
data, err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
data, err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Instance(form.Status, form.Page, form.PageSize)
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
@ -691,7 +691,7 @@ func (*Technology) AchievementAdd(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Form(&technology2.AchievementParams{Mode: form.Mode,
|
||||
Title: form.Title, Image: form.FilterImageURL(), File: form.FilterFile(),
|
||||
Introduce: form.Introduce, Industrys: form.Industrys,
|
||||
@ -710,7 +710,7 @@ func (*Technology) AchievementEdit(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Form(&technology2.AchievementParams{ID: form.Convert(), Mode: form.Mode,
|
||||
Title: form.Title, Image: form.FilterImageURL(), File: form.FilterFile(),
|
||||
Introduce: form.Introduce, Industrys: form.Industrys,
|
||||
@ -729,7 +729,7 @@ func (*Technology) AchievementShelf(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Shelf(form.Convert(), form.Status)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
@ -741,7 +741,7 @@ func (*Technology) AchievementDelete(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(string)).
|
||||
err := technology2.NewAchievement()(api.GetSession()(c).(*session.Enterprise), api.GetTenantID()(c).(uint64)).
|
||||
Delete(form.Convert())
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
@ -11,10 +11,10 @@ import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Login struct{ local string }
|
||||
type Login struct{ tenantID uint64 }
|
||||
|
||||
type (
|
||||
LoginHandle func(local string) *Login
|
||||
LoginHandle func(tenantID uint64) *Login
|
||||
)
|
||||
|
||||
type (
|
||||
@ -41,12 +41,12 @@ const (
|
||||
LoginModeForQQ // QQ登陆
|
||||
)
|
||||
|
||||
var loginHandle = map[LoginMode]func(*LoginParams, string) (*InstanceLoginParams, error){
|
||||
var loginHandle = map[LoginMode]func(*LoginParams, uint64) (*InstanceLoginParams, error){
|
||||
LoginModeForSmsCaptcha: loginForSmsCaptcha, LoginModeForPassword: loginForPassword,
|
||||
}
|
||||
|
||||
// loginForSmsCaptcha 短信验证码登陆
|
||||
func loginForSmsCaptcha(params *LoginParams, local string) (*InstanceLoginParams, error) {
|
||||
func loginForSmsCaptcha(params *LoginParams, tenantID uint64) (*InstanceLoginParams, error) {
|
||||
if !utils.ValidateMobile(params.Captcha.Mobile) {
|
||||
return nil, errors.New("操作错误,手机号码格式异常")
|
||||
}
|
||||
@ -107,7 +107,7 @@ RETURNS:
|
||||
}
|
||||
|
||||
// loginForPassword 密码登陆
|
||||
func loginForPassword(params *LoginParams, local string) (*InstanceLoginParams, error) {
|
||||
func loginForPassword(params *LoginParams, tenantID uint64) (*InstanceLoginParams, error) {
|
||||
if !utils.ValidateMobile(params.Password.Account) {
|
||||
return nil, errors.New("操作错误,手机号码格式异常")
|
||||
}
|
||||
@ -156,7 +156,7 @@ func (c *Login) Launch(mode LoginMode, params *LoginParams) (*InstanceLoginRetur
|
||||
if !has {
|
||||
return nil, errors.New("操作错误,未知的登陆模式")
|
||||
}
|
||||
ret, err := _handle(params, c.local)
|
||||
ret, err := _handle(params, c.tenantID)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -168,7 +168,7 @@ func (c *Login) Launch(mode LoginMode, params *LoginParams) (*InstanceLoginRetur
|
||||
}
|
||||
|
||||
func NewLogin() LoginHandle {
|
||||
return func(local string) *Login {
|
||||
return &Login{local: local}
|
||||
return func(tenantID uint64) *Login {
|
||||
return &Login{tenantID: tenantID}
|
||||
}
|
||||
}
|
||||
|
@ -10,9 +10,9 @@ import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
type Register struct{ local string }
|
||||
type Register struct{ tenantID uint64 }
|
||||
|
||||
type RegisterHandle func(local string) *Register
|
||||
type RegisterHandle func(tenantID uint64) *Register
|
||||
|
||||
type (
|
||||
RegisterParams struct {
|
||||
@ -28,7 +28,7 @@ func (c *RegisterParams) checkCaptcha() (bool, error) {
|
||||
return handle.NewCaptcha().Validate(&handle.CaptchaSms{Captcha: c.Captcha, Mobile: c.Mobile})
|
||||
}
|
||||
|
||||
func (c *RegisterParams) checkUserExist(mUserInstance *model2.UserInstance, local string) (bool, error) {
|
||||
func (c *RegisterParams) checkUserExist(mUserInstance *model2.UserInstance, tenantID uint64) (bool, error) {
|
||||
var count int64
|
||||
|
||||
if err := model2.Count(mUserInstance, &count, model2.NewWhere("mobile", c.Mobile)); //model2.NewWhere("local", local)
|
||||
@ -55,7 +55,7 @@ func (c *Register) Launch(params *RegisterParams) (*InstanceLoginReturn, error)
|
||||
// 验证账号信息
|
||||
mUserInstance := model3.NewUserInstance()
|
||||
|
||||
if pass, err = params.checkUserExist(mUserInstance.UserInstance, c.local); err != nil {
|
||||
if pass, err = params.checkUserExist(mUserInstance.UserInstance, c.tenantID); err != nil {
|
||||
return nil, err
|
||||
} else if !pass {
|
||||
return nil, errors.New("当前手机号码已注册")
|
||||
@ -84,7 +84,7 @@ func (c *Register) Launch(params *RegisterParams) (*InstanceLoginReturn, error)
|
||||
}
|
||||
|
||||
func NewRegister() RegisterHandle {
|
||||
return func(local string) *Register {
|
||||
return &Register{local: local}
|
||||
return func(tenantID uint64) *Register {
|
||||
return &Register{tenantID: tenantID}
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,10 @@ import "SciencesServer/app/session"
|
||||
|
||||
type Instance struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type InstanceHandle func(session *session.Enterprise, local string) *Instance
|
||||
type InstanceHandle func(session *session.Enterprise, tenantID uint64) *Instance
|
||||
|
||||
type InstanceInfo struct {
|
||||
Currency float64 `json:"currency"`
|
||||
@ -18,7 +18,7 @@ func (c *Instance) Instance() (*InstanceInfo, error) {
|
||||
}
|
||||
|
||||
func NewInstance() InstanceHandle {
|
||||
return func(session *session.Enterprise, local string) *Instance {
|
||||
return &Instance{Enterprise: session, local: local}
|
||||
return func(session *session.Enterprise, tenantID uint64) *Instance {
|
||||
return &Instance{Enterprise: session, tenantID: tenantID}
|
||||
}
|
||||
}
|
||||
|
@ -11,10 +11,10 @@ import (
|
||||
// Enterprise 企业管理信息
|
||||
type Enterprise struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type EnterpriseHandle func(session *session.Enterprise, local string) *Enterprise
|
||||
type EnterpriseHandle func(session *session.Enterprise, tenantID uint64) *Enterprise
|
||||
|
||||
type (
|
||||
// EnterpriseInfo 企业信息
|
||||
@ -40,7 +40,7 @@ func (c *Enterprise) List(mode int, title string, page, pageSize int) (*controll
|
||||
|
||||
where := []*model2.ModelWhere{
|
||||
model2.NewWhere("mode", mode),
|
||||
model2.NewWhere("local", c.local),
|
||||
//model2.NewWhere("tenant_id", c.tenantID),
|
||||
model2.NewWhere("uid", c.UID),
|
||||
}
|
||||
if title != "" {
|
||||
@ -98,7 +98,7 @@ func (c *Enterprise) Form(params *EnterpriseParams) error {
|
||||
if mUserCooperateEnterprise.ID > 0 {
|
||||
return model2.Updates(mUserCooperateEnterprise.UserCooperateEnterprise, mUserCooperateEnterprise.UserCooperateEnterprise)
|
||||
}
|
||||
mUserCooperateEnterprise.Local.Local = c.local
|
||||
mUserCooperateEnterprise.TenantID = c.tenantID
|
||||
mUserCooperateEnterprise.UID = c.UID
|
||||
return model2.Create(mUserCooperateEnterprise.UserCooperateEnterprise)
|
||||
}
|
||||
@ -122,7 +122,7 @@ func (c *Enterprise) Delete(id uint64) error {
|
||||
}
|
||||
|
||||
func NewEnterprise() EnterpriseHandle {
|
||||
return func(session *session.Enterprise, local string) *Enterprise {
|
||||
return &Enterprise{Enterprise: session, local: local}
|
||||
return func(session *session.Enterprise, tenantID uint64) *Enterprise {
|
||||
return &Enterprise{Enterprise: session, tenantID: tenantID}
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
|
||||
type Demand struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type (
|
||||
@ -29,7 +29,7 @@ type (
|
||||
}
|
||||
)
|
||||
|
||||
type DemandHandle func(session *session.Enterprise, local string) *Demand
|
||||
type DemandHandle func(session *session.Enterprise, tenantID uint64) *Demand
|
||||
|
||||
// List 列表信息
|
||||
func (c *Demand) List(title string, status, page, pageSize int) (*controller.ReturnPages, error) {
|
||||
@ -37,7 +37,7 @@ func (c *Demand) List(title string, status, page, pageSize int) (*controller.Ret
|
||||
|
||||
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{Where: model2.NewWhere("uid", c.UID)},
|
||||
@ -116,7 +116,7 @@ func (c *Demand) Form(params *DemandParams) error {
|
||||
|
||||
return model2.Updates(mServiceDemand.ServiceDemand, mServiceDemand.ServiceDemand)
|
||||
}
|
||||
mServiceDemand.Local.Local = c.local
|
||||
mServiceDemand.TenantID = c.tenantID
|
||||
mServiceDemand.UID = c.UID
|
||||
|
||||
if params.IsSubmit > 0 {
|
||||
@ -141,10 +141,10 @@ func (c *Demand) Delete(id uint64) error {
|
||||
}
|
||||
|
||||
func NewDemand() DemandHandle {
|
||||
return func(session *session.Enterprise, local string) *Demand {
|
||||
return func(session *session.Enterprise, tenantID uint64) *Demand {
|
||||
return &Demand{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
tenantID: tenantID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,10 +10,10 @@ import (
|
||||
// Instance 首页信息
|
||||
type Instance struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type InstanceHandle func(session *session.Enterprise, local string) *Instance
|
||||
type InstanceHandle func(session *session.Enterprise, tenantID uint64) *Instance
|
||||
|
||||
type InstanceInfo struct {
|
||||
Identity int `json:"identity"` // 所有身份
|
||||
@ -97,7 +97,7 @@ func (c *Instance) Index() (*InstanceInfo, error) {
|
||||
}
|
||||
|
||||
func NewInstance() InstanceHandle {
|
||||
return func(session *session.Enterprise, local string) *Instance {
|
||||
return &Instance{Enterprise: session, local: local}
|
||||
return func(session *session.Enterprise, tenantID uint64) *Instance {
|
||||
return &Instance{Enterprise: session, tenantID: tenantID}
|
||||
}
|
||||
}
|
||||
|
@ -15,10 +15,10 @@ import (
|
||||
// Achievement 成果信息
|
||||
type Achievement struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type AchievementHandle func(session *session.Enterprise, local string) *Achievement
|
||||
type AchievementHandle func(session *session.Enterprise, tenantID uint64) *Achievement
|
||||
|
||||
type (
|
||||
// AchievementInfo 成果信息
|
||||
@ -183,7 +183,7 @@ func (c *Achievement) Form(params *AchievementParams) error {
|
||||
mTechnologyAchievement.Status = model2.TechnologyAchievementStatusForExamining
|
||||
return model2.Updates(mTechnologyAchievement.TechnologyAchievement, mTechnologyAchievement.TechnologyAchievement)
|
||||
}
|
||||
mTechnologyAchievement.Local.Local = c.local
|
||||
mTechnologyAchievement.TenantID = c.tenantID
|
||||
mTechnologyAchievement.UID = c.UID
|
||||
|
||||
if params.IsSubmit > 0 {
|
||||
@ -231,10 +231,10 @@ func (c *Achievement) Delete(id uint64) error {
|
||||
}
|
||||
|
||||
func NewAchievement() AchievementHandle {
|
||||
return func(session *session.Enterprise, local string) *Achievement {
|
||||
return func(session *session.Enterprise, tenantID uint64) *Achievement {
|
||||
return &Achievement{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
tenantID: tenantID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,10 +13,10 @@ import (
|
||||
// Demand 技术需求管理
|
||||
type Demand struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type DemandHandle func(session *session.Enterprise, local string) *Demand
|
||||
type DemandHandle func(session *session.Enterprise, tenantID uint64) *Demand
|
||||
|
||||
type (
|
||||
// DemandInfo 需求信息
|
||||
@ -149,7 +149,7 @@ func (c *Demand) Form(params *DemandParams) error {
|
||||
return model2.Updates(mTechnologyDemand.TechnologyDemand, mTechnologyDemand.TechnologyDemand)
|
||||
}
|
||||
mTechnologyDemand.UID = c.UID
|
||||
mTechnologyDemand.Local.Local = c.local
|
||||
mTechnologyDemand.TenantID = c.tenantID
|
||||
|
||||
if params.IsSubmit > 0 {
|
||||
mTechnologyDemand.Status = model2.TechnologyDemandStatusForExamining
|
||||
@ -178,7 +178,7 @@ func (c *Demand) Delete(id uint64) error {
|
||||
}
|
||||
|
||||
func NewDemand() DemandHandle {
|
||||
return func(session *session.Enterprise, local string) *Demand {
|
||||
return &Demand{Enterprise: session, local: local}
|
||||
return func(session *session.Enterprise, tenantID uint64) *Demand {
|
||||
return &Demand{Enterprise: session, tenantID: tenantID}
|
||||
}
|
||||
}
|
||||
|
@ -13,10 +13,10 @@ import (
|
||||
// Instance 技术管理
|
||||
type Instance struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type InstanceHandle func(session *session.Enterprise, local string) *Instance
|
||||
type InstanceHandle func(session *session.Enterprise, tenantID uint64) *Instance
|
||||
|
||||
type (
|
||||
// InstanceInfo 详细信息
|
||||
@ -108,7 +108,7 @@ func (c *Instance) Form(params *InstanceParams) error {
|
||||
return model2.Updates(mTechnologyInstance.TechnologyInstance, mTechnologyInstance.TechnologyInstance)
|
||||
}
|
||||
mTechnologyInstance.UID = c.UID
|
||||
mTechnologyInstance.Local.Local = c.local
|
||||
mTechnologyInstance.TenantID = c.tenantID
|
||||
|
||||
if params.IsSubmit > 0 {
|
||||
mTechnologyInstance.Status = model2.TechnologyInstanceStatusForExamining
|
||||
@ -161,7 +161,7 @@ func (c *Instance) Delete(id uint64) error {
|
||||
}
|
||||
|
||||
func NewInstance() InstanceHandle {
|
||||
return func(session *session.Enterprise, local string) *Instance {
|
||||
return &Instance{Enterprise: session, local: local}
|
||||
return func(session *session.Enterprise, tenantID uint64) *Instance {
|
||||
return &Instance{Enterprise: session, tenantID: tenantID}
|
||||
}
|
||||
}
|
||||
|
@ -13,10 +13,10 @@ import (
|
||||
// Paper 论文管理
|
||||
type Paper struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type PaperHandle func(session *session.Enterprise, local string) *Paper
|
||||
type PaperHandle func(session *session.Enterprise, tenantID uint64) *Paper
|
||||
|
||||
type (
|
||||
PaperInfo struct {
|
||||
@ -38,7 +38,7 @@ func (c *Paper) List(title string, page, pageSize int) (*controller.ReturnPages,
|
||||
where := []*model2.ModelWhereOrder{&model2.ModelWhereOrder{
|
||||
Order: model2.NewOrder("id", model2.OrderModeToDesc),
|
||||
}, &model2.ModelWhereOrder{
|
||||
Where: model2.NewWhere("local", c.local),
|
||||
Where: model2.NewWhere("tenant_id", c.tenantID),
|
||||
}}
|
||||
if title != "" {
|
||||
where = append(where, &model2.ModelWhereOrder{Where: model2.NewWhereLike("title", title)})
|
||||
@ -83,7 +83,7 @@ func (c *Paper) Form(params *PaperParams) error {
|
||||
|
||||
if params.ID <= 0 {
|
||||
mTechnologyPaper.UID = c.UID
|
||||
mTechnologyPaper.Local.Local = c.local
|
||||
mTechnologyPaper.TenantID = c.tenantID
|
||||
return model2.Create(mTechnologyPaper.TechnologyPaper)
|
||||
}
|
||||
mTechnologyPaper.UpdatedAt = time.Now()
|
||||
@ -111,7 +111,7 @@ func (c *Paper) Delete(id uint64) error {
|
||||
}
|
||||
|
||||
func NewPaper() PaperHandle {
|
||||
return func(session *session.Enterprise, local string) *Paper {
|
||||
return &Paper{Enterprise: session, local: local}
|
||||
return func(session *session.Enterprise, tenantID uint64) *Paper {
|
||||
return &Paper{Enterprise: session, tenantID: tenantID}
|
||||
}
|
||||
}
|
||||
|
@ -17,10 +17,10 @@ import (
|
||||
// Patent 专利管理
|
||||
type Patent struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type PatentHandle func(session *session.Enterprise, local string) *Patent
|
||||
type PatentHandle func(session *session.Enterprise, tenantID uint64) *Patent
|
||||
|
||||
type (
|
||||
// PatentInfo 专利信息
|
||||
@ -55,7 +55,7 @@ type (
|
||||
)
|
||||
|
||||
// add 新增专利信息
|
||||
func (c *PatentParams) add(uid uint64) error {
|
||||
func (c *PatentParams) add(tenantID, uid uint64) error {
|
||||
mSysPatent := model.NewSysPatent()
|
||||
isExist, err := mSysPatent.IsExistParams(map[string]interface{}{
|
||||
"apply_code": c.ApplyCode, "open_code": c.OpenCode,
|
||||
@ -67,6 +67,7 @@ func (c *PatentParams) add(uid uint64) error {
|
||||
}
|
||||
return orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
mSysPatent.Kind = model2.SysParentKind(c.Kind)
|
||||
mSysPatent.TenantID = tenantID
|
||||
mSysPatent.Title = c.Title
|
||||
mSysPatent.FileUrl = c.FileUrl
|
||||
mSysPatent.ApplyCode = c.ApplyCode
|
||||
@ -258,7 +259,7 @@ func (c *Patent) Form(params *PatentParams) error {
|
||||
if params.ID > 0 {
|
||||
return params.edit(c.UID)
|
||||
}
|
||||
return params.add(c.UID)
|
||||
return params.add(c.tenantID, c.UID)
|
||||
|
||||
}
|
||||
|
||||
@ -310,7 +311,7 @@ func (c *Patent) Delete(id uint64) error {
|
||||
}
|
||||
|
||||
func NewPatent() PatentHandle {
|
||||
return func(session *session.Enterprise, local string) *Patent {
|
||||
return &Patent{Enterprise: session, local: local}
|
||||
return func(session *session.Enterprise, tenantID uint64) *Patent {
|
||||
return &Patent{Enterprise: session, tenantID: tenantID}
|
||||
}
|
||||
}
|
||||
|
@ -15,10 +15,10 @@ import (
|
||||
// Product 产品信息
|
||||
type Product struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type ProductHandle func(session *session.Enterprise, local string) *Product
|
||||
type ProductHandle func(session *session.Enterprise, tenantID uint64) *Product
|
||||
|
||||
type (
|
||||
// ProductInfo 产品信息
|
||||
@ -205,7 +205,7 @@ func (c *Product) Form(params *ProductParams) error {
|
||||
mTechnologyProduct.Status = model2.TechnologyProductStatusForExamining
|
||||
return model2.Updates(mTechnologyProduct.TechnologyProduct, mTechnologyProduct.TechnologyProduct)
|
||||
}
|
||||
mTechnologyProduct.Local.Local = c.local
|
||||
mTechnologyProduct.TenantID = c.tenantID
|
||||
mTechnologyProduct.UID = c.UID
|
||||
|
||||
if params.IsSubmit > 0 {
|
||||
@ -253,10 +253,10 @@ func (c *Product) Delete(id uint64) error {
|
||||
}
|
||||
|
||||
func NewProduct() ProductHandle {
|
||||
return func(session *session.Enterprise, local string) *Product {
|
||||
return func(session *session.Enterprise, tenantID uint64) *Product {
|
||||
return &Product{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
tenantID: tenantID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,10 +13,10 @@ import (
|
||||
// Project 项目列表
|
||||
type Project struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type ProjectHandle func(session *session.Enterprise, local string) *Project
|
||||
type ProjectHandle func(session *session.Enterprise, tenantID uint64) *Project
|
||||
|
||||
type (
|
||||
// ProjectInfo 产品信息
|
||||
@ -90,7 +90,7 @@ func (c *Project) Form(params *ProjectParams) error {
|
||||
if mTechnologyProject.ID > 0 {
|
||||
return model2.Updates(mTechnologyProject.TechnologyProject, mTechnologyProject.TechnologyProject)
|
||||
}
|
||||
mTechnologyProject.Local.Local = c.local
|
||||
mTechnologyProject.TenantID = c.tenantID
|
||||
mTechnologyProject.UID = c.UID
|
||||
return model2.Create(mTechnologyProject.TechnologyProject)
|
||||
}
|
||||
@ -135,7 +135,7 @@ func (c *Project) Delete(id uint64) error {
|
||||
}
|
||||
|
||||
func NewProject() ProjectHandle {
|
||||
return func(session *session.Enterprise, local string) *Project {
|
||||
return &Project{Enterprise: session, local: local}
|
||||
return func(session *session.Enterprise, tenantID uint64) *Project {
|
||||
return &Project{Enterprise: session, tenantID: tenantID}
|
||||
}
|
||||
}
|
||||
|
@ -12,10 +12,10 @@ import (
|
||||
|
||||
type Topic struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
tenantID uint64
|
||||
}
|
||||
|
||||
type TopicHandle func(session *session.Enterprise, local string) *Topic
|
||||
type TopicHandle func(session *session.Enterprise, tenantID uint64) *Topic
|
||||
|
||||
type (
|
||||
// TopicInfo 课题信息
|
||||
@ -122,7 +122,7 @@ func (c *Topic) Form(params *TopicParams) error {
|
||||
mTechnologyTopic.UpdatedAt = time.Now()
|
||||
return model2.Updates(mTechnologyTopic.TechnologyTopic, mTechnologyTopic.TechnologyTopic)
|
||||
}
|
||||
mTechnologyTopic.Local.Local = c.local
|
||||
mTechnologyTopic.TenantID = c.tenantID
|
||||
mTechnologyTopic.UID = c.UID
|
||||
return model2.Create(mTechnologyTopic.TechnologyTopic)
|
||||
}
|
||||
@ -145,10 +145,10 @@ func (c *Topic) Delete(id uint64) error {
|
||||
}
|
||||
|
||||
func NewTopic() TopicHandle {
|
||||
return func(session *session.Enterprise, local string) *Topic {
|
||||
return func(session *session.Enterprise, tenantID uint64) *Topic {
|
||||
return &Topic{
|
||||
Enterprise: session,
|
||||
local: local,
|
||||
tenantID: tenantID,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,10 +54,6 @@ func (m *Images) AnalysisSlice(domain string) string {
|
||||
return strings.Join(images, ",")
|
||||
}
|
||||
|
||||
type Local struct {
|
||||
Local string `gorm:"column:local;type:varchar(8);default:'';comment:数据位置来源" json:"-"`
|
||||
}
|
||||
|
||||
// AccountStatus 账号状态
|
||||
type AccountStatus struct {
|
||||
Status AccountStatusKind `gorm:"column:status;type:tinyint(1);default:1;comment:状态(1:启用,2:禁用)" json:"-"`
|
||||
|
@ -5,7 +5,7 @@ import "encoding/json"
|
||||
// ServiceDemand 服务需求数据模型
|
||||
type ServiceDemand struct {
|
||||
Model
|
||||
Local
|
||||
ModelTenant
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
Kind string `gorm:"column:kind;type:varchar(50);default:'';comment:需求类型" json:"kind"`
|
||||
Title string `gorm:"column:title;type:varchar(50);default:'';comment:需求名称" json:"title"`
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
// TechnologyAchievement 技术成果数据模型
|
||||
type TechnologyAchievement struct {
|
||||
Model
|
||||
Local
|
||||
ModelTenant
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
Mode TechnologyAchievementMode `gorm:"column:mode;type:tinyint(1);default:1;comment:成果模式" json:"mode"`
|
||||
Title string `gorm:"column:title;type:varchar(100);default:'';comment:成果名称" json:"title"`
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
// TechnologyDemand 技术需求数据模型
|
||||
type TechnologyDemand struct {
|
||||
Model
|
||||
Local
|
||||
ModelTenant
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
Title string `gorm:"column:title;type:varchar(50);default:'';comment:需求名称" json:"title"`
|
||||
Kind string `gorm:"column:kind;type:varchar(50);default:'';comment:需求类别" json:"-"`
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
// TechnologyInstance 技术文档数据模型
|
||||
type TechnologyInstance struct {
|
||||
Model
|
||||
Local
|
||||
ModelTenant
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
PatentID uint64 `gorm:"column:patent_id;type:int;default:0;comment:代表专利" json:"patent_id"`
|
||||
Title string `gorm:"column:title;type:varchar(30);default:'';comment:名称" json:"title"`
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
// TechnologyProduct 技术产品数据模型
|
||||
type TechnologyProduct struct {
|
||||
Model
|
||||
Local
|
||||
ModelTenant
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
Title string `gorm:"column:title;type:varchar(100);default:'';comment:产品名称" json:"title"`
|
||||
Image
|
||||
|
@ -5,7 +5,7 @@ import "time"
|
||||
// TechnologyProject 技术科研项目数据模型
|
||||
type TechnologyProject struct {
|
||||
Model
|
||||
Local
|
||||
ModelTenant
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
Kind string `gorm:"column:kind;type:varchar(100);default:'';comment:类型" json:"kind"`
|
||||
Role TechnologyProjectRole `gorm:"column:role;type:tinyint(1);default:1;comment:课题角色(1:承担单位,2:参与单位)" json:"role"`
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
// TechnologyTopic 技术课题数据模型
|
||||
type TechnologyTopic struct {
|
||||
Model
|
||||
Local
|
||||
ModelTenant
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
Title string `gorm:"column:title;type:varchar(100);default:'';comment:名称" json:"title"`
|
||||
Code string `gorm:"column:code;type:varchar(30);default:'';comment:编号" json:"code"`
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
// UserCooperateEnterprise 用户企业数据模型管理
|
||||
type UserCooperateEnterprise struct {
|
||||
Model
|
||||
Local
|
||||
ModelTenant
|
||||
UID uint64 `gorm:"column:uid;type:int;default:0;comment:用户uuid" json:"-"`
|
||||
Mode UserCooperateEnterpriseMode `gorm:"column:mode;type:int;default:0;comment:合作模式(1:已合作,2:想合作)" json:"mode"`
|
||||
Title string `gorm:"column:title;type:varchar(30);default:'';comment:企业名称" json:"title"`
|
||||
|
Reference in New Issue
Block a user