a
This commit is contained in:
parent
18eeac233a
commit
c9120294c9
|
|
@ -359,7 +359,7 @@ const GlobalConfig = ({ currentUser }) => {
|
||||||
try {
|
try {
|
||||||
// 管理员全局配置:使用全局策略账号的配置,不依赖当前 account
|
// 管理员全局配置:使用全局策略账号的配置,不依赖当前 account
|
||||||
if (isAdmin && configMeta?.global_strategy_account_id) {
|
if (isAdmin && configMeta?.global_strategy_account_id) {
|
||||||
const globalAccountId = parseInt(String(configMeta.global_strategy_account_id), 10) || 1
|
const globalAccountId = parseInt(String(configMeta?.global_strategy_account_id || '1'), 10) || 1
|
||||||
const data = await api.getGlobalConfigs(globalAccountId)
|
const data = await api.getGlobalConfigs(globalAccountId)
|
||||||
setConfigs(data)
|
setConfigs(data)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -607,7 +607,7 @@ const GlobalConfig = ({ currentUser }) => {
|
||||||
// 管理员全局配置:应用到全局策略账号
|
// 管理员全局配置:应用到全局策略账号
|
||||||
let response
|
let response
|
||||||
if (isAdmin && configMeta?.global_strategy_account_id) {
|
if (isAdmin && configMeta?.global_strategy_account_id) {
|
||||||
const globalAccountId = parseInt(String(configMeta.global_strategy_account_id), 10) || 1
|
const globalAccountId = parseInt(String(configMeta?.global_strategy_account_id || '1'), 10) || 1
|
||||||
response = await api.updateGlobalConfigsBatch(configItems, globalAccountId)
|
response = await api.updateGlobalConfigsBatch(configItems, globalAccountId)
|
||||||
} else {
|
} else {
|
||||||
response = await api.updateConfigsBatch(configItems)
|
response = await api.updateConfigsBatch(configItems)
|
||||||
|
|
@ -653,7 +653,7 @@ const GlobalConfig = ({ currentUser }) => {
|
||||||
// 管理员全局配置:使用全局策略账号的配置
|
// 管理员全局配置:使用全局策略账号的配置
|
||||||
let data
|
let data
|
||||||
if (isAdmin && configMeta?.global_strategy_account_id) {
|
if (isAdmin && configMeta?.global_strategy_account_id) {
|
||||||
const globalAccountId = parseInt(String(configMeta.global_strategy_account_id), 10) || 1
|
const globalAccountId = parseInt(String(configMeta?.global_strategy_account_id || '1'), 10) || 1
|
||||||
data = await api.getGlobalConfigs(globalAccountId)
|
data = await api.getGlobalConfigs(globalAccountId)
|
||||||
} else {
|
} else {
|
||||||
data = await api.getConfigs()
|
data = await api.getConfigs()
|
||||||
|
|
@ -860,7 +860,7 @@ const GlobalConfig = ({ currentUser }) => {
|
||||||
|
|
||||||
// 简单计算:全局策略账号ID(在 render 时计算)
|
// 简单计算:全局策略账号ID(在 render 时计算)
|
||||||
const globalStrategyAccountId = configMeta?.global_strategy_account_id
|
const globalStrategyAccountId = configMeta?.global_strategy_account_id
|
||||||
? parseInt(String(configMeta.global_strategy_account_id), 10)
|
? parseInt(String(configMeta?.global_strategy_account_id || '1'), 10)
|
||||||
: 1
|
: 1
|
||||||
// 管理员全局配置页面:不依赖当前 account,直接管理全局策略账号
|
// 管理员全局配置页面:不依赖当前 account,直接管理全局策略账号
|
||||||
const isGlobalStrategyAccount = isAdmin
|
const isGlobalStrategyAccount = isAdmin
|
||||||
|
|
@ -1165,7 +1165,10 @@ const GlobalConfig = ({ currentUser }) => {
|
||||||
try {
|
try {
|
||||||
setSaving(true)
|
setSaving(true)
|
||||||
setMessage('')
|
setMessage('')
|
||||||
const globalAccountId = parseInt(String(configMeta.global_strategy_account_id), 10) || 1
|
// 检查 configMeta 是否存在,如果不存在则使用默认值 1
|
||||||
|
const globalAccountId = configMeta?.global_strategy_account_id
|
||||||
|
? parseInt(String(configMeta?.global_strategy_account_id || '1'), 10) || 1
|
||||||
|
: 1
|
||||||
await api.updateGlobalConfigsBatch([{
|
await api.updateGlobalConfigsBatch([{
|
||||||
key,
|
key,
|
||||||
value,
|
value,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user