feat:完善项目信息
This commit is contained in:
@ -4,6 +4,7 @@ import (
|
||||
"SciencesServer/app/common/model"
|
||||
"SciencesServer/serve/orm"
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type SysMenu struct {
|
||||
@ -16,6 +17,10 @@ type SysMenuScene struct {
|
||||
SceneID uint64 `json:"scene_id"` // 场景(租户,角色)
|
||||
}
|
||||
|
||||
func (m *SysMenu) FilterAuth() string {
|
||||
return "/" + strings.ReplaceAll(m.Auth, ":", "/")
|
||||
}
|
||||
|
||||
// Recursion 递归查询子菜单
|
||||
func (m *SysMenu) Recursion(id uint64) {
|
||||
//SELECT
|
||||
|
@ -38,7 +38,8 @@ func (m *SysUser) GetByAccountOrMobile(account string, tenantID uint64) (bool, e
|
||||
db := orm.GetDB().Table(m.TableName()).
|
||||
Select("id", "uuid", "tenant_id", "name", "mobile", "password", "salt", "is_admin", "status").
|
||||
Where("tenant_id = ?", tenantID).
|
||||
Where("(account = ? OR mobile = ?)", account, account).
|
||||
//Where("(email = ? OR mobile = ?)", account, account).
|
||||
Where("mobile = ?", account).
|
||||
Where("is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
if err := db.First(m.SysUser).Error; err != nil {
|
||||
@ -50,6 +51,23 @@ func (m *SysUser) GetByAccountOrMobile(account string, tenantID uint64) (bool, e
|
||||
return true, nil
|
||||
}
|
||||
|
||||
func (m *SysUser) CheckByAccountOrMobile(account string, tenantID uint64) (bool, error) {
|
||||
db := orm.GetDB().Table(m.TableName()).
|
||||
Where("tenant_id = ?", tenantID).
|
||||
Where("(account = ? OR mobile = ?)", account, account).
|
||||
Where("is_deleted = ?", model.DeleteStatusForNot)
|
||||
|
||||
var count int64
|
||||
|
||||
if err := db.Count(&count).Error; err != nil {
|
||||
if errors.Is(err, gorm.ErrRecordNotFound) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
|
||||
// Users 用户信息
|
||||
func (m *SysUser) Users(page, pageSize int, count *int64, where ...*model.ModelWhere) ([]*SysUserInfo, error) {
|
||||
db := orm.GetDB().Table(m.TableName()+" AS u").
|
||||
|
Reference in New Issue
Block a user