feat:完善入驻信息管理
This commit is contained in:
@ -10,12 +10,12 @@ type Config struct{}
|
||||
|
||||
func (a *Config) Identity(c *gin.Context) {
|
||||
data := config.NewConfig().Identity()
|
||||
api.APISuccess(data)
|
||||
api.APISuccess(data)(c)
|
||||
}
|
||||
|
||||
func (a *Config) Transaction(c *gin.Context) {
|
||||
data := config.NewConfig().Transaction()
|
||||
api.APISuccess(data)
|
||||
api.APISuccess(data)(c)
|
||||
}
|
||||
|
||||
func (a *Config) Industry(c *gin.Context) {
|
||||
|
@ -32,7 +32,8 @@ func (c *settledForm) bind() *settled.BasicParams {
|
||||
|
||||
// Index 入驻信息
|
||||
func (*Settled) Index(c *gin.Context) {
|
||||
settled.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).Index()
|
||||
data, err := settled.NewInstance()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).Index()
|
||||
api.APIResponse(err, data)(c)
|
||||
}
|
||||
|
||||
// Company 公司入驻信息
|
||||
@ -106,6 +107,17 @@ func (*Settled) Agent(c *gin.Context) {
|
||||
api.APIFailure(err.(error))(c)
|
||||
return
|
||||
}
|
||||
credentialImages := make([]string, 0)
|
||||
|
||||
for _, image := range form.CredentialImages {
|
||||
credentialImages = append(credentialImages, (&api.ImageForm{Image: image}).FilterImageURL())
|
||||
}
|
||||
|
||||
form.CredentialImages = credentialImages
|
||||
form.IDImage.Front = (&api.ImageForm{Image: form.IDImage.Front}).FilterImageURL()
|
||||
form.IDImage.Behind = (&api.ImageForm{Image: form.IDImage.Behind}).FilterImageURL()
|
||||
form.IDImage.Hold = (&api.ImageForm{Image: form.IDImage.Hold}).FilterImageURL()
|
||||
|
||||
err := settled.NewAgent()(api.GetSession()(c).(*session.Enterprise), api.GetLocal()(c).(string)).
|
||||
Launch(form.settledForm.bind(), &form.IdentityForAgent)
|
||||
api.APIResponse(err)(c)
|
||||
|
@ -53,6 +53,11 @@ func (c *Agent) Launch(params *BasicParams, other *config.IdentityForAgent) erro
|
||||
mManageAgent.Name = params.Name
|
||||
mManageAgent.Mobile = params.Mobile
|
||||
mManageAgent.IDCard = other.IDCard
|
||||
mManageAgent.SetIDImageAttribute(&model2.ManageAgentIDImage{
|
||||
Front: other.IDImage.Front,
|
||||
Behind: other.IDImage.Behind,
|
||||
Hold: other.IDImage.Hold,
|
||||
})
|
||||
mManageAgent.SetIndustryAttribute(params.Industrys)
|
||||
mManageAgent.SetKeywordAttribute(params.Keywords)
|
||||
mManageAgent.WorkExperience = other.WorkExperience
|
||||
|
@ -1,7 +1,13 @@
|
||||
package settled
|
||||
|
||||
import "SciencesServer/app/session"
|
||||
import (
|
||||
"SciencesServer/app/api/enterprise/model"
|
||||
"SciencesServer/app/basic/config"
|
||||
model2 "SciencesServer/app/common/model"
|
||||
"SciencesServer/app/session"
|
||||
)
|
||||
|
||||
// Instance 首页信息
|
||||
type Instance struct {
|
||||
*session.Enterprise
|
||||
local string
|
||||
@ -9,8 +15,77 @@ type Instance struct {
|
||||
|
||||
type InstanceHandle func(session *session.Enterprise, local string) *Instance
|
||||
|
||||
func (c *Instance) Index() {
|
||||
type InstanceInfo struct {
|
||||
Identity int `json:"identity"` // 所有身份
|
||||
ExamineIdentity map[int]model2.ExamineStatusKind `json:"examine_identity"` // 审核中信息
|
||||
SelectIdentity int `json:"select_identity"` // 当前选择的身份
|
||||
}
|
||||
|
||||
func (c *Instance) company() (bool, model2.ExamineStatusKind, error) {
|
||||
mUserCompany := model.NewUserCompany()
|
||||
out, err := mUserCompany.Company(c.UID)
|
||||
return out.ID > 0, out.ExamineStatus, err
|
||||
}
|
||||
|
||||
func (c *Instance) expert() (bool, model2.ExamineStatusKind, error) {
|
||||
mUserExpert := model.NewUserExpert()
|
||||
out, err := mUserExpert.Expert(c.UID)
|
||||
return out.ID > 0, out.ExamineStatus, err
|
||||
}
|
||||
|
||||
func (c *Instance) research() (bool, model2.ExamineStatusKind, error) {
|
||||
mUserResearch := model.NewUserResearch()
|
||||
out, err := mUserResearch.Research(c.UID)
|
||||
return out.ID > 0, out.ExamineStatus, err
|
||||
}
|
||||
|
||||
func (c *Instance) laboratory() (bool, model2.ExamineStatusKind, error) {
|
||||
mUserLaboratory := model.NewUserLaboratory()
|
||||
out, err := mUserLaboratory.Laboratory(c.UID)
|
||||
return out.ID > 0, out.ExamineStatus, err
|
||||
}
|
||||
|
||||
func (c *Instance) agent() (bool, model2.ExamineStatusKind, error) {
|
||||
mUserAgent := model.NewUserAgent()
|
||||
out, err := mUserAgent.Agent(c.UID)
|
||||
return out.ID > 0, out.ExamineStatus, err
|
||||
}
|
||||
|
||||
func (c *Instance) Index() (*InstanceInfo, error) {
|
||||
out := &InstanceInfo{
|
||||
Identity: c.Identity,
|
||||
ExamineIdentity: make(map[int]model2.ExamineStatusKind, 0),
|
||||
SelectIdentity: c.SelectIdentity,
|
||||
}
|
||||
isExist := false
|
||||
var kind model2.ExamineStatusKind
|
||||
var err error
|
||||
|
||||
// 查询其他信息
|
||||
for k := range config.TenantUserIdentityData {
|
||||
if k&c.SelectIdentity > 0 {
|
||||
continue
|
||||
}
|
||||
if k == config.TenantUserIdentityForCompany {
|
||||
isExist, kind, err = c.company()
|
||||
} else if k == config.TenantUserIdentityForExpert {
|
||||
isExist, kind, err = c.expert()
|
||||
} else if k == config.TenantUserIdentityForResearch {
|
||||
isExist, kind, err = c.research()
|
||||
} else if k == config.TenantUserIdentityForLaboratory {
|
||||
isExist, kind, err = c.laboratory()
|
||||
} else if k == config.TenantUserIdentityForAgent {
|
||||
isExist, kind, err = c.agent()
|
||||
}
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !isExist {
|
||||
continue
|
||||
}
|
||||
out.ExamineIdentity[k] = kind
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func NewInstance() InstanceHandle {
|
||||
|
@ -1,11 +1,27 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/app/common/model"
|
||||
import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type UserAgent struct {
|
||||
*model.UserAgent
|
||||
}
|
||||
|
||||
func (m *UserAgent) Agent(uid uint64) (*UserSettledInfo, error) {
|
||||
out := new(UserSettledInfo)
|
||||
|
||||
err := orm.GetDB().Table(m.TableName()+" AS u").
|
||||
Select("u.id", "c.examine_status").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS c ON u.agent_id = c.id", model.NewManageAgent().TableName())).
|
||||
Where("u.uid = ?", uid).
|
||||
Where("u.is_deleted = ? AND u.invalid_status = ?", model.DeleteStatusForNot, model.InvalidStatusForNot).
|
||||
Scan(out).Error
|
||||
return out, err
|
||||
}
|
||||
|
||||
func NewUserAgent() *UserAgent {
|
||||
return &UserAgent{model.NewUserAgent()}
|
||||
}
|
||||
|
@ -1,11 +1,33 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/app/common/model"
|
||||
import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type UserCompany struct {
|
||||
*model.UserCompany
|
||||
}
|
||||
|
||||
type UserSettledInfo struct {
|
||||
ID uint64 `json:"id"`
|
||||
model.Examine
|
||||
}
|
||||
|
||||
// Company 公司信息
|
||||
func (m *UserCompany) Company(uid uint64) (*UserSettledInfo, error) {
|
||||
out := new(UserSettledInfo)
|
||||
|
||||
err := orm.GetDB().Table(m.TableName()+" AS u").
|
||||
Select("u.id", "c.examine_status").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS c ON u.company_id = c.id", model.NewManageCompany().TableName())).
|
||||
Where("u.uid = ?", uid).
|
||||
Where("u.is_deleted = ? AND u.invalid_status = ?", model.DeleteStatusForNot, model.InvalidStatusForNot).
|
||||
Scan(out).Error
|
||||
return out, err
|
||||
}
|
||||
|
||||
func NewUserCompany() *UserCompany {
|
||||
return &UserCompany{model.NewUserCompany()}
|
||||
}
|
||||
|
@ -1,11 +1,27 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/app/common/model"
|
||||
import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type UserExpert struct {
|
||||
*model.UserExpert
|
||||
}
|
||||
|
||||
func (m *UserExpert) Expert(uid uint64) (*UserSettledInfo, error) {
|
||||
out := new(UserSettledInfo)
|
||||
|
||||
err := orm.GetDB().Table(m.TableName()+" AS u").
|
||||
Select("u.id", "c.examine_status").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS c ON u.expert_id = c.id", model.NewManageExpert().TableName())).
|
||||
Where("u.uid = ?", uid).
|
||||
Where("u.is_deleted = ? AND u.invalid_status = ?", model.DeleteStatusForNot, model.InvalidStatusForNot).
|
||||
Scan(out).Error
|
||||
return out, err
|
||||
}
|
||||
|
||||
func NewUserExpert() *UserExpert {
|
||||
return &UserExpert{model.NewUserExpert()}
|
||||
}
|
||||
|
@ -1,11 +1,27 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/app/common/model"
|
||||
import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type UserLaboratory struct {
|
||||
*model.UserLaboratory
|
||||
}
|
||||
|
||||
func (m *UserLaboratory) Laboratory(uid uint64) (*UserSettledInfo, error) {
|
||||
out := new(UserSettledInfo)
|
||||
|
||||
err := orm.GetDB().Table(m.TableName()+" AS u").
|
||||
Select("u.id", "c.examine_status").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS c ON u.laboratory_id = c.id", model.NewManageLaboratory().TableName())).
|
||||
Where("u.uid = ?", uid).
|
||||
Where("u.is_deleted = ? AND u.invalid_status = ?", model.DeleteStatusForNot, model.InvalidStatusForNot).
|
||||
Scan(out).Error
|
||||
return out, err
|
||||
}
|
||||
|
||||
func NewUserLaboratory() *UserLaboratory {
|
||||
return &UserLaboratory{model.NewUserLaboratory()}
|
||||
}
|
||||
|
@ -1,11 +1,27 @@
|
||||
package model
|
||||
|
||||
import "SciencesServer/app/common/model"
|
||||
import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type UserResearch struct {
|
||||
*model.UserResearch
|
||||
}
|
||||
|
||||
func (m *UserResearch) Research(uid uint64) (*UserSettledInfo, error) {
|
||||
out := new(UserSettledInfo)
|
||||
|
||||
err := orm.GetDB().Table(m.TableName()+" AS u").
|
||||
Select("u.id", "c.examine_status").
|
||||
Joins(fmt.Sprintf("LEFT JOIN %s AS c ON u.research_id = c.id", model.NewManageResearch().TableName())).
|
||||
Where("u.uid = ?", uid).
|
||||
Where("u.is_deleted = ? AND u.invalid_status = ?", model.DeleteStatusForNot, model.InvalidStatusForNot).
|
||||
Scan(out).Error
|
||||
return out, err
|
||||
}
|
||||
|
||||
func NewUserResearch() *UserResearch {
|
||||
return &UserResearch{model.NewUserResearch()}
|
||||
}
|
||||
|
Reference in New Issue
Block a user