feat:完善入驻信息管理
This commit is contained in:
@ -2,12 +2,10 @@ package user
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/model"
|
||||
model3 "SciencesServer/app/api/manage/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
"SciencesServer/serve/orm"
|
||||
"SciencesServer/utils"
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
@ -139,104 +137,105 @@ func (c *Settled) Company(params *SettledParams, inviterID uint64, other *config
|
||||
})
|
||||
}
|
||||
|
||||
// Expert 专家
|
||||
func (c *Settled) Expert(params *SettledParams, other *config.IdentityForExpert) error {
|
||||
mManageExpert := model3.NewManageExpert()
|
||||
|
||||
err := params.effect(c.UID, mManageExpert.ManageExpert)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
mManageExpert.Area = model2.Area{
|
||||
Province: params.Area.Province, City: params.Area.City, District: params.Area.District, Address: params.Area.Address,
|
||||
}
|
||||
mManageExpert.SetIndustryAttribute(params.Industrys)
|
||||
mManageExpert.SetKeywordAttribute(params.Keywords)
|
||||
mManageExpert.Introduce = params.Introduce
|
||||
mManageExpert.Position = utils.AnyToJSON(model2.Position{Longitude: other.Longitude, Latitude: other.Latitude})
|
||||
mManageExpert.School = other.School
|
||||
mManageExpert.Major = other.Major
|
||||
mManageExpert.Job = other.Job
|
||||
mManageExpert.Title = other.Title
|
||||
mManageExpert.WorkAt = utils.DataTimeToDate(other.WorkAt)
|
||||
mManageExpert.Research = utils.AnyToJSON(other.Research)
|
||||
|
||||
if mManageExpert.ID <= 0 {
|
||||
mManageExpert.UID = c.UID
|
||||
return model2.Create(mManageExpert.ManageExpert)
|
||||
}
|
||||
if !params.pass(c.UID, mManageExpert.UID, mManageExpert.Status) {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
}
|
||||
mManageExpert.Status = model2.ExamineStatusForOngoing
|
||||
return model2.Updates(mManageExpert.ManageExpert, mManageExpert.ManageExpert)
|
||||
}
|
||||
|
||||
// Research 研究机构
|
||||
func (c *Settled) Research(params *SettledParams, other *config.IdentityForResearch) error {
|
||||
mManageResearch := model3.NewManageResearch()
|
||||
|
||||
err := params.effect(c.UID, mManageResearch.ManageResearch)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
mManageResearch.Area = model2.Area{
|
||||
Province: params.Area.Province, City: params.Area.City, District: params.Area.District, Address: params.Area.Address,
|
||||
}
|
||||
mManageResearch.Industry = params.Industrys
|
||||
mManageResearch.SetKeywordAttribute(params.Keywords)
|
||||
mManageResearch.Introduce = params.Introduce
|
||||
mManageResearch.Position = utils.AnyToJSON(model2.Position{Longitude: other.Longitude, Latitude: other.Latitude})
|
||||
mManageResearch.Research = other.Research
|
||||
|
||||
if mManageResearch.ID <= 0 {
|
||||
mManageResearch.UID = c.UID
|
||||
return model2.Create(mManageResearch.ManageResearch)
|
||||
}
|
||||
if !params.pass(c.UID, mManageResearch.UID, mManageResearch.Status) {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
}
|
||||
mManageResearch.Status = model2.ExamineStatusForOngoing
|
||||
return model2.Updates(mManageResearch.ManageResearch, mManageResearch.ManageResearch)
|
||||
}
|
||||
|
||||
// Laboratory 实验室
|
||||
func (c *Settled) Laboratory(params *SettledParams, other *config.IdentityForLaboratory) error {
|
||||
mManageLaboratory := model3.NewManageLaboratory()
|
||||
|
||||
err := params.effect(c.UID, mManageLaboratory.ManageLaboratory)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
mManageLaboratory.Name = params.Name
|
||||
mManageLaboratory.Code = params.Code
|
||||
mManageLaboratory.Area = model2.Area{
|
||||
Province: params.Area.Province, City: params.Area.City, District: params.Area.District, Address: params.Area.Address,
|
||||
}
|
||||
mManageLaboratory.Industry = params.Industrys
|
||||
mManageLaboratory.SetKeywordAttribute(params.Keywords)
|
||||
mManageLaboratory.Introduce = params.Introduce
|
||||
mManageLaboratory.Position = utils.AnyToJSON(model2.Position{Longitude: other.Longitude, Latitude: other.Latitude})
|
||||
mManageLaboratory.Research = utils.AnyToJSON(other.Research)
|
||||
|
||||
if mManageLaboratory.ID <= 0 {
|
||||
mManageLaboratory.UID = c.UID
|
||||
return model2.Create(mManageLaboratory.ManageLaboratory)
|
||||
}
|
||||
if !params.pass(c.UID, mManageLaboratory.UID, mManageLaboratory.Status) {
|
||||
return errors.New("操作错误,无权限操作")
|
||||
}
|
||||
mManageLaboratory.Status = model2.ExamineStatusForOngoing
|
||||
return model2.Updates(mManageLaboratory.ManageLaboratory, mManageLaboratory.ManageLaboratory)
|
||||
}
|
||||
|
||||
// Agent 经纪人
|
||||
func (c *Settled) Agent(params *SettledParams) error {
|
||||
return nil
|
||||
}
|
||||
//
|
||||
//// Expert 专家
|
||||
//func (c *Settled) Expert(params *SettledParams, other *config.IdentityForExpert) error {
|
||||
// mManageExpert := model3.NewManageExpert()
|
||||
//
|
||||
// err := params.effect(c.UID, mManageExpert.ManageExpert)
|
||||
//
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// mManageExpert.Area = model2.Area{
|
||||
// Province: params.Area.Province, City: params.Area.City, District: params.Area.District, Address: params.Area.Address,
|
||||
// }
|
||||
// mManageExpert.SetIndustryAttribute(params.Industrys)
|
||||
// mManageExpert.SetKeywordAttribute(params.Keywords)
|
||||
// mManageExpert.Introduce = params.Introduce
|
||||
// mManageExpert.Position = utils.AnyToJSON(model2.Position{Longitude: other.Longitude, Latitude: other.Latitude})
|
||||
// mManageExpert.School = other.School
|
||||
// mManageExpert.Major = other.Major
|
||||
// mManageExpert.Job = other.Job
|
||||
// mManageExpert.Title = other.Title
|
||||
// mManageExpert.WorkAt = utils.DataTimeToDate(other.WorkAt)
|
||||
// mManageExpert.Research = utils.AnyToJSON(other.Research)
|
||||
//
|
||||
// if mManageExpert.ID <= 0 {
|
||||
// mManageExpert.UID = c.UID
|
||||
// return model2.Create(mManageExpert.ManageExpert)
|
||||
// }
|
||||
// if !params.pass(c.UID, mManageExpert.UID, mManageExpert.Status) {
|
||||
// return errors.New("操作错误,无权限操作")
|
||||
// }
|
||||
// mManageExpert.Status = model2.ExamineStatusForOngoing
|
||||
// return model2.Updates(mManageExpert.ManageExpert, mManageExpert.ManageExpert)
|
||||
//}
|
||||
//
|
||||
//// Research 研究机构
|
||||
//func (c *Settled) Research(params *SettledParams, other *config.IdentityForResearch) error {
|
||||
// mManageResearch := model3.NewManageResearch()
|
||||
//
|
||||
// err := params.effect(c.UID, mManageResearch.ManageResearch)
|
||||
//
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// mManageResearch.Area = model2.Area{
|
||||
// Province: params.Area.Province, City: params.Area.City, District: params.Area.District, Address: params.Area.Address,
|
||||
// }
|
||||
// mManageResearch.Industry = params.Industrys
|
||||
// mManageResearch.SetKeywordAttribute(params.Keywords)
|
||||
// mManageResearch.Introduce = params.Introduce
|
||||
// mManageResearch.Position = utils.AnyToJSON(model2.Position{Longitude: other.Longitude, Latitude: other.Latitude})
|
||||
// mManageResearch.Research = other.Research
|
||||
//
|
||||
// if mManageResearch.ID <= 0 {
|
||||
// mManageResearch.UID = c.UID
|
||||
// return model2.Create(mManageResearch.ManageResearch)
|
||||
// }
|
||||
// if !params.pass(c.UID, mManageResearch.UID, mManageResearch.Status) {
|
||||
// return errors.New("操作错误,无权限操作")
|
||||
// }
|
||||
// mManageResearch.Status = model2.ExamineStatusForOngoing
|
||||
// return model2.Updates(mManageResearch.ManageResearch, mManageResearch.ManageResearch)
|
||||
//}
|
||||
//
|
||||
//// Laboratory 实验室
|
||||
//func (c *Settled) Laboratory(params *SettledParams, other *config.IdentityForLaboratory) error {
|
||||
// mManageLaboratory := model3.NewManageLaboratory()
|
||||
//
|
||||
// err := params.effect(c.UID, mManageLaboratory.ManageLaboratory)
|
||||
//
|
||||
// if err != nil {
|
||||
// return err
|
||||
// }
|
||||
// mManageLaboratory.Name = params.Name
|
||||
// mManageLaboratory.Code = params.Code
|
||||
// mManageLaboratory.Area = model2.Area{
|
||||
// Province: params.Area.Province, City: params.Area.City, District: params.Area.District, Address: params.Area.Address,
|
||||
// }
|
||||
// mManageLaboratory.Industry = params.Industrys
|
||||
// mManageLaboratory.SetKeywordAttribute(params.Keywords)
|
||||
// mManageLaboratory.Introduce = params.Introduce
|
||||
// mManageLaboratory.Position = utils.AnyToJSON(model2.Position{Longitude: other.Longitude, Latitude: other.Latitude})
|
||||
// mManageLaboratory.Research = utils.AnyToJSON(other.Research)
|
||||
//
|
||||
// if mManageLaboratory.ID <= 0 {
|
||||
// mManageLaboratory.UID = c.UID
|
||||
// return model2.Create(mManageLaboratory.ManageLaboratory)
|
||||
// }
|
||||
// if !params.pass(c.UID, mManageLaboratory.UID, mManageLaboratory.Status) {
|
||||
// return errors.New("操作错误,无权限操作")
|
||||
// }
|
||||
// mManageLaboratory.Status = model2.ExamineStatusForOngoing
|
||||
// return model2.Updates(mManageLaboratory.ManageLaboratory, mManageLaboratory.ManageLaboratory)
|
||||
//}
|
||||
//
|
||||
//// Agent 经纪人
|
||||
//func (c *Settled) Agent(params *SettledParams) error {
|
||||
// return nil
|
||||
//}
|
||||
|
||||
func NewSettled() SettledHandle {
|
||||
return func(session *session.Enterprise, local string) *Settled {
|
||||
|
Reference in New Issue
Block a user