refactor(env): centralize app environment detection
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user