feat:完善入驻信息管理
This commit is contained in:
@ -52,12 +52,12 @@ func (c *Identity) Switch(identity int) error {
|
||||
if c.SelectIdentity == identity {
|
||||
return nil
|
||||
}
|
||||
c.ManageUID = 0
|
||||
c.IdentityUID = 0
|
||||
// 已存在相应的身份,更新最后
|
||||
if c.Identity&identity > 0 {
|
||||
mUserIdentity := model.NewUserIdentity()
|
||||
// 查询用户身份
|
||||
isExist, err := model2.FirstField(mUserIdentity.UserIdentity, []string{"id", "tenant_id", "name", "uuid"},
|
||||
isExist, err := model2.FirstField(mUserIdentity.UserIdentity, []string{"id", "name", "uuid"},
|
||||
model2.NewWhere("uid", c.UID), model2.NewWhere("identity", identity))
|
||||
|
||||
if err != nil {
|
||||
@ -68,7 +68,7 @@ func (c *Identity) Switch(identity int) error {
|
||||
if err = orm.GetDB().Transaction(func(tx *gorm.DB) error {
|
||||
if err = model2.UpdatesWhere(mUserIdentity.UserIdentity, map[string]interface{}{
|
||||
"is_selected": model2.UserIdentitySelectedForNo, "updated_at": now,
|
||||
}, []*model2.ModelWhere{model2.NewWhere("uid", c.ManageUID)}, tx); err != nil {
|
||||
}, []*model2.ModelWhere{model2.NewWhere("uuid", c.IdentityUID)}, tx); err != nil {
|
||||
return err
|
||||
}
|
||||
return model2.Updates(mUserIdentity.UserIdentity, map[string]interface{}{
|
||||
@ -78,7 +78,7 @@ func (c *Identity) Switch(identity int) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
c.ManageUID = mUserIdentity.UUID
|
||||
c.IdentityUID = mUserIdentity.UUID
|
||||
c.SelectIdentity = identity
|
||||
service.Publish(config2.EventForAccountLoginProduce, config2.RedisKeyForAccount, c.UIDToString(), c.Enterprise)
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user