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/[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/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 }) {
- - 消费 - 充值 + + 消费 + -
+

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/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); }, []); //创建充值订单 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..17ead5e --- /dev/null +++ b/app/zone/[user_id]/page.jsx @@ -0,0 +1,212 @@ +"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(); + }} + > + 立即加入 +
+
+
+
+
+

加入须知

+ +
+
+
+
+

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

+

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

+

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

+
+ +
+

+ {`请打开或下载【铁粉空间】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..30e8339 --- /dev/null +++ b/app/zone/pay/[zid]/[product_id]/[moment_id]/page.jsx @@ -0,0 +1,338 @@ +"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"; +import { useRouter } from "next/navigation"; + +export default function Pay({ params }) { + const router = useRouter(); + + //当前选购的商品数据 + const [data, setData] = useState({}); + //超粉商品数据 + const [superfanshipData, setSuperfanshipData] = useState(); + const [isFetching, setIsFetching] = useState(true); + + //获取当前选购的商品数据 + 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(); + 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(); + 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组件 + 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(); + console.log(data); + 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 ( +
+ +
+ ); + } + + if (data?.has_bought === 1 || superfanshipData?.has_bought === 1) { + return ( +
+ + + + +

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

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

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

+
+

付费商品:

+

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

+
+ +
+

有效期:

+

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

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

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

+ {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、虚拟商品一经售出不予退款,请确认阅读上述条款并无异议后进行购买; +
+ 5、本平台不提供违法及色情内容,如您发现空间内存在以上内容,请联系人工客服举报处理; +
+ 6、本项权益内容最终解释权归铁粉空间运营方所有。 +

+
+ )} +
+
+
+
+
+
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/app/zone/share/[user_id]/page.jsx b/app/zone/share/[user_id]/page.jsx new file mode 100644 index 0000000..d152c94 --- /dev/null +++ b/app/zone/share/[user_id]/page.jsx @@ -0,0 +1,164 @@ +"use client"; + +import React, { useState, useEffect } from "react"; +import html2canvas from "html2canvas"; +import baseRequest from "@/utils/baseRequest"; +import { Toast } from "antd-mobile"; +import { generateSignature } from "@/utils/crypto"; + +export default function Share({ params }) { + //获取页面数据、生成二维码 + const [data, setData] = useState({}); + const [qrcodeUrl, setQrcodeUrl] = useState(""); + const [isFetching, setIsFetching] = useState(true); + 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); + } + ); + setIsFetching(false); + } catch (error) { + console.error(error); + } + }; + getData(); + }, []); + + //分享海报组件 + const Poster = () => { + return ( +
+
+
+ +
+
+
+
+
+ +
+
+

+ {data?.name} +

+
+
+

ID

+

+ {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/zone/${params.user_id}`, + }) + ); + }; + + if (isFetching) { + return ( +
+ +
+ ); + } + + return ( +
+
+ +
+
+ ); +} diff --git a/public/images/ID.png b/public/images/ID.png new file mode 100644 index 0000000..3d16343 Binary files /dev/null and b/public/images/ID.png differ diff --git a/public/images/edit.png b/public/images/edit.png new file mode 100644 index 0000000..65cc989 Binary files /dev/null and b/public/images/edit.png differ diff --git a/public/images/pinkline.png b/public/images/pinkline.png new file mode 100644 index 0000000..f03c33c Binary files /dev/null and b/public/images/pinkline.png differ diff --git a/public/images/tiefen.png b/public/images/tiefen.png new file mode 100644 index 0000000..600750b Binary files /dev/null and b/public/images/tiefen.png differ diff --git a/public/images/wechat.png b/public/images/wechat.png new file mode 100644 index 0000000..382b389 Binary files /dev/null and b/public/images/wechat.png differ