diff --git a/apps/admin/services/admin/index.ts b/apps/admin/services/admin/index.ts index 32cbdf0..944988e 100644 --- a/apps/admin/services/admin/index.ts +++ b/apps/admin/services/admin/index.ts @@ -1,5 +1,5 @@ // @ts-ignore - + // API 更新时间: // API 唯一标识: import * as announcement from './announcement'; diff --git a/apps/user/app/(main)/(user)/profile/notify-settings.tsx b/apps/user/app/(main)/(user)/profile/notify-settings.tsx index f14917f..b12470b 100644 --- a/apps/user/app/(main)/(user)/profile/notify-settings.tsx +++ b/apps/user/app/(main)/(user)/profile/notify-settings.tsx @@ -1,7 +1,7 @@ 'use client'; import useGlobalStore from '@/config/use-global'; -import { updateUserNotifySetting } from '@/services/user/user'; +import { bindTelegram, unbindTelegram, updateUserNotifySetting } from '@/services/user/user'; import { Button } from '@shadcn/ui/button'; import { Card, CardContent, CardHeader, CardTitle } from '@shadcn/ui/card'; import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '@shadcn/ui/form'; @@ -20,7 +20,7 @@ const FormSchema = z.object({ export default function NotifySettings() { const t = useTranslations('profile.notify'); - const { user } = useGlobalStore(); + const { user, getUserInfo } = useGlobalStore(); const form = useForm>({ resolver: zodResolver(FormSchema), defaultValues: { @@ -59,15 +59,22 @@ export default function NotifySettings() { onChange={(e) => { field.onChange(e.target.value ? Number(e.target.value) : ''); }} + disabled /> diff --git a/apps/user/locales/cs-CZ/profile.json b/apps/user/locales/cs-CZ/profile.json index 07bd965..a5b7c1f 100644 --- a/apps/user/locales/cs-CZ/profile.json +++ b/apps/user/locales/cs-CZ/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "Aktualizace úspěšná" }, "notify": { - "bind": "Připojit", + "bind": "Přejít na vazbu", "emailNotification": "E-mailové oznámení", "notificationSettings": "Nastavení oznámení", "telegramId": "Telegram ID", "telegramIdPlaceholder": "Zadejte Telegram ID", "telegramNotification": "Telegram oznámení", + "unbind": "Zrušit vazbu", "updateSuccess": "Aktualizace byla úspěšná" }, "notifyEvent": { diff --git a/apps/user/locales/de-DE/profile.json b/apps/user/locales/de-DE/profile.json index 64d9c2c..c5ee8a7 100644 --- a/apps/user/locales/de-DE/profile.json +++ b/apps/user/locales/de-DE/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "Erfolgreich aktualisiert" }, "notify": { - "bind": "Binden", + "bind": "Zur Bindung gehen", "emailNotification": "E-Mail-Benachrichtigung", "notificationSettings": "Benachrichtigungseinstellungen", "telegramId": "Telegram-ID", "telegramIdPlaceholder": "Telegram-ID eingeben", "telegramNotification": "Telegram-Benachrichtigung", + "unbind": "Lösen", "updateSuccess": "Erfolgreich aktualisiert" }, "notifyEvent": { diff --git a/apps/user/locales/en-US/profile.json b/apps/user/locales/en-US/profile.json index 6187a51..55eb105 100644 --- a/apps/user/locales/en-US/profile.json +++ b/apps/user/locales/en-US/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "Update Successful" }, "notify": { - "bind": "Bind", + "bind": "Go to Binding", "emailNotification": "Email Notification", "notificationSettings": "Notification Settings", "telegramId": "Telegram ID", "telegramIdPlaceholder": "Enter Telegram ID", "telegramNotification": "Telegram Notification", + "unbind": "Unbind", "updateSuccess": "Update Successful" }, "notifyEvent": { diff --git a/apps/user/locales/es-ES/profile.json b/apps/user/locales/es-ES/profile.json index 3ac1b59..5c9de40 100644 --- a/apps/user/locales/es-ES/profile.json +++ b/apps/user/locales/es-ES/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "Actualización exitosa" }, "notify": { - "bind": "Vincular", + "bind": "Ir a Vinculación", "emailNotification": "Notificación por correo electrónico", "notificationSettings": "Configuración de notificaciones", "telegramId": "ID de Telegram", "telegramIdPlaceholder": "Ingrese ID de Telegram", "telegramNotification": "Notificación de Telegram", + "unbind": "Desvincular", "updateSuccess": "Actualización exitosa" }, "notifyEvent": { diff --git a/apps/user/locales/es-MX/profile.json b/apps/user/locales/es-MX/profile.json index 3ac1b59..5c9de40 100644 --- a/apps/user/locales/es-MX/profile.json +++ b/apps/user/locales/es-MX/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "Actualización exitosa" }, "notify": { - "bind": "Vincular", + "bind": "Ir a Vinculación", "emailNotification": "Notificación por correo electrónico", "notificationSettings": "Configuración de notificaciones", "telegramId": "ID de Telegram", "telegramIdPlaceholder": "Ingrese ID de Telegram", "telegramNotification": "Notificación de Telegram", + "unbind": "Desvincular", "updateSuccess": "Actualización exitosa" }, "notifyEvent": { diff --git a/apps/user/locales/fa-IR/profile.json b/apps/user/locales/fa-IR/profile.json index 5548c43..db454ff 100644 --- a/apps/user/locales/fa-IR/profile.json +++ b/apps/user/locales/fa-IR/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "به‌روزرسانی موفقیت‌آمیز" }, "notify": { - "bind": "اتصال", + "bind": "رفتن به اتصال", "emailNotification": "اعلان ایمیل", "notificationSettings": "تنظیمات اعلان", "telegramId": "شناسه تلگرام", "telegramIdPlaceholder": "شناسه تلگرام را وارد کنید", "telegramNotification": "اعلان تلگرام", + "unbind": "لغو اتصال", "updateSuccess": "به‌روزرسانی موفقیت‌آمیز" }, "notifyEvent": { diff --git a/apps/user/locales/fi-FI/profile.json b/apps/user/locales/fi-FI/profile.json index 120d5cf..c0a6ee8 100644 --- a/apps/user/locales/fi-FI/profile.json +++ b/apps/user/locales/fi-FI/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "Päivitys onnistui" }, "notify": { - "bind": "Yhdistä", + "bind": "Siirry sitomiseen", "emailNotification": "Sähköposti-ilmoitus", "notificationSettings": "Ilmoitusasetukset", "telegramId": "Telegram ID", "telegramIdPlaceholder": "Syötä Telegram ID", "telegramNotification": "Telegram-ilmoitus", + "unbind": "Poista sitominen", "updateSuccess": "Päivitys onnistui" }, "notifyEvent": { diff --git a/apps/user/locales/fr-FR/profile.json b/apps/user/locales/fr-FR/profile.json index c06a004..d3f7eee 100644 --- a/apps/user/locales/fr-FR/profile.json +++ b/apps/user/locales/fr-FR/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "Mise à jour réussie" }, "notify": { - "bind": "Lier", + "bind": "Aller à la liaison", "emailNotification": "Notification par e-mail", "notificationSettings": "Paramètres de notification", "telegramId": "ID Telegram", "telegramIdPlaceholder": "Entrez l'ID Telegram", "telegramNotification": "Notification Telegram", + "unbind": "Délier", "updateSuccess": "Mise à jour réussie" }, "notifyEvent": { diff --git a/apps/user/locales/hi-IN/profile.json b/apps/user/locales/hi-IN/profile.json index db2f3df..ef3b2bf 100644 --- a/apps/user/locales/hi-IN/profile.json +++ b/apps/user/locales/hi-IN/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "सफलतापूर्वक अपडेट किया गया" }, "notify": { - "bind": "बाइंड", + "bind": "बाइंडिंग पर जाएं", "emailNotification": "ईमेल सूचना", "notificationSettings": "सूचना सेटिंग्स", "telegramId": "टेलीग्राम आईडी", "telegramIdPlaceholder": "टेलीग्राम आईडी दर्ज करें", "telegramNotification": "टेलीग्राम सूचना", + "unbind": "अनबाइंड करें", "updateSuccess": "सफलतापूर्वक अपडेट किया गया" }, "notifyEvent": { diff --git a/apps/user/locales/hu-HU/profile.json b/apps/user/locales/hu-HU/profile.json index f567be8..8ecae50 100644 --- a/apps/user/locales/hu-HU/profile.json +++ b/apps/user/locales/hu-HU/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "Sikeres frissítés" }, "notify": { - "bind": "Összekapcsolás", + "bind": "Menj a kötéshez", "emailNotification": "E-mail értesítés", "notificationSettings": "Értesítési beállítások", "telegramId": "Telegram azonosító", "telegramIdPlaceholder": "Adja meg a Telegram azonosítót", "telegramNotification": "Telegram értesítés", + "unbind": "Kötés feloldása", "updateSuccess": "Sikeres frissítés" }, "notifyEvent": { diff --git a/apps/user/locales/ja-JP/profile.json b/apps/user/locales/ja-JP/profile.json index 84fe98d..e0da3dc 100644 --- a/apps/user/locales/ja-JP/profile.json +++ b/apps/user/locales/ja-JP/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "更新成功" }, "notify": { - "bind": "バインド", + "bind": "バインディングに移動", "emailNotification": "メール通知", "notificationSettings": "通知設定", "telegramId": "Telegram ID", "telegramIdPlaceholder": "Telegram IDを入力", "telegramNotification": "Telegram通知", + "unbind": "バインド解除", "updateSuccess": "更新成功" }, "notifyEvent": { diff --git a/apps/user/locales/ko-KR/profile.json b/apps/user/locales/ko-KR/profile.json index 4e1b72c..0efeb58 100644 --- a/apps/user/locales/ko-KR/profile.json +++ b/apps/user/locales/ko-KR/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "업데이트 성공" }, "notify": { - "bind": "연결", + "bind": "바인딩으로 이동", "emailNotification": "이메일 알림", "notificationSettings": "알림 설정", "telegramId": "텔레그램 ID", "telegramIdPlaceholder": "텔레그램 ID 입력", "telegramNotification": "텔레그램 알림", + "unbind": "바인딩 해제", "updateSuccess": "업데이트 성공" }, "notifyEvent": { diff --git a/apps/user/locales/no-NO/profile.json b/apps/user/locales/no-NO/profile.json index 2b985d5..8ae33e2 100644 --- a/apps/user/locales/no-NO/profile.json +++ b/apps/user/locales/no-NO/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "Oppdatering vellykket" }, "notify": { - "bind": "Knytt til", + "bind": "Gå til binding", "emailNotification": "E-postvarsling", "notificationSettings": "Varslingsinnstillinger", "telegramId": "Telegram-ID", "telegramIdPlaceholder": "Skriv inn Telegram-ID", "telegramNotification": "Telegram-varsling", + "unbind": "Løsne", "updateSuccess": "Oppdatering vellykket" }, "notifyEvent": { diff --git a/apps/user/locales/pl-PL/profile.json b/apps/user/locales/pl-PL/profile.json index 50c667d..99adcc6 100644 --- a/apps/user/locales/pl-PL/profile.json +++ b/apps/user/locales/pl-PL/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "Aktualizacja zakończona sukcesem" }, "notify": { - "bind": "Połącz", + "bind": "Przejdź do wiązania", "emailNotification": "Powiadomienie e-mail", "notificationSettings": "Ustawienia powiadomień", "telegramId": "Telegram ID", "telegramIdPlaceholder": "Wprowadź Telegram ID", "telegramNotification": "Powiadomienie Telegram", + "unbind": "Odwiąż", "updateSuccess": "Aktualizacja zakończona sukcesem" }, "notifyEvent": { diff --git a/apps/user/locales/pt-BR/profile.json b/apps/user/locales/pt-BR/profile.json index bfdd0a0..e5381d3 100644 --- a/apps/user/locales/pt-BR/profile.json +++ b/apps/user/locales/pt-BR/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "Atualização bem-sucedida" }, "notify": { - "bind": "Vincular", + "bind": "Ir para Vinculação", "emailNotification": "Notificação por e-mail", "notificationSettings": "Configurações de notificação", "telegramId": "ID do Telegram", "telegramIdPlaceholder": "Insira o ID do Telegram", "telegramNotification": "Notificação do Telegram", + "unbind": "Desvincular", "updateSuccess": "Atualização bem-sucedida" }, "notifyEvent": { diff --git a/apps/user/locales/ro-RO/profile.json b/apps/user/locales/ro-RO/profile.json index 8a52dfc..7110f43 100644 --- a/apps/user/locales/ro-RO/profile.json +++ b/apps/user/locales/ro-RO/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "Actualizare reușită" }, "notify": { - "bind": "Conectare", + "bind": "Mergi la Legare", "emailNotification": "Notificare prin email", "notificationSettings": "Setări notificări", "telegramId": "ID Telegram", "telegramIdPlaceholder": "Introduceți ID-ul Telegram", "telegramNotification": "Notificare Telegram", + "unbind": "Dezleagă", "updateSuccess": "Actualizare reușită" }, "notifyEvent": { diff --git a/apps/user/locales/ru-RU/profile.json b/apps/user/locales/ru-RU/profile.json index f2c51f1..a73cab4 100644 --- a/apps/user/locales/ru-RU/profile.json +++ b/apps/user/locales/ru-RU/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "Успешно обновлено" }, "notify": { - "bind": "Привязать", + "bind": "Перейти к привязке", "emailNotification": "Уведомление по электронной почте", "notificationSettings": "Настройки уведомлений", "telegramId": "Telegram ID", "telegramIdPlaceholder": "Введите Telegram ID", "telegramNotification": "Уведомление в Telegram", + "unbind": "Отвязать", "updateSuccess": "Успешно обновлено" }, "notifyEvent": { diff --git a/apps/user/locales/th-TH/profile.json b/apps/user/locales/th-TH/profile.json index c464104..7c9605c 100644 --- a/apps/user/locales/th-TH/profile.json +++ b/apps/user/locales/th-TH/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "อัปเดตสำเร็จ" }, "notify": { - "bind": "ผูก", + "bind": "ไปที่การผูก", "emailNotification": "การแจ้งเตือนทางอีเมล", "notificationSettings": "การตั้งค่าการแจ้งเตือน", "telegramId": "Telegram ID", "telegramIdPlaceholder": "กรอก Telegram ID", "telegramNotification": "การแจ้งเตือนทาง Telegram", + "unbind": "ยกเลิกการผูก", "updateSuccess": "อัปเดตสำเร็จ" }, "notifyEvent": { diff --git a/apps/user/locales/tr-TR/profile.json b/apps/user/locales/tr-TR/profile.json index dae6f72..932dbf5 100644 --- a/apps/user/locales/tr-TR/profile.json +++ b/apps/user/locales/tr-TR/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "Güncelleme Başarılı" }, "notify": { - "bind": "Bağla", + "bind": "Bağlamaya Git", "emailNotification": "E-posta Bildirimi", "notificationSettings": "Bildirim Ayarları", "telegramId": "Telegram Kimliği", "telegramIdPlaceholder": "Telegram Kimliği girin", "telegramNotification": "Telegram Bildirimi", + "unbind": "Bağlamayı Kaldır", "updateSuccess": "Güncelleme Başarılı" }, "notifyEvent": { diff --git a/apps/user/locales/uk-UA/profile.json b/apps/user/locales/uk-UA/profile.json index 081949d..36c12d5 100644 --- a/apps/user/locales/uk-UA/profile.json +++ b/apps/user/locales/uk-UA/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "Оновлення успішне" }, "notify": { - "bind": "Прив'язати", + "bind": "Перейти до прив'язки", "emailNotification": "Сповіщення електронною поштою", "notificationSettings": "Налаштування сповіщень", "telegramId": "Telegram ID", "telegramIdPlaceholder": "Введіть Telegram ID", "telegramNotification": "Сповіщення Telegram", + "unbind": "Відв'язати", "updateSuccess": "Оновлення успішне" }, "notifyEvent": { diff --git a/apps/user/locales/vi-VN/profile.json b/apps/user/locales/vi-VN/profile.json index a10be26..f16e24b 100644 --- a/apps/user/locales/vi-VN/profile.json +++ b/apps/user/locales/vi-VN/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "Cập nhật thành công" }, "notify": { - "bind": "Liên kết", + "bind": "Đi đến Liên kết", "emailNotification": "Thông báo Email", "notificationSettings": "Cài đặt Thông báo", "telegramId": "Telegram ID", "telegramIdPlaceholder": "Nhập Telegram ID", "telegramNotification": "Thông báo Telegram", + "unbind": "Hủy liên kết", "updateSuccess": "Cập nhật thành công" }, "notifyEvent": { diff --git a/apps/user/locales/zh-CN/profile.json b/apps/user/locales/zh-CN/profile.json index 5c0ac5a..fee75da 100644 --- a/apps/user/locales/zh-CN/profile.json +++ b/apps/user/locales/zh-CN/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "更新成功" }, "notify": { - "bind": "绑定", + "bind": "前往绑定", "emailNotification": "邮件通知", "notificationSettings": "通知设置", "telegramId": "Telegram ID", "telegramIdPlaceholder": "输入 Telegram ID", "telegramNotification": "Telegram 通知", + "unbind": "解除绑定", "updateSuccess": "更新成功" }, "notifyEvent": { diff --git a/apps/user/locales/zh-HK/profile.json b/apps/user/locales/zh-HK/profile.json index 8253e8f..451eeba 100644 --- a/apps/user/locales/zh-HK/profile.json +++ b/apps/user/locales/zh-HK/profile.json @@ -9,12 +9,13 @@ "updateSuccess": "更新成功" }, "notify": { - "bind": "綁定", + "bind": "前往綁定", "emailNotification": "郵件通知", "notificationSettings": "通知設定", "telegramId": "Telegram ID", "telegramIdPlaceholder": "輸入 Telegram ID", "telegramNotification": "Telegram 通知", + "unbind": "解除綁定", "updateSuccess": "更新成功" }, "notifyEvent": { diff --git a/apps/user/services/user/typings.d.ts b/apps/user/services/user/typings.d.ts index 92e85b7..9062ce9 100644 --- a/apps/user/services/user/typings.d.ts +++ b/apps/user/services/user/typings.d.ts @@ -27,6 +27,11 @@ declare namespace API { ios: Application[]; }; + type BindTelegramResponse = { + url: string; + expired_at: number; + }; + type CheckoutOrderRequest = { orderNo: string; }; diff --git a/apps/user/services/user/user.ts b/apps/user/services/user/user.ts index ecc821d..c55086f 100644 --- a/apps/user/services/user/user.ts +++ b/apps/user/services/user/user.ts @@ -24,6 +24,17 @@ export async function queryUserBalanceLog(options?: { [key: string]: any }) { ); } +/** Bind Telegram GET /v1/public/user/bind_telegram */ +export async function bindTelegram(options?: { [key: string]: any }) { + return request( + '/v1/public/user/bind_telegram', + { + method: 'GET', + ...(options || {}), + }, + ); +} + /** Query User Info GET /v1/public/user/info */ export async function queryUserInfo(options?: { [key: string]: any }) { return request('/v1/public/user/info', { @@ -87,3 +98,11 @@ export async function queryUserSubscribe(options?: { [key: string]: any }) { }, ); } + +/** Unbind Telegram POST /v1/public/user/unbind_telegram */ +export async function unbindTelegram(options?: { [key: string]: any }) { + return request('/v1/public/user/unbind_telegram', { + method: 'POST', + ...(options || {}), + }); +}