From b13c77e9b7f686057cf86d0d7d1dc3431815b489 Mon Sep 17 00:00:00 2001 From: "web@ppanel" Date: Wed, 8 Jan 2025 23:25:13 +0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(user):=20Add=20'gift=5Famount'?= =?UTF-8?q?=20field=20and=20update=20related=20references=20in=20user=20se?= =?UTF-8?q?rvices=20and=20components?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/admin/services/admin/typings.d.ts | 4 ++++ apps/user/app/(main)/(user)/payment/page.tsx | 12 ++++++------ apps/user/app/(main)/(user)/sidebar-right.tsx | 2 +- apps/user/app/(main)/(user)/wallet/page.tsx | 4 ++-- apps/user/components/subscribe/unsubscribe.tsx | 3 ++- apps/user/services/user/typings.d.ts | 1 + 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/apps/admin/services/admin/typings.d.ts b/apps/admin/services/admin/typings.d.ts index 9ced54f..2e02acc 100644 --- a/apps/admin/services/admin/typings.d.ts +++ b/apps/admin/services/admin/typings.d.ts @@ -192,6 +192,8 @@ declare namespace API { referer_user: string; refer_code: string; balance: number; + commission: number; + gift_amount: number; is_admin: boolean; }; @@ -989,6 +991,8 @@ declare namespace API { password: string; avatar: string; balance: number; + commission: number; + gift_amount: number; telegram: number; refer_code: string; referer_id: number; diff --git a/apps/user/app/(main)/(user)/payment/page.tsx b/apps/user/app/(main)/(user)/payment/page.tsx index b0e3be5..c4b01ad 100644 --- a/apps/user/app/(main)/(user)/payment/page.tsx +++ b/apps/user/app/(main)/(user)/payment/page.tsx @@ -29,14 +29,14 @@ import StripePayment from './stripe'; export default function Page() { const t = useTranslations('order'); const { getUserInfo } = useGlobalStore(); - const [order_no, setOrderNo] = useState(); + const [orderNo, setOrderNo] = useState(); const [enabled, setEnabled] = useState(false); const { data } = useQuery({ enabled: enabled, - queryKey: ['queryOrderDetail', order_no], + queryKey: ['queryOrderDetail', orderNo], queryFn: async () => { - const { data } = await queryOrderDetail({ order_no: order_no! }); + const { data } = await queryOrderDetail({ order_no: orderNo! }); if (data?.data?.status !== 1) { getUserInfo(); setEnabled(false); @@ -47,10 +47,10 @@ export default function Page() { }); const { data: payment } = useQuery({ - enabled: !!order_no && data?.status === 1, - queryKey: ['checkoutOrder', order_no], + enabled: !!orderNo && data?.status === 1, + queryKey: ['checkoutOrder', orderNo], queryFn: async () => { - const { data } = await checkoutOrder({ orderNo: order_no! }); + const { data } = await checkoutOrder({ orderNo: orderNo! }); return data?.data; }, }); diff --git a/apps/user/app/(main)/(user)/sidebar-right.tsx b/apps/user/app/(main)/(user)/sidebar-right.tsx index 9d75647..f618b5b 100644 --- a/apps/user/app/(main)/(user)/sidebar-right.tsx +++ b/apps/user/app/(main)/(user)/sidebar-right.tsx @@ -39,7 +39,7 @@ export function SidebarRight({ ...props }: React.ComponentProps) {t('giftAmount')} - + diff --git a/apps/user/app/(main)/(user)/wallet/page.tsx b/apps/user/app/(main)/(user)/wallet/page.tsx index eaf6916..6787e07 100644 --- a/apps/user/app/(main)/(user)/wallet/page.tsx +++ b/apps/user/app/(main)/(user)/wallet/page.tsx @@ -16,7 +16,7 @@ export default function Page() { const t = useTranslations('wallet'); const { user } = useGlobalStore(); const ref = useRef(null); - const totalAssets = (user?.balance || 0) + (user?.commission || 0) + (user?.deduction || 0); + const totalAssets = (user?.balance || 0) + (user?.commission || 0) + (user?.gift_amount || 0); return ( <> @@ -47,7 +47,7 @@ export default function Page() { {t('giftAmount')}

- +

diff --git a/apps/user/components/subscribe/unsubscribe.tsx b/apps/user/components/subscribe/unsubscribe.tsx index d3d5175..4c11a17 100644 --- a/apps/user/components/subscribe/unsubscribe.tsx +++ b/apps/user/components/subscribe/unsubscribe.tsx @@ -27,7 +27,7 @@ interface UnsubscribeProps { export default function Unsubscribe({ id, allowDeduction }: Readonly) { const t = useTranslations('subscribe.unsubscribe'); const router = useRouter(); - const { common } = useGlobalStore(); + const { common, getUserInfo } = useGlobalStore(); const single_model = common.subscribe.single_model; const [open, setOpen] = useState(false); @@ -51,6 +51,7 @@ export default function Unsubscribe({ id, allowDeduction }: Readonly