在actions中添加权限
This commit is contained in:
1 parent
61451d149a
commit
abc8b271c4
4 files changed
+78
-3
No files matched your search
+6
-1
@@ -2,6 +2,7 @@ package models
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"gorm.io/gorm"
|
||||
"log"
|
||||
"strings"
|
||||
|
||||
@@ -224,7 +225,7 @@ func (e *SysUser) GetPage(pageSize int, pageIndex int) ([]SysUserPage, int, erro
|
||||
|
||||
var count int64
|
||||
|
||||
if err := table.Scopes(DataScopes(e.TableName(),userid)).Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Offset(-1).Limit(-1).Count(&count).Error; err != nil {
|
||||
if err := table.Scopes(DataScopes(e.TableName(), userid)).Offset((pageIndex - 1) * pageSize).Limit(pageSize).Find(&doc).Offset(-1).Limit(-1).Count(&count).Error; err != nil {
|
||||
return nil, 0, err
|
||||
}
|
||||
//table.Where("sys_user.deleted_at IS NULL").Count(&count)
|
||||
@@ -316,3 +317,7 @@ func (e *SysUser) SetPwd(pwd SysUserPwd) (Result bool, err error) {
|
||||
tools.HasError(err, "更新密码失败(代码202)", 500)
|
||||
return
|
||||
}
|
||||
|
||||
func (e *SysUser) GetByUserId(tx *gorm.DB, id interface{}) error {
|
||||
return tx.First(e, id).Error
|
||||
}
|
||||
Reference in new issue
Block a user