feat(affiliate): Update affiliate component to display total commission and improve data fetching

This commit is contained in:
web@ppanel 2025-01-04 16:51:03 +07:00
parent 4aea4e811f
commit cc834caa30
56 changed files with 335 additions and 114 deletions

View File

@ -4,10 +4,13 @@ import packageJSON from '../package.json';
export const locales = packageJSON.i18n.outputLocales;
export const defaultLocale = packageJSON.i18n.entry;
export const NEXT_PUBLIC_DEFAULT_LANGUAGE = env('NEXT_PUBLIC_DEFAULT_LANGUAGE') ?? defaultLocale;
export const NEXT_PUBLIC_DEFAULT_LANGUAGE =
env('NEXT_PUBLIC_DEFAULT_LANGUAGE') ?? process.env.NEXT_PUBLIC_DEFAULT_LANGUAGE ?? defaultLocale;
export const NEXT_PUBLIC_SITE_URL = env('NEXT_PUBLIC_SITE_URL') ?? process.env.NEXT_PUBLIC_SITE_URL;
export const NEXT_PUBLIC_API_URL = env('NEXT_PUBLIC_API_URL') ?? process.env.NEXT_PUBLIC_API_URL;
export const NEXT_PUBLIC_DEFAULT_USER_EMAIL = env('NEXT_PUBLIC_DEFAULT_USER_EMAIL');
export const NEXT_PUBLIC_DEFAULT_USER_PASSWORD = env('NEXT_PUBLIC_DEFAULT_USER_PASSWORD');
export const NEXT_PUBLIC_DEFAULT_USER_EMAIL =
env('NEXT_PUBLIC_DEFAULT_USER_EMAIL') ?? process.env.NEXT_PUBLIC_DEFAULT_USER_EMAIL;
export const NEXT_PUBLIC_DEFAULT_USER_PASSWORD =
env('NEXT_PUBLIC_DEFAULT_USER_PASSWORD') ?? process.env.NEXT_PUBLIC_DEFAULT_USER_PASSWORD;

View File

@ -172,7 +172,7 @@ declare namespace API {
show: boolean;
sell: boolean;
deduction_ratio: number;
purchase_with_discount: boolean;
allow_deduction: boolean;
reset_cycle: number;
renewal_reset: boolean;
};
@ -548,6 +548,7 @@ declare namespace API {
quantity: number;
price: number;
amount: number;
deduction: number;
discount: number;
coupon: string;
coupon_discount: number;
@ -556,8 +557,6 @@ declare namespace API {
trade_no: string;
status: number;
subscribe_id: number;
subscription_discount_id: number;
subscription_discount_price: number;
created_at: number;
updated_at: number;
};
@ -570,6 +569,7 @@ declare namespace API {
quantity: number;
price: number;
amount: number;
deduction: number;
discount: number;
coupon: string;
coupon_discount: number;
@ -579,8 +579,6 @@ declare namespace API {
status: number;
subscribe_id: number;
subscribe: Subscribe;
subscription_discount_id: number;
subscription_discount_price: number;
created_at: number;
updated_at: number;
};
@ -747,7 +745,7 @@ declare namespace API {
sell: boolean;
sort: number;
deduction_ratio: number;
purchase_with_discount: boolean;
allow_deduction: boolean;
reset_cycle: number;
renewal_reset: boolean;
created_at: number;
@ -975,7 +973,7 @@ declare namespace API {
sell: boolean;
sort: number;
deduction_ratio: number;
purchase_with_discount: boolean;
allow_deduction: boolean;
reset_cycle: number;
renewal_reset: boolean;
};
@ -1010,6 +1008,8 @@ declare namespace API {
email: string;
avatar: string;
balance: number;
commission: number;
deduction: number;
telegram: number;
refer_code: string;
referer_id: number;

View File

@ -165,6 +165,7 @@ declare namespace API {
quantity: number;
price: number;
amount: number;
deduction: number;
discount: number;
coupon: string;
coupon_discount: number;
@ -173,8 +174,6 @@ declare namespace API {
trade_no: string;
status: number;
subscribe_id: number;
subscription_discount_id: number;
subscription_discount_price: number;
created_at: number;
updated_at: number;
};
@ -187,6 +186,7 @@ declare namespace API {
quantity: number;
price: number;
amount: number;
deduction: number;
discount: number;
coupon: string;
coupon_discount: number;
@ -196,8 +196,6 @@ declare namespace API {
status: number;
subscribe_id: number;
subscribe: Subscribe;
subscription_discount_id: number;
subscription_discount_price: number;
created_at: number;
updated_at: number;
};
@ -333,7 +331,7 @@ declare namespace API {
sell: boolean;
sort: number;
deduction_ratio: number;
purchase_with_discount: boolean;
allow_deduction: boolean;
reset_cycle: number;
renewal_reset: boolean;
created_at: number;
@ -416,6 +414,8 @@ declare namespace API {
email: string;
avatar: string;
balance: number;
commission: number;
deduction: number;
telegram: number;
refer_code: string;
referer_id: number;

View File

@ -35,30 +35,48 @@ export function SidebarRight({ ...props }: React.ComponentProps<typeof Sidebar>)
</CardContent>
</Card>
<Card>
<CardHeader className='flex flex-row items-center justify-between space-y-0 p-3 pb-2'>
<CardTitle className='text-sm font-medium'>{t('inviteCode')}</CardTitle>
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<CopyToClipboard
text={`${isBrowser() && location?.origin}/auth?invite=${user?.refer_code}`}
onCopy={(text, result) => {
if (result) {
toast.success(t('copySuccess'));
}
}}
>
<Button variant='ghost' className='size-5 p-0'>
<Icon icon='mdi:content-copy' className='text-primary text-2xl' />
</Button>
</CopyToClipboard>
</TooltipTrigger>
<TooltipContent>{t('copyInviteLink')}</TooltipContent>
</Tooltip>
</TooltipProvider>
<CardHeader className='space-y-0 p-3 pb-2'>
<CardTitle className='text-sm font-medium'>{t('deductBalance')}</CardTitle>
</CardHeader>
<CardContent className='truncate p-3 font-bold'>{user?.refer_code}</CardContent>
<CardContent className='p-3 text-2xl font-bold'>
<Display type='currency' value={user?.deduction} />
</CardContent>
</Card>
<Card>
<CardHeader className='space-y-0 p-3 pb-2'>
<CardTitle className='text-sm font-medium'>{t('commission')}</CardTitle>
</CardHeader>
<CardContent className='p-3 text-2xl font-bold'>
<Display type='currency' value={user?.commission} />
</CardContent>
</Card>
{user?.refer_code && (
<Card>
<CardHeader className='flex flex-row items-center justify-between space-y-0 p-3 pb-2'>
<CardTitle className='text-sm font-medium'>{t('inviteCode')}</CardTitle>
<TooltipProvider>
<Tooltip>
<TooltipTrigger asChild>
<CopyToClipboard
text={`${isBrowser() && location?.origin}/auth?invite=${user?.refer_code}`}
onCopy={(text, result) => {
if (result) {
toast.success(t('copySuccess'));
}
}}
>
<Button variant='ghost' className='size-5 p-0'>
<Icon icon='mdi:content-copy' className='text-primary text-2xl' />
</Button>
</CopyToClipboard>
</TooltipTrigger>
<TooltipContent>{t('copyInviteLink')}</TooltipContent>
</Tooltip>
</TooltipProvider>
</CardHeader>
<CardContent className='truncate p-3 font-bold'>{user?.refer_code}</CardContent>
</Card>
)}
</SidebarContent>
</Sidebar>
);

View File

@ -4,7 +4,7 @@ import { Display } from '@/components/display';
import { ProList, ProListActions } from '@/components/pro-list';
import useGlobalStore from '@/config/use-global';
import { queryUserBalanceLog } from '@/services/user/user';
import { Card, CardContent, CardHeader, CardTitle } from '@workspace/ui/components/card';
import { Card, CardContent } from '@workspace/ui/components/card';
import { useTranslations } from 'next-intl';
import { useRef } from 'react';
@ -16,19 +16,48 @@ export default function Page() {
const t = useTranslations('wallet');
const { user } = useGlobalStore();
const ref = useRef<ProListActions>(null);
const totalAssets = (user?.balance || 0) + (user?.commission || 0) + (user?.deduction || 0);
return (
<>
<Card className='mb-4'>
<CardHeader>
<CardTitle className='font-medium'>{t('title')}</CardTitle>
</CardHeader>
<CardContent className='flex items-center justify-between'>
<div className='text-2xl font-bold'>
<Display type='currency' value={user?.balance} />
<CardContent className='p-6'>
<h2 className='text-foreground mb-4 text-2xl font-bold'>{t('totalAssets')}</h2>
<div className='mb-4'>
<div className='flex items-center justify-between'>
<div>
<p className='text-sm font-medium'></p>
<p className='text-3xl font-bold'>
<Display type='currency' value={totalAssets} />
</p>
</div>
<Recharge />
</div>
</div>
<div className='flex gap-2'>
<Recharge />
<div className='grid grid-cols-1 gap-6 md:grid-cols-3'>
<div className='bg-secondary rounded-lg p-4 shadow-sm transition-all duration-300 hover:shadow-md'>
<p className='text-secondary-foreground text-sm font-medium opacity-80'>
{t('balance')}
</p>
<p className='text-secondary-foreground text-2xl font-bold'>
<Display type='currency' value={user?.balance} />
</p>
</div>
<div className='bg-secondary rounded-lg p-4 shadow-sm transition-all duration-300 hover:shadow-md'>
<p className='text-secondary-foreground text-sm font-medium opacity-80'>
{t('deductBalance')}
</p>
<p className='text-secondary-foreground text-2xl font-bold'>
<Display type='currency' value={user?.deduction} />
</p>
</div>
<div className='bg-secondary rounded-lg p-4 shadow-sm transition-all duration-300 hover:shadow-md'>
<p className='text-secondary-foreground text-sm font-medium opacity-80'>
{t('commission')}
</p>
<p className='text-secondary-foreground text-2xl font-bold'>
<Display type='currency' value={user?.commission} />
</p>
</div>
</div>
</CardContent>
</Card>

View File

@ -4,7 +4,8 @@ import { Display } from '@/components/display';
import { Empty } from '@/components/empty';
import { ProList } from '@/components/pro-list';
import useGlobalStore from '@/config/use-global';
import { queryUserAffiliate } from '@/services/user/user';
import { queryUserAffiliate, queryUserAffiliateList } from '@/services/user/user';
import { useQuery } from '@tanstack/react-query';
import { Button } from '@workspace/ui/components/button';
import {
Card,
@ -24,6 +25,13 @@ export default function Affiliate() {
const t = useTranslations('affiliate');
const { user, common } = useGlobalStore();
const [sum, setSum] = useState<number>();
const { data } = useQuery({
queryKey: ['queryUserAffiliate'],
queryFn: async () => {
const response = await queryUserAffiliate();
return response.data.data;
},
});
return (
<div className='flex flex-col gap-4'>
@ -35,7 +43,7 @@ export default function Affiliate() {
<CardContent>
<div className='flex items-baseline gap-2'>
<span className='text-3xl font-bold'>
<Display type='currency' value={sum} />
<Display type='currency' value={data?.total_commission} />
</span>
<span className='text-muted-foreground text-sm'>
({t('commissionRate')}: {common?.invite?.referral_percentage}%)
@ -53,7 +61,7 @@ export default function Affiliate() {
{user?.refer_code}
</code>
<CopyToClipboard
text={`${location.origin}/auth?invite=${user?.refer_code}`}
text={`${location?.origin}/auth?invite=${user?.refer_code}`}
onCopy={(text, result) => {
if (result) {
toast.success(t('copySuccess'));
@ -70,7 +78,7 @@ export default function Affiliate() {
</Card>
<ProList<API.UserAffiliate, Record<string, unknown>>
request={async (pagination, filter) => {
const response = await queryUserAffiliate({ ...pagination, ...filter });
const response = await queryUserAffiliateList({ ...pagination, ...filter });
setSum(response.data.data?.sum);
return {
list: response.data.data?.list || [],

View File

@ -4,19 +4,28 @@ import packageJSON from '../package.json';
export const locales = packageJSON.i18n.outputLocales;
export const defaultLocale = packageJSON.i18n.entry;
export const NEXT_PUBLIC_DEFAULT_LANGUAGE = env('NEXT_PUBLIC_DEFAULT_LANGUAGE') ?? defaultLocale;
export const NEXT_PUBLIC_DEFAULT_LANGUAGE =
env('NEXT_PUBLIC_DEFAULT_LANGUAGE') ?? process.env.NEXT_PUBLIC_DEFAULT_LANGUAGE ?? defaultLocale;
export const NEXT_PUBLIC_SITE_URL = env('NEXT_PUBLIC_SITE_URL') ?? process.env.NEXT_PUBLIC_SITE_URL;
export const NEXT_PUBLIC_API_URL = env('NEXT_PUBLIC_API_URL') ?? process.env.NEXT_PUBLIC_API_URL;
export const NEXT_PUBLIC_DEFAULT_USER_EMAIL = env('NEXT_PUBLIC_DEFAULT_USER_EMAIL');
export const NEXT_PUBLIC_DEFAULT_USER_PASSWORD = env('NEXT_PUBLIC_DEFAULT_USER_PASSWORD');
export const NEXT_PUBLIC_DEFAULT_USER_EMAIL =
env('NEXT_PUBLIC_DEFAULT_USER_EMAIL') ?? process.env.NEXT_PUBLIC_DEFAULT_USER_EMAIL;
export const NEXT_PUBLIC_DEFAULT_USER_PASSWORD =
env('NEXT_PUBLIC_DEFAULT_USER_PASSWORD') ?? process.env.NEXT_PUBLIC_DEFAULT_USER_PASSWORD;
export const NEXT_PUBLIC_EMAIL = env('NEXT_PUBLIC_EMAIL');
export const NEXT_PUBLIC_EMAIL = env('NEXT_PUBLIC_EMAIL') ?? process.env.NEXT_PUBLIC_EMAIL;
export const NEXT_PUBLIC_TELEGRAM_LINK = env('NEXT_PUBLIC_TELEGRAM_LINK');
export const NEXT_PUBLIC_DISCORD_LINK = env('NEXT_PUBLIC_DISCORD_LINK');
export const NEXT_PUBLIC_GITHUB_LINK = env('NEXT_PUBLIC_GITHUB_LINK');
export const NEXT_PUBLIC_LINKEDIN_LINK = env('NEXT_PUBLIC_LINKEDIN_LINK');
export const NEXT_PUBLIC_TWITTER_LINK = env('NEXT_PUBLIC_TWITTER_LINK');
export const NEXT_PUBLIC_INSTAGRAM_LINK = env('NEXT_PUBLIC_INSTAGRAM_LINK');
export const NEXT_PUBLIC_TELEGRAM_LINK =
env('NEXT_PUBLIC_TELEGRAM_LINK') ?? process.env.NEXT_PUBLIC_TELEGRAM_LINK;
export const NEXT_PUBLIC_DISCORD_LINK =
env('NEXT_PUBLIC_DISCORD_LINK') ?? process.env.NEXT_PUBLIC_DISCORD_LINK;
export const NEXT_PUBLIC_GITHUB_LINK =
env('NEXT_PUBLIC_GITHUB_LINK') ?? process.env.NEXT_PUBLIC_GITHUB_LINK;
export const NEXT_PUBLIC_LINKEDIN_LINK =
env('NEXT_PUBLIC_LINKEDIN_LINK') ?? process.env.NEXT_PUBLIC_LINKEDIN_LINK;
export const NEXT_PUBLIC_TWITTER_LINK =
env('NEXT_PUBLIC_TWITTER_LINK') ?? process.env.NEXT_PUBLIC_TWITTER_LINK;
export const NEXT_PUBLIC_INSTAGRAM_LINK =
env('NEXT_PUBLIC_INSTAGRAM_LINK') ?? process.env.NEXT_PUBLIC_INSTAGRAM_LINK;

View File

@ -1,7 +1,9 @@
{
"accountBalance": "Zůstatek na účtu",
"commission": "Provize",
"copyInviteLink": "Zkopírovat odkaz na pozvánku",
"copySuccess": "Odkaz na pozvánku byl úspěšně zkopírován",
"deductBalance": "Odečíst zůstatek",
"inviteCode": "pozvánkový kód",
"recharge": "Dobít"
}

View File

@ -1,8 +1,10 @@
{
"amount": "Částka",
"balance": "zůstatek",
"commission": "Provize",
"createdAt": "čas",
"title": "Zůstatek na účtu",
"deductBalance": "Odečíst zůstatek",
"totalAssets": "Přehled aktiv",
"type": {
"0": "Typ",
"1": "Dobití",

View File

@ -1,7 +1,9 @@
{
"accountBalance": "Kontostand",
"commission": "Provision",
"copyInviteLink": "Einladungslink kopieren",
"copySuccess": "Einladungslink erfolgreich kopiert",
"deductBalance": "Guthaben abziehen",
"inviteCode": "Einladungscode",
"recharge": "Aufladen"
}

View File

@ -1,8 +1,10 @@
{
"amount": "Betrag",
"balance": "Kontostand",
"commission": "Provision",
"createdAt": "Zeit",
"title": "Kontostand",
"deductBalance": "Guthaben abziehen",
"totalAssets": "Vermögensübersicht",
"type": {
"0": "Typ",
"1": "Aufladen",

View File

@ -1,7 +1,9 @@
{
"accountBalance": "Account Balance",
"commission": "Commission",
"copyInviteLink": "Copy Invite Link",
"copySuccess": "Invite Link Copied Successfully",
"deductBalance": "Deduct Balance",
"inviteCode": "Invite Code",
"recharge": "Recharge"
}

View File

@ -1,8 +1,10 @@
{
"amount": "Amount",
"balance": "Balance",
"commission": "Commission",
"createdAt": "Time",
"title": "Account Balance",
"deductBalance": "Deduct Balance",
"totalAssets": "Asset overview",
"type": {
"0": "Type",
"1": "Recharge",

View File

@ -1,7 +1,9 @@
{
"accountBalance": "Saldo de la cuenta",
"commission": "Comisión",
"copyInviteLink": "Copiar enlace de invitación",
"copySuccess": "Enlace de invitación copiado con éxito",
"deductBalance": "Descontar Saldo",
"inviteCode": "Código de invitación",
"recharge": "recargar"
}

View File

@ -1,8 +1,10 @@
{
"amount": "Cantidad",
"balance": "saldo",
"commission": "Comisión",
"createdAt": "hora",
"title": "Saldo de la cuenta",
"deductBalance": "Descontar Saldo",
"totalAssets": "Resumen de activos",
"type": {
"0": "tipo",
"1": "recarga",

View File

@ -1,7 +1,9 @@
{
"accountBalance": "Saldo de la cuenta",
"commission": "Comisión",
"copyInviteLink": "Copiar enlace de invitación",
"copySuccess": "Enlace de invitación copiado con éxito",
"deductBalance": "Descontar Saldo",
"inviteCode": "Código de invitación",
"recharge": "recargar"
}

View File

@ -1,8 +1,10 @@
{
"amount": "Monto",
"balance": "saldo",
"commission": "Comisión",
"createdAt": "Hora",
"title": "Saldo de la cuenta",
"deductBalance": "Descontar Saldo",
"totalAssets": "Resumen de activos",
"type": {
"0": "Tipo",
"1": "Recarga",

View File

@ -1,7 +1,9 @@
{
"accountBalance": "موجودی حساب",
"commission": "کمیسیون",
"copyInviteLink": "کپی کردن لینک دعوت",
"copySuccess": "لینک دعوت با موفقیت کپی شد",
"deductBalance": "کسر موجودی",
"inviteCode": "کد دعوت",
"recharge": "شارژ مجدد"
}

View File

@ -1,8 +1,10 @@
{
"amount": "مقدار",
"balance": "تعادل",
"commission": "کمیسیون",
"createdAt": "زمان",
"title": "موجودی حساب",
"deductBalance": "کسر موجودی",
"totalAssets": "بررسی کلی دارایی‌ها",
"type": {
"0": "نوع",
"1": "شارژ",

View File

@ -1,7 +1,9 @@
{
"accountBalance": "Tilin saldo",
"commission": "Komissio",
"copyInviteLink": "Kopioi kutsulinkki",
"copySuccess": "Kutsulinkki kopioitu onnistuneesti",
"deductBalance": "Vähennä saldoa",
"inviteCode": "kutsukoodi",
"recharge": "lataa saldoa"
}

View File

@ -1,8 +1,10 @@
{
"amount": "Määrä",
"balance": "Saldo",
"commission": "Komissio",
"createdAt": "Aika",
"title": "Tilin saldo",
"deductBalance": "Vähennä saldoa",
"totalAssets": "Varojen yleiskatsaus",
"type": {
"0": "Tyyppi",
"1": "Lataus",

View File

@ -1,7 +1,9 @@
{
"accountBalance": "Solde du compte",
"commission": "Commission",
"copyInviteLink": "Copier le lien d'invitation",
"copySuccess": "Lien d'invitation copié avec succès",
"deductBalance": "Déduire le solde",
"inviteCode": "codeInvitation",
"recharge": "Recharger"
}

View File

@ -1,8 +1,10 @@
{
"amount": "Montant",
"balance": "Solde",
"commission": "Commission",
"createdAt": "temps",
"title": "Solde du compte",
"deductBalance": "Déduire le solde",
"totalAssets": "Aperçu des actifs",
"type": {
"0": "Type",
"1": "Recharge",

View File

@ -1,7 +1,9 @@
{
"accountBalance": "खाता शेष",
"commission": "आयोग",
"copyInviteLink": "आमंत्रण लिंक कॉपी करें",
"copySuccess": "आमंत्रण लिंक सफलतापूर्वक कॉपी हो गई",
"deductBalance": "शेष राशि घटाएं",
"inviteCode": "आमंत्रण कोड",
"recharge": "रिचार्ज"
}

View File

@ -1,8 +1,10 @@
{
"amount": "राशि",
"balance": "शेष",
"commission": "आयोग",
"createdAt": "समय",
"title": "खाते का शेष",
"deductBalance": "शेष राशि घटाएं",
"totalAssets": "संपत्ति अवलोकन",
"type": {
"0": "प्रकार",
"1": "रिचार्ज",

View File

@ -1,7 +1,9 @@
{
"accountBalance": "Számlaegyenleg",
"commission": "Jutalék",
"copyInviteLink": "Meghívó link másolása",
"copySuccess": "A meghívó link másolása sikerült",
"deductBalance": "Egyenleg levonása",
"inviteCode": "meghívókód",
"recharge": "feltöltés"
}

View File

@ -1,8 +1,10 @@
{
"amount": "Összeg",
"balance": "Egyenleg",
"commission": "Jutalék",
"createdAt": "idő",
"title": "Számlaegyenleg",
"deductBalance": "Egyenleg levonása",
"totalAssets": "Eszközök áttekintése",
"type": {
"0": "Típus",
"1": "Feltöltés",

View File

@ -1,7 +1,9 @@
{
"accountBalance": "口座残高",
"commission": "手数料",
"copyInviteLink": "招待リンクをコピー",
"copySuccess": "招待リンクのコピーに成功しました",
"deductBalance": "残高を差し引く",
"inviteCode": "招待コード",
"recharge": "チャージ"
}

View File

@ -1,8 +1,10 @@
{
"amount": "金額",
"balance": "残高",
"commission": "手数料",
"createdAt": "時間",
"title": "アカウント残高",
"deductBalance": "残高を差し引く",
"totalAssets": "資産概要",
"type": {
"0": "タイプ",
"1": "チャージ",

View File

@ -1,7 +1,9 @@
{
"accountBalance": "계좌 잔액",
"commission": "커미션",
"copyInviteLink": "초대 링크 복사",
"copySuccess": "초대 링크가 성공적으로 복사되었습니다",
"deductBalance": "잔액 차감",
"inviteCode": "초대 코드",
"recharge": "충전"
}

View File

@ -1,8 +1,10 @@
{
"amount": "금액",
"balance": "잔액",
"commission": "위원회",
"createdAt": "시간",
"title": "계정 잔액",
"deductBalance": "잔액 차감",
"totalAssets": "자산 개요",
"type": {
"0": "유형",
"1": "충전",

View File

@ -1,7 +1,9 @@
{
"accountBalance": "Kontosaldo",
"commission": "Kommisjon",
"copyInviteLink": "Kopier invitasjonslenke",
"copySuccess": "Invitasjonslenke kopiert",
"deductBalance": "Trekk fra saldo",
"inviteCode": "invitasjonskode",
"recharge": "Lad opp"
}

View File

@ -1,8 +1,10 @@
{
"amount": "Beløp",
"balance": "Balanse",
"commission": "Kommisjon",
"createdAt": "Tid",
"title": "Kontosaldo",
"deductBalance": "Trekk fra saldo",
"totalAssets": "Eiendelsoversikt",
"type": {
"0": "Type",
"1": "Innskudd",

View File

@ -1,7 +1,9 @@
{
"accountBalance": "Saldo konta",
"commission": "Prowizja",
"copyInviteLink": "Skopiuj link zaproszenia",
"copySuccess": "Pomyślnie skopiowano link zaproszenia",
"deductBalance": "Potrąć saldo",
"inviteCode": "kod zaproszenia",
"recharge": "doładowanie"
}

View File

@ -1,8 +1,10 @@
{
"amount": "kwota",
"balance": "saldo",
"commission": "Prowizja",
"createdAt": "czas",
"title": "Saldo konta",
"deductBalance": "Potrąć saldo",
"totalAssets": "Przegląd aktywów",
"type": {
"0": "Typ",
"1": "Doładowanie",

View File

@ -1,7 +1,9 @@
{
"accountBalance": "Saldo da Conta",
"commission": "Comissão",
"copyInviteLink": "Copiar link de convite",
"copySuccess": "Link de convite copiado com sucesso",
"deductBalance": "Deduzir Saldo",
"inviteCode": "Código de Convite",
"recharge": "recarregar"
}

View File

@ -1,8 +1,10 @@
{
"amount": "quantia",
"balance": "saldo",
"commission": "Comissão",
"createdAt": "hora",
"title": "Saldo da Conta",
"deductBalance": "Deduzir Saldo",
"totalAssets": "Visão geral dos ativos",
"type": {
"0": "tipo",
"1": "recarga",

View File

@ -1,7 +1,9 @@
{
"accountBalance": "Soldul contului",
"commission": "Comision",
"copyInviteLink": "Copiază linkul de invitație",
"copySuccess": "Linkul de invitație a fost copiat cu succes",
"deductBalance": "Scade Soldul",
"inviteCode": "Cod de invitație",
"recharge": "Reîncărcare"
}

View File

@ -1,8 +1,10 @@
{
"amount": "Sumă",
"balance": "Sold",
"commission": "Comision",
"createdAt": "Timp",
"title": "Soldul contului",
"deductBalance": "Scade Soldul",
"totalAssets": "Prezentare generală a activelor",
"type": {
"0": "Tip",
"1": "Reîncărcare",

View File

@ -1,7 +1,9 @@
{
"accountBalance": "Баланс счета",
"commission": "Комиссия",
"copyInviteLink": "Скопировать ссылку приглашения",
"copySuccess": "Ссылка для приглашения успешно скопирована",
"deductBalance": "Списать с баланса",
"inviteCode": "Код приглашения",
"recharge": "Пополнение"
}

View File

@ -1,8 +1,10 @@
{
"amount": "сумма",
"balance": "Баланс",
"commission": "Комиссия",
"createdAt": "время",
"title": "Баланс счета",
"deductBalance": "Списать с баланса",
"totalAssets": "Обзор активов",
"type": {
"0": "Тип",
"1": "Пополнение",

View File

@ -1,7 +1,9 @@
{
"accountBalance": "ยอดเงินในบัญชี",
"commission": "คอมมิชชั่น",
"copyInviteLink": "คัดลอกลิงก์เชิญ",
"copySuccess": "คัดลอกลิงก์เชิญสำเร็จ",
"deductBalance": "หักยอดเงิน",
"inviteCode": "รหัสเชิญ",
"recharge": "เติมเงิน"
}

View File

@ -1,8 +1,10 @@
{
"amount": "จำนวนเงิน",
"balance": "ยอดคงเหลือ",
"commission": "คอมมิชชั่น",
"createdAt": "เวลา",
"title": "ยอดคงเหลือในบัญชี",
"deductBalance": "หักยอดเงิน",
"totalAssets": "ภาพรวมสินทรัพย์",
"type": {
"0": "ประเภท",
"1": "เติมเงิน",

View File

@ -1,7 +1,9 @@
{
"accountBalance": "Hesap Bakiyesi",
"commission": "Komisyon",
"copyInviteLink": "Davet Bağlantısını Kopyala",
"copySuccess": "Davet bağlantısı başarıyla kopyalandı",
"deductBalance": "Bakiyeden Düş",
"inviteCode": "davetKodu",
"recharge": "şarj et"
}

View File

@ -1,8 +1,10 @@
{
"amount": "Tutar",
"balance": "Bakiye",
"commission": "Komisyon",
"createdAt": "zaman",
"title": "Hesap Bakiyesi",
"deductBalance": "Bakiyeden Düş",
"totalAssets": "Varlık genel bakışı",
"type": {
"0": "Tür",
"1": "Yükleme",

View File

@ -1,7 +1,9 @@
{
"accountBalance": "Баланс рахунку",
"commission": "Комісія",
"copyInviteLink": "Скопіювати посилання запрошення",
"copySuccess": "Посилання для запрошення успішно скопійовано",
"deductBalance": "Відняти баланс",
"inviteCode": "Код запрошення",
"recharge": "Поповнення"
}

View File

@ -1,8 +1,10 @@
{
"amount": "Сума",
"balance": "Баланс",
"commission": "Комісія",
"createdAt": "Час",
"title": "Баланс рахунку",
"deductBalance": "Відняти баланс",
"totalAssets": "Огляд активів",
"type": {
"0": "Тип",
"1": "Поповнення",

View File

@ -1,7 +1,9 @@
{
"accountBalance": "Số dư tài khoản",
"commission": "Hoa hồng",
"copyInviteLink": "Sao chép liên kết mời",
"copySuccess": "Sao chép liên kết mời thành công",
"deductBalance": "Trừ Số Dư",
"inviteCode": "Mã mời",
"recharge": "Nạp tiền"
}

View File

@ -1,8 +1,10 @@
{
"amount": "Số tiền",
"balance": "Số dư",
"commission": "Hoa hồng",
"createdAt": "Thời gian",
"title": "Số dư tài khoản",
"deductBalance": "Trừ Số Dư",
"totalAssets": "Tổng quan tài sản",
"type": {
"0": "Loại",
"1": "Nạp tiền",

View File

@ -1,7 +1,9 @@
{
"accountBalance": "账户余额",
"commission": "佣金",
"copyInviteLink": "复制邀请链接",
"copySuccess": "邀请链接复制成功",
"deductBalance": "抵扣余额",
"inviteCode": "邀请码",
"recharge": "充值"
}

View File

@ -1,8 +1,10 @@
{
"amount": "金额",
"balance": "余额",
"commission": "佣金",
"createdAt": "时间",
"title": "账户余额",
"deductBalance": "抵扣余额",
"totalAssets": "资产概览",
"type": {
"0": "类型",
"1": "充值",

View File

@ -1,7 +1,9 @@
{
"accountBalance": "帳戶餘額",
"commission": "佣金",
"copyInviteLink": "複製邀請連結",
"copySuccess": "邀請連結複製成功",
"deductBalance": "抵扣餘額",
"inviteCode": "邀請碼",
"recharge": "儲值"
}

View File

@ -1,8 +1,10 @@
{
"amount": "金額",
"balance": "餘額",
"commission": "佣金",
"createdAt": "時間",
"title": "帳戶餘額",
"deductBalance": "抵扣餘額",
"totalAssets": "資產概覽",
"type": {
"0": "類型",
"1": "充值",

View File

@ -165,6 +165,7 @@ declare namespace API {
quantity: number;
price: number;
amount: number;
deduction: number;
discount: number;
coupon: string;
coupon_discount: number;
@ -173,8 +174,6 @@ declare namespace API {
trade_no: string;
status: number;
subscribe_id: number;
subscription_discount_id: number;
subscription_discount_price: number;
created_at: number;
updated_at: number;
};
@ -187,6 +186,7 @@ declare namespace API {
quantity: number;
price: number;
amount: number;
deduction: number;
discount: number;
coupon: string;
coupon_discount: number;
@ -196,8 +196,6 @@ declare namespace API {
status: number;
subscribe_id: number;
subscribe: Subscribe;
subscription_discount_id: number;
subscription_discount_price: number;
created_at: number;
updated_at: number;
};
@ -333,7 +331,7 @@ declare namespace API {
sell: boolean;
sort: number;
deduction_ratio: number;
purchase_with_discount: boolean;
allow_deduction: boolean;
reset_cycle: number;
renewal_reset: boolean;
created_at: number;
@ -416,6 +414,8 @@ declare namespace API {
email: string;
avatar: string;
balance: number;
commission: number;
deduction: number;
telegram: number;
refer_code: string;
referer_id: number;

View File

@ -187,6 +187,7 @@ declare namespace API {
quantity: number;
price: number;
amount: number;
deduction: number;
discount: number;
coupon: string;
coupon_discount: number;
@ -195,8 +196,6 @@ declare namespace API {
trade_no: string;
status: number;
subscribe_id: number;
subscription_discount_id: number;
subscription_discount_price: number;
created_at: number;
updated_at: number;
};
@ -209,6 +208,7 @@ declare namespace API {
quantity: number;
price: number;
amount: number;
deduction: number;
discount: number;
coupon: string;
coupon_discount: number;
@ -218,8 +218,6 @@ declare namespace API {
status: number;
subscribe_id: number;
subscribe: Subscribe;
subscription_discount_id: number;
subscription_discount_price: number;
created_at: number;
updated_at: number;
};
@ -241,23 +239,29 @@ declare namespace API {
price: number;
amount: number;
discount: number;
deduction: number;
coupon: string;
coupon_discount: number;
fee_amount: number;
subscribe_discount: number;
discount_list: SubscribeDiscountInfo[];
};
type PreRenewalOrderResponse = {
orderNo: string;
};
type PreUnsubscribeRequest = {
id: number;
};
type PreUnsubscribeResponse = {
deduction_amount: number;
};
type PurchaseOrderRequest = {
subscribe_id: number;
quantity: number;
payment: string;
coupon?: string;
discount_subscribe_id: number;
};
type PurchaseOrderResponse = {
@ -329,8 +333,22 @@ declare namespace API {
total: number;
};
type QueryUserAffiliateResponse = {
sum: number;
type QueryUserAffiliateCountResponse = {
registers: number;
total_commission: number;
};
type QueryUserAffiliateListParams = {
page: number;
size: number;
};
type QueryUserAffiliateListRequest = {
page: number;
size: number;
};
type QueryUserAffiliateListResponse = {
list: UserAffiliate[];
total: number;
};
@ -366,12 +384,10 @@ declare namespace API {
};
type RenewalOrderRequest = {
subscribe_id: number;
user_subscribe_id: number;
quantity: number;
payment: string;
coupon?: string;
subscribe_token: string;
discount_subscribe_id: number;
};
type RenewalOrderResponse = {
@ -379,8 +395,7 @@ declare namespace API {
};
type ResetTrafficOrderRequest = {
subscribe_id: number;
subscribe_token: string;
user_subscribe_id: number;
payment: string;
};
@ -485,7 +500,7 @@ declare namespace API {
sell: boolean;
sort: number;
deduction_ratio: number;
purchase_with_discount: boolean;
allow_deduction: boolean;
reset_cycle: number;
renewal_reset: boolean;
created_at: number;
@ -504,13 +519,6 @@ declare namespace API {
discount: number;
};
type SubscribeDiscountInfo = {
id: number;
name: string;
price: number;
expire_time: string;
};
type SubscribeGroup = {
id: number;
name: string;
@ -570,6 +578,10 @@ declare namespace API {
security_config: SecurityConfig;
};
type UnsubscribeRequest = {
id: number;
};
type UpdateUserNotifyRequest = {
enable_balance_notify: boolean;
enable_login_notify: boolean;
@ -597,6 +609,8 @@ declare namespace API {
email: string;
avatar: string;
balance: number;
commission: number;
deduction: number;
telegram: number;
refer_code: string;
referer_id: number;

View File

@ -2,10 +2,10 @@
/* eslint-disable */
import request from '@/utils/request';
/** Query User Affiliate GET /v1/public/user/affiliate */
/** Query User Affiliate Count GET /v1/public/user/affiliate/count */
export async function queryUserAffiliate(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.QueryUserAffiliateResponse }>(
'/v1/public/user/affiliate',
return request<API.Response & { data?: API.QueryUserAffiliateCountResponse }>(
'/v1/public/user/affiliate/count',
{
method: 'GET',
...(options || {}),
@ -13,6 +13,24 @@ export async function queryUserAffiliate(options?: { [key: string]: any }) {
);
}
/** Query User Affiliate List GET /v1/public/user/affiliate/list */
export async function queryUserAffiliateList(
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
params: API.QueryUserAffiliateListParams,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: API.QueryUserAffiliateListResponse }>(
'/v1/public/user/affiliate/list',
{
method: 'GET',
params: {
...params,
},
...(options || {}),
},
);
}
/** Query User Balance Log GET /v1/public/user/balance_log */
export async function queryUserBalanceLog(options?: { [key: string]: any }) {
return request<API.Response & { data?: API.QueryUserBalanceLogListResponse }>(
@ -106,3 +124,33 @@ export async function unbindTelegram(options?: { [key: string]: any }) {
...(options || {}),
});
}
/** 此处后端没有提供注释 POST /v1/public/user/unsubscribe */
export async function unsubscribe(body: API.UnsubscribeRequest, options?: { [key: string]: any }) {
return request<API.Response & { data?: any }>('/v1/public/user/unsubscribe', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
});
}
/** Pre Unsubscribe POST /v1/public/user/unsubscribe/pre */
export async function preUnsubscribe(
body: API.PreUnsubscribeRequest,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: API.PreUnsubscribeResponse }>(
'/v1/public/user/unsubscribe/pre',
{
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
data: body,
...(options || {}),
},
);
}