feat:完善入驻信息管理
This commit is contained in:
23
app/api/enterprise/api/settled.go
Normal file
23
app/api/enterprise/api/settled.go
Normal file
@ -0,0 +1,23 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/controller/settled"
|
||||
"SciencesServer/app/basic/api"
|
||||
"SciencesServer/app/session"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
type Settled struct{}
|
||||
|
||||
func (*Settled) Index(c *gin.Context) {
|
||||
settled.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).Index()
|
||||
}
|
||||
|
||||
func (*Settled) Company(c *gin.Context) {
|
||||
settled.NewCompany()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Launch(nil, 0, nil)
|
||||
}
|
||||
|
||||
func (*Settled) Expert(c *gin.Context) {
|
||||
|
||||
}
|
@ -49,85 +49,85 @@ func (*User) BindMobile(c *gin.Context) {
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*User) SettledCompany(c *gin.Context) {
|
||||
form := &struct {
|
||||
InviteCode string `json:"invite_code" form:"invite_code"`
|
||||
userSettledForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user.NewSettled()(api.GetSession()(c).(*session.Enterprise)).Company(&user.SettledParams{
|
||||
Image: form.FilterImageURL(), Name: form.Name, Code: form.Code,
|
||||
Area: form.Area, Introduce: form.Introduce, Industrys: form.Industrys, Keywords: form.Keywords,
|
||||
}, (&api.IDStringForm{ID: form.InviteCode}).Convert(), nil)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*User) SettledExpert(c *gin.Context) {
|
||||
form := &struct {
|
||||
userSettledForm
|
||||
config.IdentityForExpert
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user.NewSettled()(api.GetSession()(c).(*session.Enterprise)).Expert(&user.SettledParams{
|
||||
Area: form.Area, Introduce: form.Introduce, Industrys: form.Industrys,
|
||||
Keywords: form.Keywords,
|
||||
}, &form.IdentityForExpert)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*User) SettledResearch(c *gin.Context) {
|
||||
form := &struct {
|
||||
userSettledForm
|
||||
config.IdentityForResearch
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user.NewSettled()(api.GetSession()(c).(*session.Enterprise)).Research(&user.SettledParams{
|
||||
Image: form.FilterImageURL(), Name: form.Name, Code: form.Code,
|
||||
Area: form.Area, Introduce: form.Introduce, Industrys: form.Industrys, Keywords: form.Keywords,
|
||||
}, &form.IdentityForResearch)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*User) SettledLaboratory(c *gin.Context) {
|
||||
form := &struct {
|
||||
userSettledForm
|
||||
config.IdentityForLaboratory
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user.NewSettled()(api.GetSession()(c).(*session.Enterprise)).Laboratory(&user.SettledParams{
|
||||
Image: form.FilterImageURL(), Name: form.Name, Code: form.Code,
|
||||
Area: form.Area, Introduce: form.Introduce, Industrys: form.Industrys, Keywords: form.Keywords,
|
||||
}, &form.IdentityForLaboratory)
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
|
||||
func (*User) SettledAgent(c *gin.Context) {
|
||||
form := &struct {
|
||||
api.IDStringForm
|
||||
userSettledForm
|
||||
}{}
|
||||
if err := api.Bind(form)(c); err != nil {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
err := user.NewSettled()(api.GetSession()(c).(*session.Enterprise)).Agent(&user.SettledParams{
|
||||
ID: form.Convert(), Image: form.FilterImageURL(), Name: form.Name, Code: form.Code,
|
||||
Area: form.Area, Introduce: form.Introduce, Industrys: form.Industrys, Keywords: form.Keywords,
|
||||
})
|
||||
api.APIResponse(err)(c)
|
||||
}
|
||||
//func (*User) SettledCompany(c *gin.Context) {
|
||||
// form := &struct {
|
||||
// InviteCode string `json:"invite_code" form:"invite_code"`
|
||||
// userSettledForm
|
||||
// }{}
|
||||
// if err := api.Bind(form)(c); err != nil {
|
||||
// api.APIFailure(err.(error))(c)
|
||||
// return
|
||||
// }
|
||||
// err := user.NewSettled()(api.GetSession()(c).(*session.Enterprise)).Company(&user.SettledParams{
|
||||
// Image: form.FilterImageURL(), Name: form.Name, Code: form.Code,
|
||||
// Area: form.Area, Introduce: form.Introduce, Industrys: form.Industrys, Keywords: form.Keywords,
|
||||
// }, (&api.IDStringForm{ID: form.InviteCode}).Convert(), nil)
|
||||
// api.APIResponse(err)(c)
|
||||
//}
|
||||
//
|
||||
//func (*User) SettledExpert(c *gin.Context) {
|
||||
// form := &struct {
|
||||
// userSettledForm
|
||||
// config.IdentityForExpert
|
||||
// }{}
|
||||
// if err := api.Bind(form)(c); err != nil {
|
||||
// api.APIFailure(err.(error))(c)
|
||||
// return
|
||||
// }
|
||||
// err := user.NewSettled()(api.GetSession()(c).(*session.Enterprise)).Expert(&user.SettledParams{
|
||||
// Area: form.Area, Introduce: form.Introduce, Industrys: form.Industrys,
|
||||
// Keywords: form.Keywords,
|
||||
// }, &form.IdentityForExpert)
|
||||
// api.APIResponse(err)(c)
|
||||
//}
|
||||
//
|
||||
//func (*User) SettledResearch(c *gin.Context) {
|
||||
// form := &struct {
|
||||
// userSettledForm
|
||||
// config.IdentityForResearch
|
||||
// }{}
|
||||
// if err := api.Bind(form)(c); err != nil {
|
||||
// api.APIFailure(err.(error))(c)
|
||||
// return
|
||||
// }
|
||||
// err := user.NewSettled()(api.GetSession()(c).(*session.Enterprise)).Research(&user.SettledParams{
|
||||
// Image: form.FilterImageURL(), Name: form.Name, Code: form.Code,
|
||||
// Area: form.Area, Introduce: form.Introduce, Industrys: form.Industrys, Keywords: form.Keywords,
|
||||
// }, &form.IdentityForResearch)
|
||||
// api.APIResponse(err)(c)
|
||||
//}
|
||||
//
|
||||
//func (*User) SettledLaboratory(c *gin.Context) {
|
||||
// form := &struct {
|
||||
// userSettledForm
|
||||
// config.IdentityForLaboratory
|
||||
// }{}
|
||||
// if err := api.Bind(form)(c); err != nil {
|
||||
// api.APIFailure(err.(error))(c)
|
||||
// return
|
||||
// }
|
||||
// err := user.NewSettled()(api.GetSession()(c).(*session.Enterprise)).Laboratory(&user.SettledParams{
|
||||
// Image: form.FilterImageURL(), Name: form.Name, Code: form.Code,
|
||||
// Area: form.Area, Introduce: form.Introduce, Industrys: form.Industrys, Keywords: form.Keywords,
|
||||
// }, &form.IdentityForLaboratory)
|
||||
// api.APIResponse(err)(c)
|
||||
//}
|
||||
//
|
||||
//func (*User) SettledAgent(c *gin.Context) {
|
||||
// form := &struct {
|
||||
// api.IDStringForm
|
||||
// userSettledForm
|
||||
// }{}
|
||||
// if err := api.Bind(form)(c); err != nil {
|
||||
// api.APIFailure(err.(error))(c)
|
||||
// return
|
||||
// }
|
||||
// err := user.NewSettled()(api.GetSession()(c).(*session.Enterprise)).Agent(&user.SettledParams{
|
||||
// ID: form.Convert(), Image: form.FilterImageURL(), Name: form.Name, Code: form.Code,
|
||||
// Area: form.Area, Introduce: form.Introduce, Industrys: form.Industrys, Keywords: form.Keywords,
|
||||
// })
|
||||
// api.APIResponse(err)(c)
|
||||
//}
|
||||
|
||||
func (*User) IdentityBasic(c *gin.Context) {
|
||||
data, err := user.NewIdentity()(api.GetSession()(c).(*session.Enterprise)).Basic()
|
||||
|
@ -4,23 +4,31 @@ import (
|
||||
"SciencesServer/app/api/enterprise/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
)
|
||||
|
||||
// TODO:入驻流程
|
||||
// 2021-12-02
|
||||
// 一:
|
||||
|
||||
// BasicParams 基本信息
|
||||
type BasicParams struct {
|
||||
ID uint64
|
||||
Name, Image, Code, Introduce string
|
||||
config.Area
|
||||
Industrys, Keywords []string
|
||||
}
|
||||
|
||||
// filter 筛选信息
|
||||
func (c *BasicParams) filter(identity int, where ...*model2.ModelWhere) (bool, error) {
|
||||
func (c *BasicParams) filter(identity int, where ...*model2.ModelWhere) error {
|
||||
mSysIdentity := model.NewSysIdentity()
|
||||
_, err := model2.FirstField(mSysIdentity.SysIdentity, []string{"id", "register_count", "is_examine"}, model2.NewWhere("identity", identity))
|
||||
_, err := model2.FirstField(mSysIdentity.SysIdentity, []string{"id", "register_count"}, model2.NewWhere("identity", identity))
|
||||
|
||||
if err != nil {
|
||||
return true, err
|
||||
return err
|
||||
}
|
||||
var iModel model2.IModel
|
||||
|
||||
@ -40,10 +48,34 @@ func (c *BasicParams) filter(identity int, where ...*model2.ModelWhere) (bool, e
|
||||
where = append(where, model2.NewWhere("status", model2.InvalidStatusForNot))
|
||||
|
||||
if err = model2.Count(iModel, &count, where...); err != nil {
|
||||
return true, err
|
||||
return err
|
||||
}
|
||||
if count >= int64(mSysIdentity.RegisterCount) {
|
||||
return true, errors.New("操作错误,已超过当前身份最大入驻人数")
|
||||
return errors.New("操作错误,已超过当前身份最大入驻人数")
|
||||
}
|
||||
return mSysIdentity.IsExamine == model2.SysIdentityExamineForYes, nil
|
||||
return nil
|
||||
}
|
||||
|
||||
// fillIdentity 填充身份信息
|
||||
func (c *BasicParams) fillIdentity(tx *gorm.DB, session *session.Enterprise, identity int) error {
|
||||
if session.SelectIdentity <= 0 {
|
||||
session.SelectIdentity = identity
|
||||
}
|
||||
session.Identity = session.Identity | identity
|
||||
|
||||
mUserInstance := model.NewUserInstance()
|
||||
|
||||
err := model2.UpdatesWhere(mUserInstance.UserInstance, map[string]interface{}{
|
||||
"identity": session.Identity, "updated_at": time.Now(),
|
||||
}, []*model2.ModelWhere{model2.NewWhere("uuid", session.UID)}, tx)
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
mUserIdentity := model.NewUserIdentity()
|
||||
mUserIdentity.UID = session.UID
|
||||
mUserIdentity.Name = session.Name
|
||||
mUserIdentity.Identity = identity
|
||||
|
||||
return model2.Create(mUserIdentity.UserIdentity)
|
||||
}
|
||||
|
@ -6,10 +6,12 @@ import (
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
"SciencesServer/serve/orm"
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Company 公司企业入驻信息
|
||||
type Company struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
@ -17,24 +19,33 @@ type Company struct {
|
||||
|
||||
type CompanyHandle func(session *session.Enterprise, local string) *Company
|
||||
|
||||
func (c *Company) Launch() {
|
||||
// Launch 发起入驻
|
||||
func (c *Company) Launch(params *BasicParams, inviterID uint64, other *config.IdentityForCompany) error {
|
||||
if c.Identity&config.TenantUserIdentityForCompany > 0 {
|
||||
return errors.New("操作错误,不可重复申请入驻")
|
||||
}
|
||||
mManageCompany := model.NewManageCompany()
|
||||
|
||||
// 查询相应的企业入驻信息
|
||||
isExist, err := model2.FirstField(mManageCompany.ManageCompany, []string{"id", "status"},
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local),
|
||||
model2.NewWhere("status", model2.ExamineStatusForRefuse))
|
||||
model2.NewWhere("code", params.Code), model2.NewWhere("local", c.local))
|
||||
|
||||
isExamine := true
|
||||
// 过滤用户其他公司入驻信息
|
||||
mUserCompany := model.NewUserCompany()
|
||||
|
||||
if err != nil {
|
||||
return err
|
||||
} else if isExist {
|
||||
// 审核中
|
||||
if mManageCompany.Status == model2.ExamineStatusForOngoing {
|
||||
return errors.New("操作错误,当前企业信息审核中,不可入驻")
|
||||
return errors.New("操作错误,当前该企业信息审核中,不可入驻")
|
||||
}
|
||||
// 筛选企业条件
|
||||
if isExamine, err = c.filter(config.TenantUserIdentityForCompany, model2.NewWhere("company_id", mManageCompany.ID)); err != nil {
|
||||
return err
|
||||
// 审核通过
|
||||
if mManageCompany.Status == model2.ExamineStatusForAgree {
|
||||
// 筛选企业条件
|
||||
if err = params.filter(config.TenantUserIdentityForCompany,
|
||||
model2.NewWhere("company_id", mManageCompany.ID)); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
mManageCompany.Local.Local = c.local
|
||||
@ -50,18 +61,17 @@ func (c *Company) Launch() {
|
||||
mManageCompany.SetKeywordAttribute(params.Keywords)
|
||||
mManageCompany.Introduce = params.Introduce
|
||||
|
||||
if isExamine {
|
||||
mManageCompany.Status = model2.ExamineStatusForAgree
|
||||
}
|
||||
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 {
|
||||
return err
|
||||
}
|
||||
if mManageCompany.ID <= 0 {
|
||||
if err = model2.Create(mManageCompany.ManageCompany, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
// 过滤用户其他公司入驻信息
|
||||
mUserCompany := model.NewUserCompany()
|
||||
|
||||
if err := model2.UpdatesWhere(mUserCompany.UserCompany, map[string]interface{}{
|
||||
"status": model2.InvalidStatusForYes, "updated_at": time.Now(),
|
||||
}, []*model2.ModelWhere{model2.NewWhere("uid", c.UID)}, tx); err != nil {
|
||||
|
3
app/api/enterprise/controller/settled/expert.go
Normal file
3
app/api/enterprise/controller/settled/expert.go
Normal file
@ -0,0 +1,3 @@
|
||||
package settled
|
||||
|
||||
type Expert struct{}
|
20
app/api/enterprise/controller/settled/instance.go
Normal file
20
app/api/enterprise/controller/settled/instance.go
Normal file
@ -0,0 +1,20 @@
|
||||
package settled
|
||||
|
||||
import "SciencesServer/app/session"
|
||||
|
||||
type Instance struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
}
|
||||
|
||||
type InstanceHandle func(session *session.Enterprise, local string) *Instance
|
||||
|
||||
func (c *Instance) Index() {
|
||||
|
||||
}
|
||||
|
||||
func NewInstance() InstanceHandle {
|
||||
return func(session *session.Enterprise, local string) *Instance {
|
||||
return &Instance{Enterprise: session, local: local}
|
||||
}
|
||||
}
|
@ -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