refactor(env): centralize app environment detection

This commit is contained in:
2026-06-17 15:31:15 +08:00
parent 977c0905bd
commit a6ee0d5e24
4 changed files with 40 additions and 20 deletions
+3 -3
View File
@@ -6,7 +6,7 @@ import {
type GuestChatQuotaInput,
type GuestChatQuotaData,
} from "@/data/schemas/chat/guest_chat_quota";
import { isProduction } from "@/utils/app-env";
import { AppEnvUtil } from "@/utils/app-env";
export class GuestChatQuota {
// 静态常量
@@ -45,7 +45,7 @@ export class GuestChatQuota {
* 获取当前环境的每日最大配额
*/
static get threshold(): number {
return isProduction()
return AppEnvUtil.isProduction()
? GuestChatQuota.maxQuotaPerDay
: GuestChatQuota.maxQuotaPerDayTest;
}
@@ -54,7 +54,7 @@ export class GuestChatQuota {
* 获取当前环境的总配额默认值
*/
static get totalQuotaDefault(): number {
return isProduction()
return AppEnvUtil.isProduction()
? GuestChatQuota.defaultTotalQuota
: GuestChatQuota.defaultTotalQuotaTest;
}