feat:完善信息
This commit is contained in:
@ -69,6 +69,7 @@ func (c *Paper) Form(params *PaperParams) error {
|
||||
return errors.New("无权限操作")
|
||||
}
|
||||
}
|
||||
mTechnologyPaper.UID = c.UID
|
||||
mTechnologyPaper.Title = params.Title
|
||||
mTechnologyPaper.Ext = params.Ext
|
||||
mTechnologyPaper.Author = params.Author
|
||||
|
1
app/enterprise/controller/tenant/instance.go
Normal file
1
app/enterprise/controller/tenant/instance.go
Normal file
@ -0,0 +1 @@
|
||||
package tenant
|
98
app/enterprise/controller/tenant/settled.go
Normal file
98
app/enterprise/controller/tenant/settled.go
Normal file
@ -0,0 +1,98 @@
|
||||
package tenant
|
||||
|
||||
import (
|
||||
"SciencesServer/app/basic/config"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/enterprise/model"
|
||||
"SciencesServer/app/service"
|
||||
"errors"
|
||||
)
|
||||
|
||||
// Settled 入驻
|
||||
type Settled struct{ *service.SessionEnterprise }
|
||||
|
||||
type SettledHandle func(enterprise *service.SessionEnterprise) *Settled
|
||||
|
||||
type SettledParams struct {
|
||||
ID uint64
|
||||
Image string // logo图片
|
||||
Name string // 名称
|
||||
Code string // 唯一编码
|
||||
config.Area
|
||||
Introduce string `json:"introduce"`
|
||||
}
|
||||
|
||||
func (c *SettledParams) effect(uid uint64, iModel model2.IModel) error {
|
||||
if c.ID <= 0 {
|
||||
var count int64
|
||||
|
||||
if err := model2.Count(iModel, &count, model2.NewWhere("uid", uid)); err != nil {
|
||||
return err
|
||||
} else if count > 0 {
|
||||
return errors.New("无权限操作,当前身份下已含有申请入驻信息")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
if isExist, err := model2.FirstField(iModel, []string{"id", "uid", "status"}, model2.NewWhere("id", c.ID)); err != nil {
|
||||
return err
|
||||
} else if !isExist {
|
||||
return errors.New("无权限操作,未知的入驻信息")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Company 公司企业
|
||||
func (c *Settled) Company(params *SettledParams, other *config.IdentityForCompany) error {
|
||||
mManageCompany := model.NewManageCompany()
|
||||
|
||||
err := params.effect(c.UID, mManageCompany.ManageCompany)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
mManageCompany.Name = params.Name
|
||||
mManageCompany.Code = params.Code
|
||||
mManageCompany.Image = model2.Image{Image: params.Image}
|
||||
mManageCompany.Area = model2.Area{
|
||||
Province: params.Area.Province, City: params.Area.City, District: params.Area.District, Address: params.Area.Address,
|
||||
}
|
||||
mManageCompany.Industry = other.Industry
|
||||
mManageCompany.SetKeywordAttribute(other.Keywords)
|
||||
mManageCompany.Introduce = params.Introduce
|
||||
|
||||
if mManageCompany.ID <= 0 {
|
||||
return model2.Create(mManageCompany.ManageCompany)
|
||||
}
|
||||
if mManageCompany.UID != c.UID {
|
||||
return errors.New("异常,无权限操作")
|
||||
} else if mManageCompany.Status != model2.ExamineStatusForRefuse {
|
||||
return errors.New("操作错误,不允许操作")
|
||||
}
|
||||
return model2.Updates(mManageCompany.ManageCompany, mManageCompany.ManageCompany)
|
||||
}
|
||||
|
||||
// Expert 专家
|
||||
func (c *Settled) Expert() {
|
||||
|
||||
}
|
||||
|
||||
// Research 研究机构
|
||||
func (c *Settled) Research() {
|
||||
|
||||
}
|
||||
|
||||
// Laboratory 实验室
|
||||
func (c *Settled) Laboratory() {
|
||||
|
||||
}
|
||||
|
||||
// Agent 经纪人
|
||||
func (c *Settled) Agent() {
|
||||
|
||||
}
|
||||
|
||||
func NewSettled() SettledHandle {
|
||||
return func(enterprise *service.SessionEnterprise) *Settled {
|
||||
return &Settled{enterprise}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user