From 0f7dfc09527392a9fc498db87e0f4c6ceb336fda Mon Sep 17 00:00:00 2001 From: yezian Date: Tue, 16 Apr 2024 17:49:14 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=AE=8C=E6=88=90?= =?UTF-8?q?=E7=A9=BA=E9=97=B4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/[user_id]/_components/WechatBar/index.jsx | 2 +- app/purchased/page.jsx | 2 +- .../[user_id]/_components/WechatBar/index.jsx | 2 +- app/withdrawal/page.jsx | 2 +- app/zone/[user_id]/page.jsx | 203 ++++++++++++ .../[zid]/[product_id]/[moment_id]/page.jsx | 298 ++++++++++++++++++ public/images/ID.png | Bin 0 -> 398 bytes public/images/edit.png | Bin 0 -> 298 bytes public/images/pinkline.png | Bin 0 -> 461 bytes public/images/tiefen.png | Bin 0 -> 840 bytes public/images/wechat.png | Bin 0 -> 1125 bytes 11 files changed, 505 insertions(+), 4 deletions(-) create mode 100644 app/zone/[user_id]/page.jsx create mode 100644 app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx create mode 100644 public/images/ID.png create mode 100644 public/images/edit.png create mode 100644 public/images/pinkline.png create mode 100644 public/images/tiefen.png create mode 100644 public/images/wechat.png diff --git a/app/[user_id]/_components/WechatBar/index.jsx b/app/[user_id]/_components/WechatBar/index.jsx index 2d75da9..8226462 100644 --- a/app/[user_id]/_components/WechatBar/index.jsx +++ b/app/[user_id]/_components/WechatBar/index.jsx @@ -127,7 +127,7 @@ export default function WechatBar({ -
+

购买成功后请到"账号"-"已购"添加Ta的微信,若超72小时未添加成功请联系客服

diff --git a/app/purchased/page.jsx b/app/purchased/page.jsx index 4bb39c5..d1629ae 100644 --- a/app/purchased/page.jsx +++ b/app/purchased/page.jsx @@ -171,7 +171,7 @@ export default function Purchased() { }; return ( -
+

Ta的微信号:{currentWechat}

diff --git a/app/tool/[user_id]/_components/WechatBar/index.jsx b/app/tool/[user_id]/_components/WechatBar/index.jsx index 9ab2aa7..ef5498c 100644 --- a/app/tool/[user_id]/_components/WechatBar/index.jsx +++ b/app/tool/[user_id]/_components/WechatBar/index.jsx @@ -98,7 +98,7 @@ export default function WechatBar({ price, streamerMid }) {
-
+

购买成功后请到"账号"-"已购"添加Ta的微信,若超72小时未添加成功请联系客服

diff --git a/app/withdrawal/page.jsx b/app/withdrawal/page.jsx index d4f385f..1c207b8 100644 --- a/app/withdrawal/page.jsx +++ b/app/withdrawal/page.jsx @@ -403,7 +403,7 @@ export default function WithDrawal() { 4.自助提现渠道每日只能提现一次,若有更多提现需求,请联系客服。

-
+

提现金额: ¥{withdrawalNum / 10} diff --git a/app/zone/[user_id]/page.jsx b/app/zone/[user_id]/page.jsx new file mode 100644 index 0000000..9e9be93 --- /dev/null +++ b/app/zone/[user_id]/page.jsx @@ -0,0 +1,203 @@ +"use client"; + +import React, { useState, useEffect } from "react"; +import Image from "next/image"; +import pinkline from "@/public/images/pinkline.png"; +import ID from "@/public/images/ID.png"; +import tiefen from "@/public/images/tiefen.png"; +import wechat from "@/public/images/wechat.png"; +import { Toast } from "antd-mobile"; +import baseRequest from "@/utils/baseRequest"; +import { generateSignature } from "@/utils/crypto"; +import copy from "@/utils/copy"; +import { setCookie } from "cookies-next"; +import Link from "next/link"; + +export default function Zone({ params }) { + //页面数据 + const [data, setData] = useState({}); + useEffect(() => { + const getData = async () => { + try { + const base = baseRequest(); + const body = { + user_id: parseInt(params.user_id, 10), + ...base, + }; + const signature = generateSignature(body); + const _response = await fetch( + `/api/zone/list_by_user_id_from_outside?signature=${signature}`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(body), + } + ); + const _data = await _response.json(); + if (_data.ret === -1) { + Toast.show({ + content: _data.msg, + }); + return; + } + setData(_data.data.list[0]); + } catch (error) { + console.error(error); + } + }; + getData(); + }, []); + + //将主播链接复制到剪贴板,并存cookie + const copyAndSetCookieInviter = () => { + setCookie("inviter", data?.streamer_ext?.user_id); + copy( + `【${data?.streamer_ext?.name}】『ID:${data?.streamer_ext?.user_id}』,复制此条消息,打开铁粉空间APP,查看详情https://tiefen.fun/zone/${data?.streamer_ext?.user_id}` + ); + }; + + return ( +

+
+
+ +
+
+
+ +
+

+ {data?.streamer_ext?.name} +

+
+
+ +

+ {data?.streamer_ext?.user_id} +

+
+
+
+
+
+
+

+ {data?.zone_moment_count} +

+

动态

+
+
+

{data?.image_count}

+

照片

+
+
+

{data?.video_count}

+

视频

+
+
+
+
+
+

空间介绍

+ +
+
+
+
+

{data?.profile}

+
+ {data?.streamer_ext?.album?.images?.map((item, index) => { + if (index > 2) return; + return ( +
+ +
+ ); + })} +
+
+
+
document.getElementById("comfirm_modal").showModal()} + > + +

查看更多内容

+
+
document.getElementById("comfirm_modal").showModal()} + > + +

解锁Ta的微信

+
+
+
+
{ + copyAndSetCookieInviter(); + document.getElementById("comfirm_modal").showModal(); + }} + > + 立即加入 +
+
+
+
+
+

加入须知

+ +
+
+
+
+

+ 阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴 +

+
+ +
+

+ {`请打开或下载【铁粉空间】APP,根据APP内弹窗指引加入空间。如未弹出,请在APP搜索ID:${data?.streamer_ext?.user_id},加入空间。`} +

+
+ +

确认

+ +
+ +
+
+
+
+
+ ); +} diff --git a/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx b/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx new file mode 100644 index 0000000..4ed7803 --- /dev/null +++ b/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx @@ -0,0 +1,298 @@ +"use client"; + +import React, { useState, useEffect } from "react"; +import Divider from "@/components/Divider"; +import Link from "next/link"; +import { Toast, Switch } from "antd-mobile"; +import { generateSignature } from "@/utils/crypto"; +import webviewBaseRequest from "@/utils/webviewBaseRequest"; + +export default function Pay({ params }) { + //当前选购的商品数据 + const [data, setData] = useState({}); + //超粉商品数据 + const [superfanshipData, setSuperfanshipData] = useState({}); + const [isFetching, setIsFetching] = useState(true); + useEffect(() => { + const getData = async () => { + try { + const base = webviewBaseRequest(); + const body = { + zid: parseInt(params.zid), + moment_id: parseInt(params.moment_id), + product_id: params.product_id, + ...base, + }; + const signature = generateSignature(body); + const response = await fetch( + `/api/zone/get_cashier?signature=${signature}`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(body), + } + ); + const temData = await response.json(); + console.log(temData); + if (temData.ret === -1) { + Toast.show({ + content: temData.msg, + }); + return; + } + setData(temData.data); + setIsFetching(false); + } catch (error) { + console.error(error); + } + }; + const getSuperfanshipData = async () => { + try { + const base = webviewBaseRequest(); + const body = { + zid: parseInt(params.zid), + product_id: "h5_zone_superfanship", + ...base, + }; + const signature = generateSignature(body); + const response = await fetch( + `/api/zone/get_cashier?signature=${signature}`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(body), + } + ); + const temData = await response.json(); + console.log(temData); + if (temData.ret === -1) { + Toast.show({ + content: temData.msg, + }); + return; + } + setSuperfanshipData(temData.data); + } catch (error) { + console.error(error); + } + }; + setTimeout(() => { + getData(); + getSuperfanshipData(); + }, 500); + }, []); + + //是否勾选购买超粉switch组件 + const [checked, setChecked] = useState( + params.product_id === "h5_zone_superfanship" ? true : false + ); + + //创建订单 + const [isLoading, setIsLoading] = useState(false); + const createOrder = async (type = "alipay_h5") => { + const base = webviewBaseRequest(); + const body = { + ...base, + zid: parseInt(params.zid), + moment_id: parseInt(params.moment_id), + product_id: checked ? "h5_zone_superfanship" : params.product_id, + pay_type: type, + from: "app", + }; + + setIsLoading(true); + + const signature = generateSignature(body); + try { + const response = await fetch( + `/api/zone/create_order?signature=${signature}`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(body), + } + ); + const data = await response.json(); + if (data.ret === -1) { + Toast.show({ + content: data.msg, + }); + return; + } + switch (type) { + case "alipay_h5": + router.push(`${data.data.alipay_h5_param_str}`); + break; + case "wxpay_h5": + router.push( + `https://weixin.tiefen.fun/pay/wxpay_h5/${encodeURIComponent( + data.data.wxpay_h5_param_str + )}` + ); + break; + default: + router.push(`${data.data.alipay_h5_param_str}`); + break; + } + } catch (error) { + console.error(error); + } finally { + setIsLoading(false); + } + }; + + if (isFetching) { + return ( +
+ +
+ ); + } + + return ( +
+ {isLoading && ( + + )} +

+ ¥ {checked ? superfanshipData?.price / 100 : data?.price / 100} +

+
+

付费商品:

+

+ {checked ? superfanshipData?.name : data?.name} +

+
+ +
+

有效期:

+

+ {checked ? superfanshipData?.validity : data?.validity} +

+
+ + {params.product_id === "h5_zone_moment" && ( +
+
+

+ 开通超粉,空间动态免费看 +

+ {superfanshipData?.is_superfanship_give_wechat === 1 && ( +
+ + + +

+ 额外附赠空间主人私人微信 +

+
+ )} +
+ setChecked(!checked)} + style={{ + "--checked-color": "#FFD685", + "--height": "30px", + "--width": "60px", + }} + /> +
+ )} + {params.product_id === "h5_zone_superfanship" && + superfanshipData?.is_superfanship_give_wechat === 1 && ( +
+ + + +

+ 额外附赠空间主人私人微信 +

+
+ )} + {checked ? ( +
+

购买须知:

+

+ 1、开通超粉后可在有效期内免费查看当前空间内的所有动态内容; +
+ 2、当前开通的超粉仅在当前空间内生效,请确认空间主人与超粉有效期; +
+ 3、若空间主人提供了开通超粉赠送微信服务,请在开通后在空间内点击【查看微信】; +
+ 4、虚拟商品一经售出不予退款,请确认阅读上述条款并无异议后进行购买; +
+ 5、本项特权内容最终解释权归铁粉空间运营方所有。 +

+
+ ) : params.product_id === "h5_zone_moment" ? ( +
+

购买须知:

+

+ 1、当前购买内容为本空间内特定单条动态的查阅权限,如需要查阅空间内全部动态请开通超粉; +
+ 2、本次消费将计入本空间内铁粉进度,铁粉进度达标后,可查看本空间内铁粉专享动态内容; +
+ 3、虚拟商品一经售出不予退款,请确认阅读上述条款并无异议后进行购买; +
+ 4、本项特权内容最终解释权归铁粉空间运营方所有。 +

+
+ ) : ( +
+

购买须知:

+

+ 1、当前购买内容为本空间成员身份; +
+ 2、成为空间成员后可查看本空间内成员可见内容查阅权限; +
+ 3、虚拟商品一经售出不予退款,请确认阅读上述条款并无异议后进行购买; +
+ 4、本项特权内容最终解释权归铁粉空间运营方所有。 +

+
+ )} +
+
+
+
+
+
createOrder("wxpay_h5")} + className="flex flex-row cursor-pointer gap-1.5 h-11 items-center justify-center bg-primary rounded-full" + > + + + +

+ 微信支付 +

+
+
+
+

+ 确认购买即视为同意 + + 《用户充值协议》 + +

+
+
+
+ ); +} diff --git a/public/images/ID.png b/public/images/ID.png new file mode 100644 index 0000000000000000000000000000000000000000..3d16343ceca1d9c06e01c89d78f1e75ac4221ff4 GIT binary patch literal 398 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k1|%Oc%$NbBI14-?iy0UcEkKyjb(&!UP>``W z$lZxy-8q?;Kn_c~qpu?a!^VE@KZ&eBIb}~5$B+ufx6>MVn+yb8*B@h)S?IUOFX4`Z zc>%Kwqj~_4l3+A{!I2ZNK1fK%-LX}9;=U(Ly8AyojH+U2bVx|zSQVVT_jvP~lA}%? zcP`3&+`wR;)^q4Y!Jel4i>24jm9Df`->Cm8m91utpT$5NQB$mbuc{W-7`~p_d=oFhw}WscU>wvxA07+x7U$O56fK7 z&SMd&aTdH!V_oL7-P$%&e6nAp`Z1rGi-6p1e$jzSV$REA8k4rK|FmFBvy_qainWbG zEB-1ex~`o!FL!2UCfuV3$vH|A?(fx*Y%>FVdQ&MBb@05)@+DgXcg literal 0 HcmV?d00001 diff --git a/public/images/edit.png b/public/images/edit.png new file mode 100644 index 0000000000000000000000000000000000000000..65cc989fa091a4eebb4fff9720c420c4b75afbf1 GIT binary patch literal 298 zcmeAS@N?(olHy`uVBq!ia0vp^svyk43?x4}TrdPuW&u7Su0Z-f>EL7Xu|Ghaf+azI z!3+us`yJ-r7nl%mzTV*dhK2&YsgIg~l9N1L978NlKfUbDcUXbPHBg2_ZGPRJ|7XJl zx2#|GqBP31{J;S#p?MZ_bf%_vMWzRtm~4NTW4U+n*%)u_Rst whObXq^XFVdQ&MBb@03#lg-v9sr literal 0 HcmV?d00001 diff --git a/public/images/pinkline.png b/public/images/pinkline.png new file mode 100644 index 0000000000000000000000000000000000000000..f03c33c4f5ba16a0e0c26a7cbe7ae8e9ac99f87f GIT binary patch literal 461 zcmeAS@N?(olHy`uVBq!ia0vp^2|z5t!3-pg%sG|;DVqSF5LY1mKY#xJ^!fi&=l#!^ z4?=14{-*)Sx&PB)3?MfJ$OQ_5Q5H}!NZHKy-MK*h!X-g|!3+ZX-zzxWPiUA>U$DMl ze!zJHgZ~?Bw=*y>>Uz33hIkx*I_c)RW&<9V%{L+yxF`Jof8CpLDvSC;e%D<==Y^%* zmHXMh**oT&Y*_xF*+*Mzle@!oz9+(x0ZW8`msWFVx`&)&U$NEv*z1lx<526SEs!wHNGa)xtn{~ZR)O) zmCZ$N`hRSG{Ir~KG`G}zv&mx)Y0GTJ>&H(dEn;B^y?;k3-S$|L?{6))%c6k zf5GAZZ$AI;+4jG3)&H+Q|6hOhzhKG#rVamBp7{Ux?f*Sj|4-ZVbKaT-K%0b0g8YIR z6y7)7H`rg0ATZzI{Q7|Y3Gt~FTc!lgM(wy zzyJPzk_*dP`6RPveLhyVb+d;DbKskso1bqlK69#g*0Sf`s()FH_V3}o=`RBXrdaBpU30o9+H(%;g=sY^-(IedhrJ1WmrxWUHBJ zN(cQ;TLuN!)vXlu{QhHwd@%o(Mcekfq-^gxFJ^K|e793k;G%hd%u7Q4y_mphs@8p6 zVEr#&#}JE*%7oKX|Ol*WJvLCA1w*q%hIYJ__FS>ht)uC%fM*F7TseL1@_p4~O7Tc-2E9c*L-Td~#jkkZFt4X)M zn?8F>$o`68_xI1_XRL7i{MazJGHrK_f4cOVc>Q>dqf>3Ko)ao!+W2pt?Zr#BPHTO) z?mH`=E5qXB`&!DU#4yxZ>Op3F*Y~FnChFWvSk%$;hIfHEmzK}1I{um;FU@zUN3BX~S2Ku2xIqR<6&_e!rT}+S_9@d+EYMF?uVG9h~r_!?N1IVW+wU{;Tw7o6 ze%~0J@9}l^_wz@KHqMfd{vhF$_11dMF{KHc!=KJvWN}kzZOqifM<2YeEQoCL{Ij}J zXzHxyg}(A(*^7ieCvy9@{&4H9$-4a7ET?U<1Md=bexdlQ@v|#<9iGne;G3Es1Vmdu z&MZB^quzYVY@)=f<2^zlpF(HUOq~TmKB9lEY&uT{^~$-|HlGX=1j+mfVV|*5BwBU; p4HNNbx3J1M(WLY9Y!CinowxeSKgaiCvw#Ve!PC{xWt~$(69DXAxlaH9 literal 0 HcmV?d00001 diff --git a/public/images/wechat.png b/public/images/wechat.png new file mode 100644 index 0000000000000000000000000000000000000000..382b389efc9b0f48579065a36cef1d643b323297 GIT binary patch literal 1125 zcmV-r1e*JaP)ZjTF;@SA( z+W6v)>!XR9lhjtMECqqfwz4YxkHRoZKCIqFU4**!_Aj#S=5vhLU^6ts=HEMXH}S| zfmo)Tj75vo~jbq0Q`ouG06csC|P9G<$ z$&v~Nsui>1WLZ>F7wg*ZAwjIfKl|BQVD7+NK@H8xcVj+@wRl&7z*ttVn$`NO1AP!p@wQ~Ev`PCON2&1q5B#T zq6}0_lm$~5Z6WKak+Mr~MrMXpw?qy0Sp1dI>cBJ)gLU~`M=}~6m=>|_&`?tISVnAA z!eqks&wM^mZOQRw6hPWg&AJXl{%2|`l~5p;-p)`O){NU>;LH3Cq29+&WTU}Cvxt1y zSlhFqs#FUU{Tq&eP2Rw{Tv+r(#l*kVdAn#(ei@w03FZq>A}%DD!Kt+lU%|P<`D0J6 z*#Z}Lc2g3$vy2nyrgSS8POs^1ea1pjcQ{Hu?imcp+Nj2PP?i<5^)!?MisLzJrqFT) zGzC<7ktpl0_QU8o{|6>J#4HuY{La%8Sep&kv$cx%2NK5Pr7cNHemWP zd&L|tU%9BX@GZ>D)3XN>vd^F5e63~=q^fdFpd0;|TAd%Owqh1=X+#RS+iiGo@j>C! z?p1K|9uPh{ZaR*WSQP-Ll<}GJs3CDIwDNt<;Lwoc0jbL0fVvpx;lcNBU4- Date: Tue, 16 Apr 2024 20:39:02 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E4=BC=98=E5=8C=96ui=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E8=A1=A5bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/zone/[user_id]/page.jsx | 12 +- .../[zid]/[product_id]/[moment_id]/page.jsx | 259 +++++++++--------- 2 files changed, 141 insertions(+), 130 deletions(-) diff --git a/app/zone/[user_id]/page.jsx b/app/zone/[user_id]/page.jsx index 9e9be93..015c4c0 100644 --- a/app/zone/[user_id]/page.jsx +++ b/app/zone/[user_id]/page.jsx @@ -70,11 +70,13 @@ export default function Zone({ params }) {
- +
+ +

{data?.streamer_ext?.name} diff --git a/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx b/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx index 4ed7803..3fe929f 100644 --- a/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx +++ b/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx @@ -6,8 +6,11 @@ import Link from "next/link"; import { Toast, Switch } from "antd-mobile"; import { generateSignature } from "@/utils/crypto"; import webviewBaseRequest from "@/utils/webviewBaseRequest"; +import { useRouter } from "next/navigation"; export default function Pay({ params }) { + const router = useRouter(); + //当前选购的商品数据 const [data, setData] = useState({}); //超粉商品数据 @@ -119,6 +122,7 @@ export default function Pay({ params }) { } ); const data = await response.json(); + console.log(data); if (data.ret === -1) { Toast.show({ content: data.msg, @@ -156,141 +160,146 @@ export default function Pay({ params }) { } return ( -

+
{isLoading && ( )} -

- ¥ {checked ? superfanshipData?.price / 100 : data?.price / 100} -

-
-

付费商品:

-

- {checked ? superfanshipData?.name : data?.name} -

-
- -
-

有效期:

-

- {checked ? superfanshipData?.validity : data?.validity} -

-
- - {params.product_id === "h5_zone_moment" && ( -
-
-

- 开通超粉,空间动态免费看 -

- {superfanshipData?.is_superfanship_give_wechat === 1 && ( -
- - - -

- 额外附赠空间主人私人微信 -

-
- )} -
- setChecked(!checked)} - style={{ - "--checked-color": "#FFD685", - "--height": "30px", - "--width": "60px", - }} - /> +
+

+ ¥ {checked ? superfanshipData?.price / 100 : data?.price / 100} +

+
+

付费商品:

+

+ {checked ? superfanshipData?.name : data?.name} +

- )} - {params.product_id === "h5_zone_superfanship" && - superfanshipData?.is_superfanship_give_wechat === 1 && ( -
- - - -

- 额外附赠空间主人私人微信 + +

+

有效期:

+

+ {checked ? superfanshipData?.validity : data?.validity} +

+
+ + {params.product_id === "h5_zone_moment" && ( +
+
+

+ 开通超粉,空间动态免费看 +

+ {superfanshipData?.is_superfanship_give_wechat === 1 && ( +
+ + + +

+ 额外附赠空间主人私人微信 +

+
+ )} +
+ setChecked(!checked)} + style={{ + "--checked-color": "#FFD685", + "--height": "30px", + "--width": "60px", + }} + /> +
+ )} + {params.product_id === "h5_zone_superfanship" && + superfanshipData?.is_superfanship_give_wechat === 1 && ( +
+ + + +

+ 额外附赠空间主人私人微信 +

+
+ )} + {checked ? ( +
+

购买须知:

+

+ 1、开通超粉后可在有效期内免费查看当前空间内的所有动态内容; +
+ 2、当前开通的超粉仅在当前空间内生效,请确认空间主人与超粉有效期; +
+ 3、若空间主人提供了开通超粉赠送微信服务,请在开通后在空间内点击【查看微信】; +
+ 4、虚拟商品一经售出不予退款,请确认阅读上述条款并无异议后进行购买; +
+ 5、本项特权内容最终解释权归铁粉空间运营方所有。 +

+
+ ) : params.product_id === "h5_zone_moment" ? ( +
+

购买须知:

+

+ 1、当前购买内容为本空间内特定单条动态的查阅权限,如需要查阅空间内全部动态请开通超粉; +
+ 2、本次消费将计入本空间内铁粉进度,铁粉进度达标后,可查看本空间内铁粉专享动态内容; +
+ 3、虚拟商品一经售出不予退款,请确认阅读上述条款并无异议后进行购买; +
+ 4、本项特权内容最终解释权归铁粉空间运营方所有。 +

+
+ ) : ( +
+

购买须知:

+

+ 1、当前购买内容为本空间成员身份; +
+ 2、成为空间成员后可查看本空间内成员可见内容查阅权限; +
+ 3、虚拟商品一经售出不予退款,请确认阅读上述条款并无异议后进行购买; +
+ 4、本项特权内容最终解释权归铁粉空间运营方所有。

)} - {checked ? ( -
-

购买须知:

-

- 1、开通超粉后可在有效期内免费查看当前空间内的所有动态内容; -
- 2、当前开通的超粉仅在当前空间内生效,请确认空间主人与超粉有效期; -
- 3、若空间主人提供了开通超粉赠送微信服务,请在开通后在空间内点击【查看微信】; -
- 4、虚拟商品一经售出不予退款,请确认阅读上述条款并无异议后进行购买; -
- 5、本项特权内容最终解释权归铁粉空间运营方所有。 -

-
- ) : params.product_id === "h5_zone_moment" ? ( -
-

购买须知:

-

- 1、当前购买内容为本空间内特定单条动态的查阅权限,如需要查阅空间内全部动态请开通超粉; -
- 2、本次消费将计入本空间内铁粉进度,铁粉进度达标后,可查看本空间内铁粉专享动态内容; -
- 3、虚拟商品一经售出不予退款,请确认阅读上述条款并无异议后进行购买; -
- 4、本项特权内容最终解释权归铁粉空间运营方所有。 -

-
- ) : ( -
-

购买须知:

-

- 1、当前购买内容为本空间成员身份; -
- 2、成为空间成员后可查看本空间内成员可见内容查阅权限; -
- 3、虚拟商品一经售出不予退款,请确认阅读上述条款并无异议后进行购买; -
- 4、本项特权内容最终解释权归铁粉空间运营方所有。 -

-
- )} -
-
-
-
-
-
createOrder("wxpay_h5")} - className="flex flex-row cursor-pointer gap-1.5 h-11 items-center justify-center bg-primary rounded-full" - > - - - -

- 微信支付 -

+
+
+
+
+
+
createOrder("wxpay_h5")} + className="flex flex-row cursor-pointer gap-1.5 h-11 items-center justify-center bg-primary rounded-full" + > + + + +

+ 微信支付 +

+
+

+ 确认购买即视为同意 + + 《用户充值协议》 + +

-

- 确认购买即视为同意 - - 《用户充值协议》 - -

From c0558bca36b2f27fc5a28217801fcfe49827d176 Mon Sep 17 00:00:00 2001 From: yezian Date: Thu, 18 Apr 2024 18:48:58 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=A9=BA=E9=97=B4?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E9=A1=B5=E9=9D=A2=EF=BC=9B=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=A9=BA=E9=97=B4=E5=88=86=E4=BA=AB=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/[user_id]/page.jsx | 4 +- app/zone/[user_id]/page.jsx | 35 ++-- .../[zid]/[product_id]/[moment_id]/page.jsx | 58 +++++-- app/zone/share/[user_id]/page.jsx | 159 ++++++++++++++++++ 4 files changed, 222 insertions(+), 34 deletions(-) create mode 100644 app/zone/share/[user_id]/page.jsx diff --git a/app/[user_id]/page.jsx b/app/[user_id]/page.jsx index 9e5dd09..a79cd62 100644 --- a/app/[user_id]/page.jsx +++ b/app/[user_id]/page.jsx @@ -65,11 +65,11 @@ export default function StreamerDetail({ params }) {
-
+
diff --git a/app/zone/[user_id]/page.jsx b/app/zone/[user_id]/page.jsx index 015c4c0..17ead5e 100644 --- a/app/zone/[user_id]/page.jsx +++ b/app/zone/[user_id]/page.jsx @@ -60,14 +60,12 @@ export default function Zone({ params }) { return (
-
-
- -
+
+
@@ -119,17 +117,20 @@ export default function Zone({ params }) {
-
+

{data?.profile}

-
+
{data?.streamer_ext?.album?.images?.map((item, index) => { if (index > 2) return; return ( -
+
); @@ -175,9 +176,15 @@ export default function Zone({ params }) {
-
+

- 阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴阿巴 + 1、加入后,您可以查看空间内相关内容; +

+

+ 2、本空间由空间主人自行创建,加入空间前请确认相关风险,本平台不提供相关保证,请避免上当受骗; +

+

+ 3、本平台不提供违法及色情内容,如您发现空间内存在以上内容,请联系人工客服举报处理。

diff --git a/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx b/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx index 3fe929f..c5ef67d 100644 --- a/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx +++ b/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx @@ -14,7 +14,7 @@ export default function Pay({ params }) { //当前选购的商品数据 const [data, setData] = useState({}); //超粉商品数据 - const [superfanshipData, setSuperfanshipData] = useState({}); + const [superfanshipData, setSuperfanshipData] = useState(); const [isFetching, setIsFetching] = useState(true); useEffect(() => { const getData = async () => { @@ -72,12 +72,7 @@ export default function Pay({ params }) { ); const temData = await response.json(); console.log(temData); - if (temData.ret === -1) { - Toast.show({ - content: temData.msg, - }); - return; - } + if (temData.ret === -1) return; setSuperfanshipData(temData.data); } catch (error) { console.error(error); @@ -159,14 +154,37 @@ export default function Pay({ params }) { ); } + if (data?.has_bought === 1) { + return ( +
+ + + + +

+ 您已购买成功,请返回空间刷新查看。 +

+
+ ); + } + return (
{isLoading && ( )}
-

- ¥ {checked ? superfanshipData?.price / 100 : data?.price / 100} +

+ ¥{" "} + {checked + ? (superfanshipData?.price / 100).toFixed(2) + : (data?.price / 100).toFixed(2)}

付费商品:

@@ -182,7 +200,7 @@ export default function Pay({ params }) {

- {params.product_id === "h5_zone_moment" && ( + {params.product_id === "h5_zone_moment" && superfanshipData && (

@@ -233,13 +251,13 @@ export default function Pay({ params }) {

1、开通超粉后可在有效期内免费查看当前空间内的所有动态内容;
- 2、当前开通的超粉仅在当前空间内生效,请确认空间主人与超粉有效期; + 2、当前开通的超粉仅在当前空间内生效,请确认空间名称与超粉有效期;
3、若空间主人提供了开通超粉赠送微信服务,请在开通后在空间内点击【查看微信】;
4、虚拟商品一经售出不予退款,请确认阅读上述条款并无异议后进行购买;
- 5、本项特权内容最终解释权归铁粉空间运营方所有。 + 5、本项权益内容最终解释权归铁粉空间运营方所有。

) : params.product_id === "h5_zone_moment" ? ( @@ -248,24 +266,28 @@ export default function Pay({ params }) {

1、当前购买内容为本空间内特定单条动态的查阅权限,如需要查阅空间内全部动态请开通超粉;
- 2、本次消费将计入本空间内铁粉进度,铁粉进度达标后,可查看本空间内铁粉专享动态内容; + 2、本次消费将计入当前空间内铁粉进度,铁粉进度达标后,可查看当前空间内铁粉专享动态内容;
3、虚拟商品一经售出不予退款,请确认阅读上述条款并无异议后进行购买;
- 4、本项特权内容最终解释权归铁粉空间运营方所有。 + 4、本项权益内容最终解释权归铁粉空间运营方所有。

) : (

购买须知:

- 1、当前购买内容为本空间成员身份; + 1、本空间由空间主人自行创建,加入空间前请确认相关风险,避免上当受骗;
- 2、成为空间成员后可查看本空间内成员可见内容查阅权限; + 2、当前开通的空间成员身份仅针对当前空间生效,请确认空间名称与与空间主人;
- 3、虚拟商品一经售出不予退款,请确认阅读上述条款并无异议后进行购买; + 3、当前购买内容为空间成员身份,开通后可获得当前空间内成员身份查阅权限;
- 4、本项特权内容最终解释权归铁粉空间运营方所有。 + 4、虚拟商品一经售出不予退款,请确认阅读上述条款并无异议后进行购买; +
+ 5、本平台不提供违法及色情内容,如您发现空间内存在以上内容,请联系人工客服举报处理; +
+ 6、本项权益内容最终解释权归铁粉空间运营方所有。

)} diff --git a/app/zone/share/[user_id]/page.jsx b/app/zone/share/[user_id]/page.jsx new file mode 100644 index 0000000..cdea7f7 --- /dev/null +++ b/app/zone/share/[user_id]/page.jsx @@ -0,0 +1,159 @@ +"use client"; + +import React, { useState, useEffect } from "react"; +import html2canvas from "html2canvas"; +import baseRequest from "@/utils/baseRequest"; +import { Toast } from "antd-mobile"; +import Divider from "@/components/Divider"; +import { generateSignature } from "@/utils/crypto"; +import Image from "next/image"; +import icon_without_bg from "@/public/images/icon_without_bg.png"; +import invite_girl from "@/public/images/invite_girl.png"; +import ID from "@/public/images/ID.png"; + +export default function Share({ params }) { + //获取页面数据、生成二维码 + const [data, setData] = useState({}); + const [qrcodeUrl, setQrcodeUrl] = useState(""); + useEffect(() => { + const getData = async () => { + try { + const base = baseRequest(); + const signature = generateSignature({ + user_id: parseInt(params.user_id, 10), + ...base, + }); + const detailResponse = await fetch( + `/api/streamer/list_ext_by_user_id?signature=${signature}`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + user_id: parseInt(params.user_id, 10), + ...base, + }), + } + ); + const detailData = await detailResponse.json(); + if (detailData.ret === -1) { + Toast.show({ + content: detailData.msg, + }); + return; + } + setData(detailData.data.streamer_ext); + var QRCode = require("qrcode"); + QRCode.toDataURL( + `https://tiefen.fun/zone/${params.user_id}`, + function (err, url) { + setQrcodeUrl(url); + } + ); + } catch (error) { + console.error(error); + } + }; + getData(); + }, []); + + //分享海报组件 + const Poster = () => { + return ( +
+
+
+ +
+
+
+
+
+ +
+
+

+ {data?.name} +

+
+
+ +

+ {data?.user_id} +

+
+
+
+
+
+

+ 邀您加入我的 + + 「铁粉空间」 + +

+
+
+
+ +
+
+
+ + +
+ ); + }; + + //保存图片 + const saveImage = async () => { + const element = document.getElementById("print"); + const canvas = await html2canvas(element, { + useCORS: true, + }); + const data = canvas.toDataURL("image/jpg"); + window.ReactNativeWebView.postMessage( + JSON.stringify({ + type: "SAVE_IMAGE", + data: data, + }) + ); + }; + + //复制链接 + const copyUrl = () => { + window.ReactNativeWebView.postMessage( + JSON.stringify({ + type: "COPY_URL", + data: `https://tiefen.fun/${params.user_id}`, + }) + ); + }; + + return ( +
+
+ +
+
+ ); +} From 9b43cde6b62deb8b2ec27b57b402532f801a6a6e Mon Sep 17 00:00:00 2001 From: yezian Date: Thu, 18 Apr 2024 21:47:34 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx b/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx index c5ef67d..5521ae5 100644 --- a/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx +++ b/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx @@ -38,7 +38,7 @@ export default function Pay({ params }) { } ); const temData = await response.json(); - console.log(temData); + console.log(temData, JSON.stringify(body)); if (temData.ret === -1) { Toast.show({ content: temData.msg, @@ -71,7 +71,7 @@ export default function Pay({ params }) { } ); const temData = await response.json(); - console.log(temData); + console.log(temData, JSON.stringify(body)); if (temData.ret === -1) return; setSuperfanshipData(temData.data); } catch (error) { From 2500fda65285f218720171c76c8cf080f0d61581 Mon Sep 17 00:00:00 2001 From: yezian Date: Thu, 18 Apr 2024 21:51:54 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E7=9A=84=E7=AD=89=E5=BE=85=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx b/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx index 5521ae5..1c95fbe 100644 --- a/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx +++ b/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx @@ -81,7 +81,7 @@ export default function Pay({ params }) { setTimeout(() => { getData(); getSuperfanshipData(); - }, 500); + }, 1000); }, []); //是否勾选购买超粉switch组件 From 74c5afca5d458b294c514468390b6c33ff96db1a Mon Sep 17 00:00:00 2001 From: yezian Date: Mon, 22 Apr 2024 17:42:04 +0800 Subject: [PATCH 6/9] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A9=BA=E9=97=B4?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../[zid]/[product_id]/[moment_id]/page.jsx | 4 +-- app/zone/share/[user_id]/page.jsx | 31 +++++++++++-------- 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx b/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx index 1c95fbe..2ce109e 100644 --- a/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx +++ b/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx @@ -81,7 +81,7 @@ export default function Pay({ params }) { setTimeout(() => { getData(); getSuperfanshipData(); - }, 1000); + }, 500); }, []); //是否勾选购买超粉switch组件 @@ -154,7 +154,7 @@ export default function Pay({ params }) { ); } - if (data?.has_bought === 1) { + if (data?.has_bought === 1 || superfanshipData?.has_bought === 1) { return (
diff --git a/app/zone/share/[user_id]/page.jsx b/app/zone/share/[user_id]/page.jsx index cdea7f7..d152c94 100644 --- a/app/zone/share/[user_id]/page.jsx +++ b/app/zone/share/[user_id]/page.jsx @@ -4,17 +4,13 @@ import React, { useState, useEffect } from "react"; import html2canvas from "html2canvas"; import baseRequest from "@/utils/baseRequest"; import { Toast } from "antd-mobile"; -import Divider from "@/components/Divider"; import { generateSignature } from "@/utils/crypto"; -import Image from "next/image"; -import icon_without_bg from "@/public/images/icon_without_bg.png"; -import invite_girl from "@/public/images/invite_girl.png"; -import ID from "@/public/images/ID.png"; export default function Share({ params }) { //获取页面数据、生成二维码 const [data, setData] = useState({}); const [qrcodeUrl, setQrcodeUrl] = useState(""); + const [isFetching, setIsFetching] = useState(true); useEffect(() => { const getData = async () => { try { @@ -51,6 +47,7 @@ export default function Share({ params }) { setQrcodeUrl(url); } ); + setIsFetching(false); } catch (error) { console.error(error); } @@ -62,10 +59,10 @@ export default function Share({ params }) { const Poster = () => { return (
-
-
+
+
@@ -73,9 +70,9 @@ export default function Share({ params }) {
-
+
@@ -86,7 +83,7 @@ export default function Share({ params }) {

- +

ID

{data?.user_id}

@@ -94,7 +91,7 @@ export default function Share({ params }) {
-
+

邀您加入我的 @@ -144,11 +141,19 @@ export default function Share({ params }) { window.ReactNativeWebView.postMessage( JSON.stringify({ type: "COPY_URL", - data: `https://tiefen.fun/${params.user_id}`, + data: `https://tiefen.fun/zone/${params.user_id}`, }) ); }; + if (isFetching) { + return ( +

+ +
+ ); + } + return (
From b1bd9b861df029828117ce6453c7e40f6e4522ad Mon Sep 17 00:00:00 2001 From: yezian Date: Mon, 22 Apr 2024 21:54:06 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E6=94=B6=E9=93=B6=E5=8F=B0=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=BD=AE=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../[zid]/[product_id]/[moment_id]/page.jsx | 129 ++++++++++-------- 1 file changed, 69 insertions(+), 60 deletions(-) diff --git a/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx b/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx index 2ce109e..30e8339 100644 --- a/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx +++ b/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx @@ -16,72 +16,81 @@ export default function Pay({ params }) { //超粉商品数据 const [superfanshipData, setSuperfanshipData] = useState(); const [isFetching, setIsFetching] = useState(true); - useEffect(() => { - const getData = async () => { - try { - const base = webviewBaseRequest(); - const body = { - zid: parseInt(params.zid), - moment_id: parseInt(params.moment_id), - product_id: params.product_id, - ...base, - }; - const signature = generateSignature(body); - const response = await fetch( - `/api/zone/get_cashier?signature=${signature}`, - { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify(body), - } - ); - const temData = await response.json(); - console.log(temData, JSON.stringify(body)); - if (temData.ret === -1) { - Toast.show({ - content: temData.msg, - }); - return; + + //获取当前选购的商品数据 + const getData = async () => { + try { + const base = webviewBaseRequest(); + const body = { + zid: parseInt(params.zid), + moment_id: parseInt(params.moment_id), + product_id: params.product_id, + ...base, + }; + const signature = generateSignature(body); + const response = await fetch( + `/api/zone/get_cashier?signature=${signature}`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(body), } - setData(temData.data); - setIsFetching(false); - } catch (error) { - console.error(error); + ); + const temData = await response.json(); + if (temData.ret === -1) { + Toast.show({ + content: temData.msg, + }); + return; } - }; - const getSuperfanshipData = async () => { - try { - const base = webviewBaseRequest(); - const body = { - zid: parseInt(params.zid), - product_id: "h5_zone_superfanship", - ...base, - }; - const signature = generateSignature(body); - const response = await fetch( - `/api/zone/get_cashier?signature=${signature}`, - { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify(body), - } - ); - const temData = await response.json(); - console.log(temData, JSON.stringify(body)); - if (temData.ret === -1) return; - setSuperfanshipData(temData.data); - } catch (error) { - console.error(error); - } - }; + setData(temData.data); + setIsFetching(false); + } catch (error) { + console.error(error); + } + }; + + //获取超粉商品数据 + const getSuperfanshipData = async () => { + try { + const base = webviewBaseRequest(); + const body = { + zid: parseInt(params.zid), + product_id: "h5_zone_superfanship", + ...base, + }; + const signature = generateSignature(body); + const response = await fetch( + `/api/zone/get_cashier?signature=${signature}`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(body), + } + ); + const temData = await response.json(); + if (temData.ret === -1) return; + setSuperfanshipData(temData.data); + } catch (error) { + console.error(error); + } + }; + + //轮询请求 + useEffect(() => { setTimeout(() => { getData(); getSuperfanshipData(); }, 500); + const intervalId = setInterval(() => { + getData(); + getSuperfanshipData(); + }, 2000); + return () => clearInterval(intervalId); }, []); //是否勾选购买超粉switch组件 From dc16e096af4b2bda5e744d77e0b72884a5605536 Mon Sep 17 00:00:00 2001 From: yezian Date: Thu, 25 Apr 2024 20:48:47 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=94=B6=E6=94=AF?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E2=80=9C=E6=B6=88=E8=B4=B9=E2=80=9D=E5=92=8C?= =?UTF-8?q?=E2=80=9C=E5=85=85=E5=80=BC=E2=80=9Dtab=E7=9A=84=E5=89=8D?= =?UTF-8?q?=E5=90=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/bill/layout.jsx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/app/bill/layout.jsx b/app/bill/layout.jsx index 21e088b..7d1da6b 100644 --- a/app/bill/layout.jsx +++ b/app/bill/layout.jsx @@ -9,16 +9,6 @@ export default function BillLayout({ children }) {
- - 消费 - 充值 + + 消费 + Date: Thu, 25 Apr 2024 20:53:49 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E8=B4=AD=E4=B9=B0=E4=BC=9A=E5=91=98?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E5=8A=A0=E4=B8=8A=E8=BD=AE=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/vip/page.jsx | 71 ++++++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 33 deletions(-) diff --git a/app/vip/page.jsx b/app/vip/page.jsx index d85f03d..09e8b3f 100644 --- a/app/vip/page.jsx +++ b/app/vip/page.jsx @@ -36,44 +36,49 @@ export default function Vip() { const [isVip, setIsVip] = useState(false); const [name, setName] = useState(""); const [isFetching, setIsFetching] = useState(true); - useEffect(() => { - const getUserData = async () => { - try { - const base = webviewBaseRequest(); - const signature = generateSignature({ - ...base, - mid: base.b_mid, - }); - const detailResponse = await fetch( - `/api/account/list_by_mid?signature=${signature}`, - { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ - ...base, - mid: base.b_mid, - }), - } - ); - const detailData = await detailResponse.json(); - if (detailData.ret === -1) { - Toast.show({ - content: detailData.msg, - }); - return; + const getUserData = async () => { + try { + const base = webviewBaseRequest(); + const signature = generateSignature({ + ...base, + mid: base.b_mid, + }); + const detailResponse = await fetch( + `/api/account/list_by_mid?signature=${signature}`, + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify({ + ...base, + mid: base.b_mid, + }), } - setName(detailData.data.account.name); - if (detailData.data.account.is_a_member === 1) setIsVip(true); - setIsFetching(false); - } catch (error) { - console.error(error); + ); + const detailData = await detailResponse.json(); + if (detailData.ret === -1) { + Toast.show({ + content: detailData.msg, + }); + return; } - }; + setName(detailData.data.account.name); + if (detailData.data.account.is_a_member === 1) setIsVip(true); + setIsFetching(false); + } catch (error) { + console.error(error); + } + }; + //轮询请求 + useEffect(() => { setTimeout(() => { getUserData(); }, 500); + const intervalId = setInterval(() => { + getUserData(); + }, 2000); + return () => clearInterval(intervalId); }, []); //创建充值订单