From adc47c4b2678c76156355ce6f3198d5b0556d12c Mon Sep 17 00:00:00 2001 From: al Date: Tue, 5 Nov 2024 16:43:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=A9=BA=E9=97=B4=E4=BB=98?= =?UTF-8?q?=E8=B4=B9=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/space/editSpacePost/page.jsx | 12 +-- .../setting/spacePaymentSetting/page.jsx | 79 ++++++++++++++----- 2 files changed, 64 insertions(+), 27 deletions(-) diff --git a/app/space/editSpacePost/page.jsx b/app/space/editSpacePost/page.jsx index b01254e..4d31dd1 100644 --- a/app/space/editSpacePost/page.jsx +++ b/app/space/editSpacePost/page.jsx @@ -229,22 +229,22 @@ export default function EditSpacePost() {
{data.text_audit_opinion && ( - +

文案违规原因: {data.text_audit_opinion} - +

)} {data.image_audit_opinion && ( - +

图片/视频违规原因: {data.image_audit_opinion} - +

)} {data.manually_review_opinion && ( - +

运营追加: {data.manually_review_opinion} - +

)}
diff --git a/app/space/setting/spacePaymentSetting/page.jsx b/app/space/setting/spacePaymentSetting/page.jsx index cce67c5..4369590 100644 --- a/app/space/setting/spacePaymentSetting/page.jsx +++ b/app/space/setting/spacePaymentSetting/page.jsx @@ -138,29 +138,53 @@ export default function spacePaymentSetting() { useEffect(() => { const account = get("account"); getStreamerInfo(Number(account.mid)).then((res) => { - const haveChecked = res.superfan_price_list - .map((it, index) => ({ ...it, index })) - .filter((it) => it.enable); - if (haveChecked.length > 0) { - setSuperSingleChecked(haveChecked[0].period); + // 旧版本 + const haveChecked = res.is_superfanship_enabled; + if (haveChecked) { + setSuperSingleChecked(res.superfanship_valid_period); } + const newFormData = { + spacePrice: res.admission_price / 100, + ironFanPrice: res.ironfanship_price / 100, + openSuper: !!res.is_superfanship_enabled, + superSingle: formData.superSingle.map((it, index) => { + if (index == res.superfanship_valid_period) { + return { + enable: !!res.is_superfanship_enabled, + price: res.superfanship_price / 100, + wechatFree: !!res.is_superfanship_give_wechat, + }; + } else { + return it; + } + }), + spaceIntro: res.profile, + }; + setFormData(newFormData); + // 新版本 + // const haveChecked = res.superfan_price_list + // .map((it, index) => ({ ...it, index })) + // .filter((it) => it.enable); + // if (haveChecked.length > 0) { + // setSuperSingleChecked(haveChecked[0].period); + // } // setSuperSingleCheckeds( // res.superfan_price_list // .map((it, index) => ({ ...it, index })) // .filter((it) => it.enable) // .map((it) => superSingles[it.index].key) // ); - setFormData({ - spacePrice: res.admission_price / 100, - ironFanPrice: res.ironfanship_price / 100, - openSuper: !!res.is_superfanship_enabled, - superSingle: res.superfan_price_list.map((it) => ({ - enable: !!it.enable, - price: it.price / 100, - wechatFree: !!it.is_superfanship_give_wechat, - })), - spaceIntro: res.profile, - }); + // setFormData({ + // spacePrice: res.admission_price / 100, + // ironFanPrice: res.ironfanship_price / 100, + // openSuper: !!res.is_superfanship_enabled, + // superSingle: res.superfan_price_list.map((it) => ({ + // enable: !!it.enable, + // price: it.price / 100, + // wechatFree: !!it.is_superfanship_give_wechat, + // })), + // spaceIntro: res.profile, + // }); }); }, []); const listItemWithCheckboxMemo = useMemo(() => { @@ -315,12 +339,21 @@ export default function spacePaymentSetting() { // } if (isSubmitting) return; - const superfan_price_list = superSingle.map((it, index) => ({ + // 旧版本 + const superfanList = superSingle.map((it, index) => ({ period: index, enable: it.enable ? 1 : 0, price: parseInt(it.price * 100, 10), is_superfanship_give_wechat: it.wechatFree ? 1 : 0, })); + const superfanObj = superfanList.filter((it) => it.enable)[0]; + // 新版本 + // const superfan_price_list = superSingle.map((it, index) => ({ + // period: index, + // enable: it.enable ? 1 : 0, + // price: parseInt(it.price * 100, 10), + // is_superfanship_give_wechat: it.wechatFree ? 1 : 0, + // })); setIsSubmitting(true); try { const body = { @@ -328,10 +361,14 @@ export default function spacePaymentSetting() { admission_price: parseInt(spacePrice * 100, 10), ironfanship_price: parseInt(ironFanPrice * 100, 10), is_superfanship_enabled: openSuper ? 1 : 0, - // superfanship_price: parseInt(superFanPrice * 100, 10), - // superfanship_valid_period: superFanExpiration, - // is_superfanship_give_wechat: unlockWechat ? 1 : 0, - superfan_price_list, + // 旧版本 + superfanship_price: openSuper ? superfanObj.price : 0, + superfanship_valid_period: openSuper ? superfanObj.period : null, + is_superfanship_give_wechat: openSuper + ? superfanObj.is_superfanship_give_wechat + : 0, + // 新版本 + // superfan_price_list, }; // console.log("body", body); const _data = await requireAPI(