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 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