【优化】租户功能,框架优化

This commit is contained in:
PandaGoAdmin
2022-07-18 18:17:11 +08:00
parent d33bd39570
commit ae38e7bcef
60 changed files with 861 additions and 647 deletions

View File

@@ -5,9 +5,10 @@ type AppContext struct {
type LoginAccount struct {
UserId int64
TenantId int64
RoleId int64
DeptId int64
PostId int64
Username string
Rolename string
RoleKey string
}

View File

@@ -3,7 +3,7 @@ package model
import (
"fmt"
"pandax/base/biz"
"pandax/base/global"
"pandax/pkg/global"
"strconv"
"strings"
@@ -48,7 +48,9 @@ func (m *Model) SetBaseInfo(account *LoginAccount) {
func Tx(funcs ...func(db *gorm.DB) error) (err error) {
tx := global.Db.Begin()
defer func() {
if r := recover(); r != nil {
var err any
err = recover()
if err != nil {
tx.Rollback()
err = fmt.Errorf("%v", err)
}