🐞 fix:

修复已知问题
This commit is contained in:
john 2024-06-26 15:02:28 +08:00
parent 20b2185e51
commit 007af1f625
18 changed files with 130 additions and 140 deletions

View File

@ -1,12 +1,12 @@
###
# @LastEditors: John
# @Date: 2024-06-18 10:12:21
# @LastEditTime: 2024-06-24 18:25:07
# @LastEditTime: 2024-06-25 14:04:33
# @Author: John
###
VITE_BASE_URL=http://192.168.10.167:5173/
VITE_BASE_API_URL=/dev
VITE_PARTICIPATE_CHAIN_ID=97
VITE_PURCHASED_CONTRACT_ADDRESS=0xD70762bf8682b68bd0cbbBC0cdeC81db4f00AEc6
VITE_PURCHASED_CONTRACT_ADDRESS=0x7aAe4f2CA23482B58D6f9e8d1fBb5e413e7013c8
VITE_NETWORK_USDT_ADDRESS=0xf9A18B7FC8Eb118f8Ad59fBD6eb1A181eaCb4E63
VITE_CHECK_TRANSACTION_DETAILS_URL=https://testnet.bscscan.com/

View File

@ -1,12 +1,12 @@
###
# @LastEditors: John
# @Date: 2024-06-24 18:38:45
# @LastEditTime: 2024-06-24 18:41:05
# @LastEditTime: 2024-06-25 14:04:37
# @Author: John
###
VITE_BASE_URL=http://wwwtest.exgo.pro
VITE_BASE_API_URL=http://wwwtest.exgo.pro
VITE_PARTICIPATE_CHAIN_ID=97
VITE_PURCHASED_CONTRACT_ADDRESS=0xD70762bf8682b68bd0cbbBC0cdeC81db4f00AEc6
VITE_PURCHASED_CONTRACT_ADDRESS=0x7aAe4f2CA23482B58D6f9e8d1fBb5e413e7013c8
VITE_NETWORK_USDT_ADDRESS=0xf9A18B7FC8Eb118f8Ad59fBD6eb1A181eaCb4E63
VITE_CHECK_TRANSACTION_DETAILS_URL=https://testnet.bscscan.com/

View File

@ -1,7 +1,7 @@
/*
* @LastEditors: John
* @Date: 2024-06-18 15:16:31
* @LastEditTime: 2024-06-19 18:30:52
* @LastEditTime: 2024-06-26 14:49:22
* @Author: John
*/
import Picker, {
@ -42,7 +42,7 @@ export default function () {
case "/levelup":
return t("级别提升");
case "/assetrecord":
return t("资产记录");
return t("收益记录");
case "/airdroprecord":
return t("RMOB记录");
case "/invitationlist":
@ -118,48 +118,6 @@ export default function () {
</div>
)}
</div>
{/*
<Picker
// title={t("选择语言")}
columns={langColums}
visible={langPickVisble}
onClose={() => {
setLangPickVisble(false);
}}
value={langPickValue}
onConfirm={(v) => {
setLangPickValue(v);
// console.log("Current lang:", v[0]);
switch (v[0]) {
case Lang.en:
i18n.changeLanguage(Lang.en);
UpdateLang(Lang.en);
break;
case Lang.cn:
i18n.changeLanguage(Lang.cn);
UpdateLang(Lang.cn);
break;
case Lang.tw:
i18n.changeLanguage(Lang.tw);
UpdateLang(Lang.tw);
break;
case Lang.jp:
i18n.changeLanguage(Lang.jp);
UpdateLang(Lang.jp);
break;
case Lang.de:
i18n.changeLanguage(Lang.de);
UpdateLang(Lang.de);
break;
default:
break;
}
// console.log("i18n lang:", i18n.language);
}}
confirmText={t("确定")}
cancelText={t("取消")}
/> */}
</>
);
}

View File

@ -73,6 +73,12 @@
"internalType": "uint256",
"name": "orderId",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "paymentType",
"type": "uint256"
}
],
"name": "BuySuccess",
@ -365,25 +371,6 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "string",
"name": "source",
"type": "string"
}
],
"name": "stringToBytes32",
"outputs": [
{
"internalType": "bytes32",
"name": "result",
"type": "bytes32"
}
],
"stateMutability": "pure",
"type": "function"
},
{
"inputs": [],
"name": "tokenIndex",
@ -453,5 +440,12 @@
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "withdraw",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]

View File

@ -1,7 +1,7 @@
/*
* @LastEditors: John
* @Date: 2024-06-19 15:48:57
* @LastEditTime: 2024-06-24 18:25:44
* @LastEditTime: 2024-06-25 15:28:36
* @Author: John
*/
import { config } from "@/components/WalletProvider";
@ -285,19 +285,6 @@ export async function receiveByContract(
return new Promise<string>(async (reslove, reject) => {
try {
const balance = await getBalance();
if (balance < amount) {
console.log("用户代币余额不足");
reject(new BaseError(i18next.t("余额不足")));
return;
}
console.log("当前要授权的U:", amount);
let approvedU = await getApproveUsdt();
if (approvedU < amount) {
await authorizedU(amount);
}
console.log("参数:", amount, paymentTime, orderID, hashStr);
estimateGas(config, {
to: import.meta.env.VITE_PURCHASED_CONTRACT_ADDRESS,

View File

@ -3,7 +3,7 @@
"红魔NFT": "红魔NFT",
"铸造 NFT": "铸造 NFT",
"级别提升": "级别提升",
"资产记录": "资产记录",
"收益记录": "收益记录",
"RMOB记录": "RMOB记录",
"直推列表": "直推列表",
"返回": "返回",
@ -16,10 +16,10 @@
"邀请铸造": "邀请铸造",
"团队社长": "团队社长",
"邀请空投": "邀请空投",
"代币": "代币",
"收益": "收益",
"Min结束后按照规则进行空投。": "Min结束后按照规则进行空投。",
"铸造 NFT 获得代币空投": "铸造 NFT 获得代币空投",
"资产金额 = 已领取 + 待处理": "资产金额 = 已领取 + 待处理",
"总收益= 已领取 + 待领取": "总收益= 已领取 + 待领取",
"邀请": "邀请",
"邀请链接": "邀请链接",
"普通会员每邀请铸造一个NFT可获得一份空投福利推荐铸造20个NFT的可升级为会长团队中拥有20位会长可升级为基金会社长邀请越多级别越高福利越多。": "普通会员每邀请铸造一个NFT可获得一份空投福利推荐铸造20个NFT的可升级为会长团队中拥有20位会长可升级为基金会社长邀请越多级别越高福利越多。",
@ -102,5 +102,6 @@
"升级成功,返回首页查看": "升级成功,返回首页查看",
"无级别提升": "无级别提升",
"没有更多数据了": "没有更多数据了",
"升级中": "升级中"
"升级中": "升级中",
"无等级": "无等级"
}

View File

@ -3,7 +3,7 @@
"红魔NFT": "Der Rote Teufel NFT",
"铸造 NFT": "NFT Prägen",
"级别提升": "Stufenaufstieg",
"资产记录": "Vermögensaufzeichnung",
"收益记录": "Ergebnisrekord",
"RMOB记录": "RMOB Aufzeichnung",
"直推列表": "Direktempfehlungsliste",
"返回": "Zurück",
@ -16,10 +16,10 @@
"邀请铸造": "Prägen einladen",
"团队社长": "Teamleiter",
"邀请空投": "Airdrop einladen",
"代币": "Token",
"收益": "Einkommen",
"Min结束后按照规则进行空投。": "Airdrop nach dem Ende des Min gemäß den Regeln.",
"铸造 NFT 获得代币空投": "Token-Airdrop durch NFT-Prägung erhalten",
"资产金额 = 已领取 + 待处理": "Vermögenswert = Empfang + Ausstehend",
"总收益= 已领取 + 待领取": "Gesamtumsatz = Empfang + Abzuholen",
"邀请": "Einladen",
"邀请链接": "Einladungslink",
"普通会员每邀请铸造一个NFT可获得一份空投福利推荐铸造20个NFT的可升级为会长团队中拥有20位会长可升级为基金会社长邀请越多级别越高福利越多。": "Normale Mitglieder erhalten für jede Einladung zur Prägung eines NFTs einen Airdrop-Bonus; 20 empfohlene Prägungen führen zum Aufstieg zum Vorsitzenden; 20 Vorsitzende im Team ermöglichen den Aufstieg zum Fundmanager; je mehr Einladungen, desto höher das Level und die Belohnungen.",
@ -102,5 +102,6 @@
"升级成功,返回首页查看": "Upgrade erfolgreich abgeschlossen, zurück zur Startseite zur Ansicht.",
"无级别提升": "Beförderung ohne Rang",
"没有更多数据了": "Keine weiteren Daten",
"升级中": "Wird aktualisiert"
"升级中": "Wird aktualisiert",
"无等级": "Keine Bewertung"
}

View File

@ -3,7 +3,7 @@
"红魔NFT": "Red Devils NFT",
"铸造 NFT": "Mint NFT",
"级别提升": "Level Up",
"资产记录": "Asset Records",
"收益记录": "Revenue Record",
"RMOB记录": "RMOB Records",
"直推列表": "Direct Referral List",
"返回": "Back",
@ -16,10 +16,10 @@
"邀请铸造": "Invite to Mint",
"团队社长": "Team Leader",
"邀请空投": "Invite Airdrop",
"代币": "Token",
"收益": "Income",
"Min结束后按照规则进行空投。": "Airdrop will follow the rules after Min ends.",
"铸造 NFT 获得代币空投": "Mint NFT for Token Airdrop",
"资产金额 = 已领取 + 待处理": "Asset Amount = Claimed + Pending",
"总收益= 已领取 + 待领取": "Total Revenue = Claimed + Pending",
"邀请": "Invite",
"邀请链接": "Invite Link",
"普通会员每邀请铸造一个NFT可获得一份空投福利推荐铸造20个NFT的可升级为会长团队中拥有20位会长可升级为基金会社长邀请越多级别越高福利越多。": "Regular members get an airdrop for each NFT minted through their invite; recommending 20 NFTs upgrades to Leader; having 20 Leaders in the team upgrades to Foundation Leader; more invites lead to higher levels and more benefits.",
@ -36,7 +36,7 @@
"当前MINT价格": "Current MINT Price:",
"价格说明:": "Price Explanation:",
"{{value1}} USDT起每增加 {{value2}} 名普通会员NFT价格上涨 {{value3}},既:前 {{value2}} 名价格为 {{value1}} USDT/枚value4 名价格为{{value1}}u+{{value1}}u*{{value3}}={{value5}} USDT/枚,以此类推。": "Starting at {{value1}} USDT, the NFT price increases by {{value3}} for every {{value2}} new members: first {{value2}} at {{value1}} USDT each, {{value4}} at {{value1}}u+{{value1}}u*{{value3}}={{value5}} USDT each, and so on.",
"授权USDT": "Authorize USDT",
"授权USDT": "Approve USDT",
"当前级别": "Current Level",
"普通活跃": "Active Member",
"提升级别": "Upgrade Level",
@ -96,11 +96,12 @@
"正在授权USDT": "Authorizing USDT",
"购买中": "Purchasing",
"领取中": "Processing",
"MINT Nft 获取邀请链接": "MINT Nft invite link",
"MINT Nft 获取邀请链接": "Mint NFT to get invitation link",
"链接钱包获取邀请链接": "Link your wallet to get the invitation link.",
"正在获取已授权金额": "Currently retrieving authorized amount.",
"升级成功,返回首页查看": "Upgrade successful, return to homepage to view.",
"无级别提升": "Promotion without rank",
"没有更多数据了": "No more data",
"升级中": "Upgrading"
"升级中": "Upgrading",
"无等级": "No Grade"
}

View File

@ -3,7 +3,7 @@
"红魔NFT": "紅魔NFT",
"铸造 NFT": "NFT 鋳造",
"级别提升": "レベルアップ",
"资产记录": "資産記録",
"收益记录": "収益実績",
"RMOB记录": "RMOB記録",
"直推列表": "ダイレクト推薦リスト",
"返回": "戻る",
@ -16,10 +16,10 @@
"邀请铸造": "鋳造を招待",
"团队社长": "チームリーダー",
"邀请空投": "エアドロップ招待",
"代币": "トークン",
"收益": "所得",
"Min结束后按照规则进行空投。": "Min終了後、ルールに従ってエアドロップを行います。",
"铸造 NFT 获得代币空投": "NFTを鋳造してトークンエアドロップを獲得",
"资产金额 = 已领取 + 待处理": "資産額 = 受領済み + 処理中",
"总收益= 已领取 + 待领取": "総収入 = 受領済み + 回収対象",
"邀请": "招待",
"邀请链接": "招待リンク",
"普通会员每邀请铸造一个NFT可获得一份空投福利推荐铸造20个NFT的可升级为会长团队中拥有20位会长可升级为基金会社长邀请越多级别越高福利越多。": "一般会員はNFT鋳造の招待ごとにエアドロップを獲得20個のNFTを鋳造することでリーダーに昇格チーム内に20人のリーダーがいるとファンドリーダーに昇格招待が多いほどレベルが上がり、特典が増える。",
@ -102,5 +102,6 @@
"升级成功,返回首页查看": "アップグレードが成功しました。ホームページに戻って確認してください。",
"无级别提升": "階級なしの昇進",
"没有更多数据了": "これ以上のデータはありません",
"升级中": "アップグレード中"
"升级中": "アップグレード中",
"无等级": "グレードなし"
}

View File

@ -3,7 +3,7 @@
"红魔NFT": "紅魔NFT",
"铸造 NFT": "鑄造 NFT",
"级别提升": "級別提升",
"资产记录": "資產記錄",
"收益记录": "收益記錄",
"RMOB记录": "RMOB記錄",
"直推列表": "直推列表",
"返回": "返回",
@ -16,10 +16,10 @@
"邀请铸造": "邀請鑄造",
"团队社长": "團隊社長",
"邀请空投": "邀請空投",
"代币": "代幣",
"收益": "收益",
"Min结束后按照规则进行空投。": "Min結束後按照規則進行空投。",
"铸造 NFT 获得代币空投": "鑄造 NFT 獲得代幣空投",
"资产金额 = 已领取 + 待处理": "資產金額 = 已領取 + 待處理",
"总收益= 已领取 + 待领取": "總收益 = 已領取 + 待領取",
"邀请": "邀請",
"邀请链接": "邀請鏈接",
"普通会员每邀请铸造一个NFT可获得一份空投福利推荐铸造20个NFT的可升级为会长团队中拥有20位会长可升级为基金会社长邀请越多级别越高福利越多。": "普通會員每邀請鑄造一個NFT可獲得一份空投福利推薦鑄造20個NFT的可升級為會長團隊中擁有20位會長可升級為基金會社長邀請越多級別越高福利越多。",
@ -102,5 +102,6 @@
"升级成功,返回首页查看": "升級成功,返回首頁查看。",
"无级别提升": "無級別提升",
"没有更多数据了": "沒有更多數據了",
"升级中": "升級中"
"升级中": "升級中",
"无等级": "無等級"
}

View File

@ -1,7 +1,7 @@
/*
* @LastEditors: John
* @Date: 2024-06-18 17:57:13
* @LastEditTime: 2024-06-24 10:44:10
* @LastEditTime: 2024-06-25 16:17:20
* @Author: John
*/
import Tabs from "antd-mobile/es/components/tabs";
@ -20,7 +20,7 @@ export default function () {
const { t } = useTranslation();
const coinId = useMemo(() => getUrlQueryParam("id"), []);
const coinName = useMemo(() => getUrlQueryParam("name"), []);
const currentType = useRef<1 | 2>(1);
const currentType = useRef<1 | 2>(2);
const [issueRecords, setIssueRecords] = useState<IncomeRecord["records"]>([]);
const [receiveRecord, setReceiveRecord] = useState<IncomeRecord["records"]>(
[]
@ -31,7 +31,7 @@ export default function () {
const hasMore = useRef<boolean>(true);
useEffect(() => {
return () => {};
}, [coinId]);
}, []);
async function getRecord() {
return new Promise<void>(async (reslove) => {
@ -47,7 +47,7 @@ export default function () {
type: currentType.current,
pageNum: pageNum.current,
pageSize,
...(conditions.current && currentType.current == 1
...(conditions.current && currentType.current == 2
? { status: conditions.current }
: {}),
},
@ -57,7 +57,7 @@ export default function () {
if (data.data.records.length < pageSize) hasMore.current = false;
if (currentType.current == 1) {
if (currentType.current == 2) {
setIssueRecords([...issueRecords, ...data?.data.records]);
} else {
setReceiveRecord([...receiveRecord, ...data?.data.records]);
@ -67,9 +67,9 @@ export default function () {
}
function resetPaging() {
if (currentType.current == 1) {
if (currentType.current == 2) {
setIssueRecords([]);
} else if (currentType.current == 2) {
} else if (currentType.current == 1) {
setReceiveRecord([]);
}
pageNum.current = 0;
@ -82,10 +82,10 @@ export default function () {
className={cn(classes.AssetRecord)}
onChange={(key) => {
if (parseInt(key) == 1) {
currentType.current = 1;
currentType.current = 2;
resetPaging();
} else {
currentType.current = 2;
currentType.current = 1;
resetPaging();
}
}}

View File

@ -10,9 +10,8 @@ import usdtBg from "@/assets/usdt_bg.svg";
import RMOB_logo from "@/assets/RMOB_logo.svg";
import IconFont from "@/components/iconfont";
import { BaseError, useAccount } from "wagmi";
import { disconnect } from "wagmi/actions";
import { config } from "@/components/WalletProvider";
import { useNavigate } from "react-router-dom";
import { createSearchParams, useNavigate } from "react-router-dom";
import { Button, Dialog, Empty, Toast } from "antd-mobile";
import { loginOut } from "@/utils/wallet";
import { api_claim_income, api_get_homepage_user_data } from "@/server/api";
@ -21,7 +20,7 @@ import { UrlQueryParamsKey } from "@/constants";
import { receiveByContract } from "@/contract/utils";
import usePollingCheckBuyStatus from "@/hook/usePollingCheckBuyStatus";
import { ToastHandler } from "antd-mobile/es/components/toast";
import { disconnect, getAccount } from "@wagmi/core";
export default function () {
const { Token, UpdateToken } = useUserStore();
const { open } = useWeb3Modal();
@ -34,14 +33,17 @@ export default function () {
const userInviteLink = useMemo(
() =>
`${import.meta.env.VITE_BASE_URL}?${UrlQueryParamsKey.INVITE_CODE}=${
`${import.meta.env.VITE_BASE_URL}#/?${UrlQueryParamsKey.INVITE_CODE}=${
userData?.invitationCode || ""
}`,
[userData]
);
const receiveLoadingToast = useRef<ToastHandler>();
const { transcationStatus, startPollingCheckBuyStatus,stopPollingCheckBuyStatus } =
usePollingCheckBuyStatus("NORMAL");
const {
transcationStatus,
startPollingCheckBuyStatus,
stopPollingCheckBuyStatus,
} = usePollingCheckBuyStatus("NORMAL");
useEffect(() => {
getHomeData();
@ -51,7 +53,7 @@ export default function () {
useEffect(() => {
if (transcationStatus == "success") {
receiveLoadingToast.current?.close();
stopPollingCheckBuyStatus()
stopPollingCheckBuyStatus();
Dialog.alert({
content: `${t("领取成功,前往钱包查看")}`,
confirmText: "OK",
@ -84,8 +86,9 @@ export default function () {
<div className={classes.userinfo_top_right_wallet}>
<span>{shortenString(address, 6, 4)}</span>
<IconFont
onClick={() => {
disconnect(config);
onClick={async () => {
const { connector } = getAccount(config);
await disconnect(config, { connector });
loginOut();
}}
name="tuichu"
@ -103,7 +106,7 @@ export default function () {
name="tongdun"
className={classes.userinfo_top_right_btns_icon}
/>
<span>{t("普通非活跃")}</span>
<span>{t("无等级")}</span>
</>
)}
{userData.level == 1 && (
@ -112,7 +115,12 @@ export default function () {
name="jindun"
className={classes.userinfo_top_right_btns_icon}
/>
<span>{t("普通活跃")}</span>
{userData.active === 0 && (
<span>{t("普通非活跃")}</span>
)}
{userData.active === 1 && (
<span>{t("普通活跃")}</span>
)}
</>
)}
{userData.level == 2 && (
@ -199,7 +207,7 @@ export default function () {
className={tabIndex == 1 ? classes.nftToken_tab_active : ""}
onClick={() => setTabIndex(1)}
>
{t("代币")}
{t("收益")}
</li>
</ul>
@ -211,7 +219,7 @@ export default function () {
{userData?.nftId ? (
<div className={classes.nftToken_content_nft}>
<div className={classes.nftToken_content_nft_top}>
<span># ${userData?.nftId}</span>
<span># {userData?.nftId}</span>
<span
onClick={() => {
navigate("/mint");
@ -266,7 +274,7 @@ export default function () {
{tabIndex == 1 && (
<div className={classes.nftToken_content_token}>
<div className={classes.nftToken_content_token_top}>
<span>{t("资产金额 = 已领取 + 待处理")}</span>
<span>{t("总收益= 已领取 + 待领取")}</span>
</div>
<ul className={classes.nftToken_content_token_list}>
@ -410,7 +418,7 @@ function ReceiveCom({
onReceive,
}: {
tokenName: string;
tokenNum: string;
tokenNum: number;
toReceive: number;
onAssetRec: () => void;
onReceive: () => void;
@ -433,7 +441,7 @@ function ReceiveCom({
onAssetRec();
}}
>
{t("资产记录")}{" "}
{t("收益记录")}{" "}
<IconFont name="chevronsrightshuangyoujiantou" color={"#3680FF"} />
</span>
</div>
@ -441,7 +449,7 @@ function ReceiveCom({
<div>
<div className={classes.nftToken_content_token_item_tokenWaiting}>
<span>{t("待领取")}</span>
<span>{toReceive}</span>
<span>{tokenNum + toReceive}</span>
</div>
<Button
className={classes.nftToken_content_token_item_tokenReceive}

View File

@ -1,11 +1,12 @@
/*
* @LastEditors: John
* @Date: 2024-06-19 11:03:01
* @LastEditTime: 2024-06-22 10:27:19
* @LastEditTime: 2024-06-25 18:17:18
* @Author: John
*/
import { api_preprelion_list } from "@/server/api";
import { PreprelionListItem } from "@/server/module";
import { getLevelName } from "@/utils";
import { Empty } from "antd-mobile";
import { useEffect, useState } from "react";
import DataTable, { TableColumn } from "react-data-table-component";
@ -22,8 +23,10 @@ export default function () {
},
{
name: t("级别"),
selector: (row) => row.level,
grow: 4,
cell(row, rowIndex, column, id) {
return <div>{getLevelName(row.level)}</div>;
},
},
{
name: t("直推NFT"),

View File

@ -190,7 +190,7 @@ export default function () {
<Space>
{userUpgradeInfo?.status == 1 ? (
<>
{approveUsdt > 0n && <span>MINT</span>}
{approveUsdt > 0n && <span>{t("升级")}</span>}
{approveUsdt === 0n && <span>{t("授权USDT")}</span>}
</>
) : (

View File

@ -1,7 +1,7 @@
/*
* @LastEditors: John
* @Date: 2024-06-18 10:28:21
* @LastEditTime: 2024-06-22 11:43:04
* @LastEditTime: 2024-06-25 14:47:34
* @Author: John
*/
import { GET, POST } from "./client";
@ -131,3 +131,17 @@ export function api_claim_income() {
url: "/api/common/claimYourEarnings",
});
}
// 绑定邀请关系
export function api_binding_invitation_relationship() {
return POST<{ shareCode: string }, { result: boolean }>({
url: "/api/account/bindingRelationship",
});
}
// 查询用户是否绑定关系
export function api_query_whether_the_user_is_binding_relationship() {
return GET<any, { result: boolean }>({
url: "/api/account/bindOrNot",
});
}

View File

@ -19,6 +19,7 @@ export interface UserHomeData {
presidentNumber: number;
userImg: string;
userIncomes: UserIncome[];
active: 0 | 1; // "0=非活跃 1=活跃用户"
}
export interface UserIncome {
coinId: number;
@ -27,7 +28,7 @@ export interface UserIncome {
createTime: string;
flag: number;
id: number;
receive: string;
receive: number;
updateTime: string;
userId: number;
}
@ -107,7 +108,7 @@ export interface NftOrder {
export interface PreprelionListItem {
address: string;
level: number;
level: 0 | 1 | 2 | 3; // 0=无等级 1=会员 2=社长 3=基金会
mintNumber: number;
userType: number;
}

View File

@ -1,7 +1,7 @@
/*
* @LastEditors: John
* @Date: 2024-06-17 18:19:27
* @LastEditTime: 2024-06-24 14:49:16
* @LastEditTime: 2024-06-25 15:29:51
* @Author: John
*/
import { type ClassValue, clsx } from "clsx";
@ -31,7 +31,7 @@ export function shortenString(
}
// 定义一个函数,用于获取指定参数的值
export function getUrlQueryParam(key: string): string | undefined {
export function getUrlQueryParam(key: string) {
console.log(window.location);
const query: Map<string, string> = new Map();
const queryStr = window.location.href.split("?")[1];

View File

@ -1,14 +1,16 @@
/*
* @LastEditors: John
* @Date: 2024-06-19 15:55:07
* @LastEditTime: 2024-06-24 14:01:50
* @LastEditTime: 2024-06-25 14:47:58
* @Author: John
*/
import { config } from "@/components/WalletProvider";
import {
api_binding_invitation_relationship,
api_check_account_registration,
api_get_wallet_signature_string,
api_login,
api_query_whether_the_user_is_binding_relationship,
api_signUp,
} from "@/server/api";
import useUserStore from "@/store/User";
@ -18,9 +20,12 @@ import {
switchChain,
getChainId,
disconnect,
getAccount,
} from "@wagmi/core";
import Toast from "antd-mobile/es/components/toast";
import i18next from "i18next";
import { getUrlQueryParam } from ".";
import { UrlQueryParamsKey } from "@/constants";
/**
* @description:
@ -101,7 +106,8 @@ export async function signAndLogin(address?: `0x${string}`): Promise<void> {
});
} catch (error) {
// 用户拒绝签名或者遇到错误,断开链接
disconnect(config);
const { connector } = getAccount(config);
await disconnect(config, { connector });
loadingToast.close();
loginOut();
throw new Error("用户拒绝签名或者遇到错误,断开链接");
@ -123,7 +129,21 @@ export async function signAndLogin(address?: `0x${string}`): Promise<void> {
});
// TODO 判断用户是否绑定关系✔
// await checkUserBind(false);
const { data } =
await api_query_whether_the_user_is_binding_relationship().send({});
if (
typeof data?.data.result == "boolean" &&
data?.data.result === false
) {
const inviteCode = getUrlQueryParam(UrlQueryParamsKey.INVITE_CODE);
if (inviteCode) {
const { data } = await api_binding_invitation_relationship().send({
data: {
shareCode: inviteCode,
},
});
}
}
reslove();
loadingToast.close();
}