feat:完善入驻信息管理

This commit is contained in:
henry
2021-12-02 09:06:15 +08:00
parent 88077da6f0
commit 30173f8dd2
3 changed files with 141 additions and 1 deletions

View File

@ -10,6 +10,7 @@ import (
"SciencesServer/utils"
"errors"
"gorm.io/gorm"
"time"
)
// Settled 入驻
@ -76,7 +77,7 @@ func (c *Settled) filter(identity int, where ...*model2.ModelWhere) (bool, error
return true, err
}
if count >= int64(mSysIdentity.RegisterCount) {
return true, errors.New("操作错误,已超过当前身份最大注册人数")
return true, errors.New("操作错误,已超过当前身份最大入驻人数")
}
return mSysIdentity.IsExamine == model2.SysIdentityExamineForYes, nil
}
@ -124,7 +125,14 @@ func (c *Settled) Company(params *SettledParams, inviterID uint64, other *config
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 {
return err
}
mUserCompany.UID = c.UID
mUserCompany.CompanyID = mManageCompany.ID
return model2.Create(mUserCompany.UserCompany, tx)