Skip to content

Commit 9cd1bb7

Browse files
committed
feat(users): 用户详情展示 24h 分组消耗,并预填千人千面通知文案
使用日志/看板用户信息去掉分组倍率与千人千面配置展示,改为近 24 小时总消耗与按分组明细;千人千面保存时预填正式优惠说明。
1 parent c933900 commit 9cd1bb7

9 files changed

Lines changed: 328 additions & 132 deletions

File tree

web/default/src/features/usage-logs/components/dialogs/user-info-dialog.tsx

Lines changed: 182 additions & 125 deletions
Large diffs are not rendered by default.

web/default/src/features/users/components/dialogs/user-custom-pricing-dialog.tsx

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ type GroupRow = {
6565
ratio: number | null
6666
}
6767

68+
/** Default notice prefilled when enabling/saving 千人千面 preferential pricing. */
69+
const DEFAULT_CUSTOM_PRICING_NOTICE = [
70+
'您好,因您的日用量已达到优惠门槛,现已为您开通特惠分组倍率。',
71+
'该优惠与用量挂钩:维持或提升日用量,可继续享受更优费率;若用量持续处于较低水平,将可能调整回默认分组倍率。',
72+
'特惠倍率会根据上游成本动态调整,更新可能较为频繁,但在符合条件期间,费率始终优于普通用户分组。',
73+
'说明:并非所有分组都会开启特惠倍率,仅对本次为您配置的分组生效;未配置的分组仍按系统默认倍率计费。',
74+
].join('\n')
75+
6876
function buildGroupRows(detail: UserCustomPricingDetail | null): GroupRow[] {
6977
if (!detail) return []
7078
return Object.entries(detail.groups)
@@ -108,7 +116,7 @@ export function UserCustomPricingDialog(props: UserCustomPricingDialogProps) {
108116

109117
useEffect(() => {
110118
if (props.open && props.user) {
111-
setNoticeMessage('')
119+
setNoticeMessage(DEFAULT_CUSTOM_PRICING_NOTICE)
112120
fetchDetail()
113121
} else {
114122
setDetail(null)
@@ -349,17 +357,29 @@ export function UserCustomPricingDialog(props: UserCustomPricingDialogProps) {
349357
value={noticeMessage}
350358
onChange={(event) => setNoticeMessage(event.target.value)}
351359
disabled={busy}
352-
rows={3}
360+
rows={6}
353361
maxLength={2000}
354362
placeholder={t(
355363
'Optional. Explain why pricing changed, e.g. recharge milestone discount or daily usage threshold. Shown to the user on next login.'
356364
)}
357365
/>
358-
<p className='text-muted-foreground text-xs'>
359-
{t(
360-
'Every save will notify this user on next login with the new ratios and this note (if provided).'
361-
)}
362-
</p>
366+
<div className='flex flex-wrap items-center justify-between gap-2'>
367+
<p className='text-muted-foreground text-xs'>
368+
{t(
369+
'Every save will notify this user on next login with the new ratios and this note (if provided).'
370+
)}
371+
</p>
372+
<Button
373+
type='button'
374+
variant='ghost'
375+
size='sm'
376+
className='h-7 shrink-0 px-2 text-xs'
377+
disabled={busy}
378+
onClick={() => setNoticeMessage(DEFAULT_CUSTOM_PRICING_NOTICE)}
379+
>
380+
{t('Restore default notice')}
381+
</Button>
382+
</div>
363383
</div>
364384

365385
<div className='border-border overflow-hidden rounded-lg border'>

web/default/src/i18n/locales/en.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5241,11 +5241,28 @@
52415241
"No groups configured": "No groups configured",
52425242
"Copy username": "Copy username",
52435243
"View username, balance, and group ratio details for this user.": "View username, balance, and group ratio details for this user.",
5244+
"View username, balance, preferential group pricing, and recent usage by group.": "View username, balance, preferential group pricing, and recent usage by group.",
5245+
"View username, balance, and usage in the last 24 hours by group.": "View username, balance, and usage in the last 24 hours by group.",
52445246
"Group Ratios": "Group Ratios",
52455247
"Custom Pricing On": "Custom Pricing On",
5248+
"Custom Pricing Off": "Custom Pricing Off",
52465249
"System Defaults": "System Defaults",
52475250
"{{count}} overrides": "{{count}} overrides",
5251+
"{{count}} preferential groups": "{{count}} preferential groups",
52485252
"No group ratio data available": "No group ratio data available",
5253+
"No preferential groups configured for this user": "No preferential groups configured for this user",
5254+
"Only preferential groups are listed when custom pricing is on. Unconfigured groups use system defaults and are omitted here.": "Only preferential groups are listed when custom pricing is on. Unconfigured groups use system defaults and are omitted here.",
5255+
"Usage by group (last 7 days)": "Usage by group (last 7 days)",
5256+
"Usage in the last 24 hours": "Usage in the last 24 hours",
5257+
"Total consumption and breakdown by group for the past 24 hours.": "Total consumption and breakdown by group for the past 24 hours.",
5258+
"Last 24h Used Quota": "Last 24h Used Quota",
5259+
"Last 24h Requests": "Last 24h Requests",
5260+
"See which groups this user actually consumes — useful when enabling preferential ratios for specific groups.": "See which groups this user actually consumes — useful when enabling preferential ratios for specific groups.",
5261+
"No group usage in the last 7 days": "No group usage in the last 7 days",
5262+
"No usage in the last 24 hours": "No usage in the last 24 hours",
5263+
"Preferential Ratio": "Preferential Ratio",
5264+
"Preferential": "Preferential",
5265+
"Restore default notice": "Restore default notice",
52495266
"Click username to view details · copy supported": "Click username to view details · copy supported",
52505267
"View user details": "View user details",
52515268
"User not found": "User not found"

web/default/src/i18n/locales/fr.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5241,11 +5241,28 @@
52415241
"No groups configured": "Aucun groupe configuré",
52425242
"Copy username": "Copier le nom d'utilisateur",
52435243
"View username, balance, and group ratio details for this user.": "Voir le nom d'utilisateur, le solde et les détails des ratios de groupe de cet utilisateur.",
5244+
"View username, balance, preferential group pricing, and recent usage by group.": "Voir le nom d'utilisateur, le solde, les tarifs préférentiels par groupe et l'usage récent par groupe.",
5245+
"View username, balance, and usage in the last 24 hours by group.": "Voir le nom d'utilisateur, le solde et l'usage des 24 dernières heures par groupe.",
52445246
"Group Ratios": "Ratios de groupe",
52455247
"Custom Pricing On": "Tarification personnalisée activée",
5248+
"Custom Pricing Off": "Tarification personnalisée désactivée",
52465249
"System Defaults": "Valeurs système",
52475250
"{{count}} overrides": "{{count}} substitutions",
5251+
"{{count}} preferential groups": "{{count}} groupes préférentiels",
52485252
"No group ratio data available": "Aucune donnée de ratio de groupe",
5253+
"No preferential groups configured for this user": "Aucun groupe préférentiel configuré pour cet utilisateur",
5254+
"Only preferential groups are listed when custom pricing is on. Unconfigured groups use system defaults and are omitted here.": "Seuls les groupes préférentiels configurés s'affichent lorsque la tarification personnalisée est active. Les groupes non configurés utilisent les ratios système et sont omis ici.",
5255+
"Usage by group (last 7 days)": "Usage par groupe (7 derniers jours)",
5256+
"Usage in the last 24 hours": "Usage des 24 dernières heures",
5257+
"Total consumption and breakdown by group for the past 24 hours.": "Consommation totale et répartition par groupe sur les 24 dernières heures.",
5258+
"Last 24h Used Quota": "Quota consommé (24 h)",
5259+
"Last 24h Requests": "Requêtes (24 h)",
5260+
"See which groups this user actually consumes — useful when enabling preferential ratios for specific groups.": "Voyez dans quels groupes cet utilisateur consomme réellement — utile pour activer des ratios préférentiels ciblés.",
5261+
"No group usage in the last 7 days": "Aucun usage par groupe sur les 7 derniers jours",
5262+
"No usage in the last 24 hours": "Aucun usage sur les 24 dernières heures",
5263+
"Preferential Ratio": "Ratio préférentiel",
5264+
"Preferential": "Préférentiel",
5265+
"Restore default notice": "Restaurer le message par défaut",
52495266
"Click username to view details · copy supported": "Cliquez sur le nom pour les détails · copie possible",
52505267
"View user details": "Voir les détails de l'utilisateur",
52515268
"User not found": "Utilisateur introuvable"

web/default/src/i18n/locales/ja.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5241,11 +5241,28 @@
52415241
"No groups configured": "設定済みグループなし",
52425242
"Copy username": "ユーザー名をコピー",
52435243
"View username, balance, and group ratio details for this user.": "このユーザーのユーザー名、残高、グループ倍率の詳細を表示します。",
5244+
"View username, balance, preferential group pricing, and recent usage by group.": "このユーザーのユーザー名、残高、優遇グループ料金、および直近7日間のグループ別利用状況を表示します。",
5245+
"View username, balance, and usage in the last 24 hours by group.": "このユーザーのユーザー名、残高、および直近24時間のグループ別利用状況を表示します。",
52445246
"Group Ratios": "グループ倍率",
52455247
"Custom Pricing On": "個別料金 有効",
5248+
"Custom Pricing Off": "個別料金 無効",
52465249
"System Defaults": "システム既定",
52475250
"{{count}} overrides": "{{count}} 件の上書き",
5251+
"{{count}} preferential groups": "{{count}} 件の優遇グループ",
52485252
"No group ratio data available": "グループ倍率データがありません",
5253+
"No preferential groups configured for this user": "このユーザーに設定済みの優遇グループはありません",
5254+
"Only preferential groups are listed when custom pricing is on. Unconfigured groups use system defaults and are omitted here.": "個別料金が有効な場合、設定済みの優遇グループのみ表示します。未設定グループはシステム既定のままのため一覧に含めません。",
5255+
"Usage by group (last 7 days)": "直近7日間のグループ別利用",
5256+
"Usage in the last 24 hours": "直近24時間の利用",
5257+
"Total consumption and breakdown by group for the past 24 hours.": "直近24時間の総消費とグループ別内訳です。",
5258+
"Last 24h Used Quota": "直近24時間の消費枠",
5259+
"Last 24h Requests": "直近24時間のリクエスト数",
5260+
"See which groups this user actually consumes — useful when enabling preferential ratios for specific groups.": "実際にどのグループで消費しているかを確認し、特定グループへの優遇倍率設定に役立てられます。",
5261+
"No group usage in the last 7 days": "直近7日間のグループ別利用データはありません",
5262+
"No usage in the last 24 hours": "直近24時間の利用データはありません",
5263+
"Preferential Ratio": "優遇倍率",
5264+
"Preferential": "優遇",
5265+
"Restore default notice": "デフォルト通知文を復元",
52495266
"Click username to view details · copy supported": "ユーザー名をクリックして詳細を表示 · コピー可",
52505267
"View user details": "ユーザー詳細を表示",
52515268
"User not found": "ユーザーが見つかりません"

web/default/src/i18n/locales/ru.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5241,11 +5241,28 @@
52415241
"No groups configured": "Группы не настроены",
52425242
"Copy username": "Копировать имя пользователя",
52435243
"View username, balance, and group ratio details for this user.": "Просмотр имени пользователя, баланса и деталей групповых коэффициентов.",
5244+
"View username, balance, preferential group pricing, and recent usage by group.": "Просмотр имени пользователя, баланса, льготных групповых тарифов и недавнего расхода по группам.",
5245+
"View username, balance, and usage in the last 24 hours by group.": "Просмотр имени пользователя, баланса и расхода за последние 24 часа по группам.",
52445246
"Group Ratios": "Коэффициенты групп",
52455247
"Custom Pricing On": "Индивидуальные цены включены",
5248+
"Custom Pricing Off": "Индивидуальные цены выключены",
52465249
"System Defaults": "Системные значения",
52475250
"{{count}} overrides": "{{count}} переопределений",
5251+
"{{count}} preferential groups": "{{count}} льготных групп",
52485252
"No group ratio data available": "Нет данных о коэффициентах групп",
5253+
"No preferential groups configured for this user": "Для этого пользователя нет настроенных льготных групп",
5254+
"Only preferential groups are listed when custom pricing is on. Unconfigured groups use system defaults and are omitted here.": "При включённых индивидуальных ценах показываются только настроенные льготные группы. Ненастроенные группы используют системные коэффициенты и здесь не перечисляются.",
5255+
"Usage by group (last 7 days)": "Расход по группам (за 7 дней)",
5256+
"Usage in the last 24 hours": "Расход за последние 24 часа",
5257+
"Total consumption and breakdown by group for the past 24 hours.": "Общий расход и разбивка по группам за последние 24 часа.",
5258+
"Last 24h Used Quota": "Расход за 24 ч",
5259+
"Last 24h Requests": "Запросы за 24 ч",
5260+
"See which groups this user actually consumes — useful when enabling preferential ratios for specific groups.": "Смотрите, в каких группах пользователь реально расходует квоту — удобно при включении льготных коэффициентов для отдельных групп.",
5261+
"No group usage in the last 7 days": "Нет расхода по группам за последние 7 дней",
5262+
"No usage in the last 24 hours": "Нет расхода за последние 24 часа",
5263+
"Preferential Ratio": "Льготный коэффициент",
5264+
"Preferential": "Льготный",
5265+
"Restore default notice": "Восстановить текст уведомления по умолчанию",
52495266
"Click username to view details · copy supported": "Нажмите имя для деталей · можно копировать",
52505267
"View user details": "Просмотр сведений о пользователе",
52515268
"User not found": "Пользователь не найден"

web/default/src/i18n/locales/vi.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5241,11 +5241,28 @@
52415241
"No groups configured": "Chưa cấu hình nhóm nào",
52425242
"Copy username": "Sao chép tên người dùng",
52435243
"View username, balance, and group ratio details for this user.": "Xem tên người dùng, số dư và chi tiết hệ số nhóm của người dùng này.",
5244+
"View username, balance, preferential group pricing, and recent usage by group.": "Xem tên người dùng, số dư, giá ưu đãi theo nhóm và mức tiêu thụ gần đây theo nhóm.",
5245+
"View username, balance, and usage in the last 24 hours by group.": "Xem tên người dùng, số dư và mức tiêu thụ 24 giờ qua theo nhóm.",
52445246
"Group Ratios": "Hệ số nhóm",
52455247
"Custom Pricing On": "Giá tùy chỉnh đang bật",
5248+
"Custom Pricing Off": "Giá tùy chỉnh đang tắt",
52465249
"System Defaults": "Mặc định hệ thống",
52475250
"{{count}} overrides": "{{count}} ghi đè",
5251+
"{{count}} preferential groups": "{{count}} nhóm ưu đãi",
52485252
"No group ratio data available": "Không có dữ liệu hệ số nhóm",
5253+
"No preferential groups configured for this user": "Người dùng này chưa có nhóm ưu đãi nào được cấu hình",
5254+
"Only preferential groups are listed when custom pricing is on. Unconfigured groups use system defaults and are omitted here.": "Khi bật giá tùy chỉnh, chỉ liệt kê các nhóm ưu đãi đã cấu hình. Nhóm chưa cấu hình dùng hệ số mặc định và không hiển thị tại đây.",
5255+
"Usage by group (last 7 days)": "Tiêu thụ theo nhóm (7 ngày gần đây)",
5256+
"Usage in the last 24 hours": "Tiêu thụ 24 giờ qua",
5257+
"Total consumption and breakdown by group for the past 24 hours.": "Tổng tiêu thụ và phân bổ theo nhóm trong 24 giờ qua.",
5258+
"Last 24h Used Quota": "Hạn mức đã dùng (24h)",
5259+
"Last 24h Requests": "Số yêu cầu (24h)",
5260+
"See which groups this user actually consumes — useful when enabling preferential ratios for specific groups.": "Xem người dùng thực sự tiêu thụ ở nhóm nào — hữu ích khi bật hệ số ưu đãi cho nhóm cụ thể.",
5261+
"No group usage in the last 7 days": "Không có tiêu thụ theo nhóm trong 7 ngày gần đây",
5262+
"No usage in the last 24 hours": "Không có tiêu thụ trong 24 giờ qua",
5263+
"Preferential Ratio": "Hệ số ưu đãi",
5264+
"Preferential": "Ưu đãi",
5265+
"Restore default notice": "Khôi phục thông báo mặc định",
52495266
"Click username to view details · copy supported": "Nhấp tên để xem chi tiết · hỗ trợ sao chép",
52505267
"View user details": "Xem chi tiết người dùng",
52515268
"User not found": "Không tìm thấy người dùng"

web/default/src/i18n/locales/zh-TW.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5241,11 +5241,28 @@
52415241
"No groups configured": "暫無配置分組",
52425242
"Copy username": "複製使用者名稱",
52435243
"View username, balance, and group ratio details for this user.": "查看該使用者的使用者名稱、餘額與分組倍率詳情。",
5244+
"View username, balance, preferential group pricing, and recent usage by group.": "查看該使用者的使用者名稱、餘額、特惠分組定價,以及近 7 日按分組的消耗情況。",
5245+
"View username, balance, and usage in the last 24 hours by group.": "查看該使用者的使用者名稱、餘額,以及近 24 小時按分組的消耗情況。",
52445246
"Group Ratios": "分組倍率",
52455247
"Custom Pricing On": "千人千面已開啟",
5248+
"Custom Pricing Off": "千人千面未開啟",
52465249
"System Defaults": "系統預設",
52475250
"{{count}} overrides": "{{count}} 項自訂",
5251+
"{{count}} preferential groups": "{{count}} 個特惠分組",
52485252
"No group ratio data available": "暫無分組倍率資料",
5253+
"No preferential groups configured for this user": "該使用者暫無已配置的特惠分組",
5254+
"Only preferential groups are listed when custom pricing is on. Unconfigured groups use system defaults and are omitted here.": "開啟千人千面後僅展示已配置優惠的分組;未改動的分組沿用系統預設倍率,此處不列出。",
5255+
"Usage by group (last 7 days)": "近 7 日按分組消耗",
5256+
"Usage in the last 24 hours": "近 24 小時消耗",
5257+
"Total consumption and breakdown by group for the past 24 hours.": "統計近 24 小時總消耗,以及分別在哪個分組消耗了多少。",
5258+
"Last 24h Used Quota": "近 24 小時消耗額度",
5259+
"Last 24h Requests": "近 24 小時請求數",
5260+
"See which groups this user actually consumes — useful when enabling preferential ratios for specific groups.": "查看該使用者實際在哪些分組產生消耗,便於為對應分組開啟特惠倍率。",
5261+
"No group usage in the last 7 days": "近 7 日暫無分組消耗資料",
5262+
"No usage in the last 24 hours": "近 24 小時暫無消耗資料",
5263+
"Preferential Ratio": "特惠倍率",
5264+
"Preferential": "特惠",
5265+
"Restore default notice": "還原預設通知文案",
52495266
"Click username to view details · copy supported": "點擊使用者名稱查看詳情 · 支援複製",
52505267
"View user details": "查看使用者詳情",
52515268
"User not found": "找不到使用者"

0 commit comments

Comments
 (0)