feat: automate business upgrades and sync reviewed frontend
This commit is contained in:
@@ -19,7 +19,7 @@ var (
|
||||
ErrAccountExists = errors.BadRequest("SW_ACCOUNT_EXISTS", "登录账号已存在")
|
||||
ErrPhoneExists = errors.BadRequest("SW_PHONE_EXISTS", "手机号码已存在")
|
||||
ErrEmailExists = errors.BadRequest("SW_EMAIL_EXISTS", "邮箱账号已存在")
|
||||
ErrBusinessRole = errors.BadRequest("SW_BUSINESS_ROLE", "未找到对应层级的商务角色,请核对角色迁移映射")
|
||||
ErrBusinessRole = errors.BadRequest("SW_BUSINESS_ROLE", "商务等级对应的角色配置不完整")
|
||||
)
|
||||
|
||||
type Account struct {
|
||||
|
||||
@@ -37,7 +37,6 @@ type LedgerListOptions struct {
|
||||
type LedgerNames struct {
|
||||
PromoteID *int64
|
||||
PromoteAccount, BindingAccount, BindingUserName string
|
||||
BusinessPath []string
|
||||
}
|
||||
|
||||
func (n *LedgerNames) DisplayPromote() string {
|
||||
@@ -53,9 +52,6 @@ func (n *LedgerNames) DisplayPromote() string {
|
||||
return "未知渠道(ID:" + strconv.FormatInt(*n.PromoteID, 10) + ")"
|
||||
}
|
||||
func (n *LedgerNames) DisplayBusiness() string {
|
||||
if len(n.BusinessPath) > 0 {
|
||||
return strings.Join(n.BusinessPath, "→")
|
||||
}
|
||||
return (&Channel{BindingAccount: n.BindingAccount, BindingUserName: n.BindingUserName}).BusinessDisplayName()
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package system
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/go-kratos/kratos/v3/errors"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -32,6 +33,7 @@ type Authority struct {
|
||||
DeletedAt *time.Time
|
||||
AuthorityID uint
|
||||
AuthorityName string
|
||||
BusinessLevel *int
|
||||
ParentID *uint
|
||||
DataScope int
|
||||
DefaultRouter string
|
||||
@@ -39,6 +41,15 @@ type Authority struct {
|
||||
Menus []*Menu
|
||||
}
|
||||
|
||||
var ErrBusinessAuthorityProtected = errors.BadRequest("BUSINESS_AUTHORITY_PROTECTED", "商务内置角色不能删除")
|
||||
|
||||
func ValidateAuthorityDeletion(authority *Authority) error {
|
||||
if authority != nil && authority.BusinessLevel != nil {
|
||||
return ErrBusinessAuthorityProtected
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type AuthorityUsecase struct{ AuthorityAccessRepo }
|
||||
|
||||
func NewAuthorityUsecase(repo AuthorityAccessRepo) *AuthorityUsecase {
|
||||
|
||||
Reference in New Issue
Block a user