|
@@ -446,7 +446,7 @@
|
|
|
<script setup>
|
|
|
import { ref, watch, reactive, defineProps, defineEmits, onMounted, nextTick, provide } from "vue";
|
|
|
import { postPublish, verifyPaypalResult, syncChainTokenRechargeRecord, getCurrencyInfoByCode } from "@/http/publishApi";
|
|
|
-import { getInviteGuildInfo, saveInviteGuildInfo } from "@/http/discordApi";
|
|
|
+import { getInviteGuildInfo, getInviteGuildInfoByOpenApi, saveInviteGuildInfo } from "@/http/discordApi";
|
|
|
import { payCalcFee, getPayConfig } from "@/http/pay";
|
|
|
import { getFrontConfig } from "@/http/account";
|
|
|
import {setChromeStorage, getChromeStorage} from "@/uilts/chromeExtension"
|
|
@@ -668,7 +668,7 @@ watch(
|
|
|
// 更新余额
|
|
|
clearInterval(timer.value);
|
|
|
timer.value = setInterval(() => {
|
|
|
- getCurrencyInfo();
|
|
|
+ getCurrencyInfo({loop: true});
|
|
|
}, 10000)
|
|
|
} else {
|
|
|
clearInterval(timer.value);
|
|
@@ -1403,26 +1403,27 @@ const getDiscordInviteInfo = ({inviteUrl, getDuildId}, cb) => {
|
|
|
getInviteGuildInfo({
|
|
|
inviteCode
|
|
|
}).then(res => {
|
|
|
- if(!res) {
|
|
|
- res = {};
|
|
|
+ let resData = inviteGuildResHandler(res, {inviteCode, inviteUrl});
|
|
|
+ if(resData.data.guildId) {
|
|
|
+ cb && cb(resData);
|
|
|
+ } else {
|
|
|
+ getGuildInfoByOpenApi({inviteCode}, cb);
|
|
|
}
|
|
|
- let {name, icon, id} = res.guild || {};
|
|
|
+ }).catch((err) => {
|
|
|
+ getGuildInfoByOpenApi({inviteCode}, cb);
|
|
|
+ });
|
|
|
+}
|
|
|
|
|
|
- icon = icon && id ? `https://cdn.discordapp.com/icons/${id}/${icon}.png` : '';
|
|
|
- let resData = {
|
|
|
- inviteCode,
|
|
|
- data: {
|
|
|
- code: res.code,
|
|
|
- guildId: id,
|
|
|
- inviteUrl,
|
|
|
- inviteCode,
|
|
|
- expires: res.expires_at,
|
|
|
- name,
|
|
|
- icon,
|
|
|
- }
|
|
|
- }
|
|
|
- discordInviteInfo.value = resData.data;
|
|
|
- cb && cb(resData);
|
|
|
+const getGuildInfoByOpenApi = (params, cb) => {
|
|
|
+ let { inviteCode } = params;
|
|
|
+
|
|
|
+ getInviteGuildInfoByOpenApi({
|
|
|
+ inviteCode
|
|
|
+ }).then(res => {
|
|
|
+ let resData = inviteGuildResHandler(res, {inviteCode, inviteUrl});
|
|
|
+ if(resData.data.guildId) {
|
|
|
+ cb && cb(resData);
|
|
|
+ }
|
|
|
}).catch((err) => {
|
|
|
if(iptErrMsgTxt.value && iptErrType == 'discord') {
|
|
|
iptErrMsgTxt.value = '';
|
|
@@ -1431,6 +1432,31 @@ const getDiscordInviteInfo = ({inviteUrl, getDuildId}, cb) => {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+const inviteGuildResHandler = (res, params) => {
|
|
|
+ let {inviteCode, inviteUrl} = params;
|
|
|
+ if(!res) {
|
|
|
+ res = {};
|
|
|
+ }
|
|
|
+ let {name, icon, id} = res.guild || {};
|
|
|
+
|
|
|
+ icon = icon && id ? `https://cdn.discordapp.com/icons/${id}/${icon}.png` : '';
|
|
|
+ let resData = {
|
|
|
+ inviteCode,
|
|
|
+ data: {
|
|
|
+ code: res.code,
|
|
|
+ guildId: id,
|
|
|
+ inviteUrl,
|
|
|
+ inviteCode,
|
|
|
+ expires: res.expires_at,
|
|
|
+ name,
|
|
|
+ icon,
|
|
|
+ }
|
|
|
+ }
|
|
|
+ discordInviteInfo.value = resData.data;
|
|
|
+
|
|
|
+ return resData;
|
|
|
+};
|
|
|
+
|
|
|
/**
|
|
|
* 获取支付配置(paypalClientId)
|
|
|
*/
|
|
@@ -1472,7 +1498,8 @@ const getLocalCurrencyInfoByCode = () => {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-const getCurrencyInfo = async () => {
|
|
|
+const getCurrencyInfo = async (_params) => {
|
|
|
+ let { loop = false} = _params || {};
|
|
|
let {accessToken = ''} = await getChromeStorage('userInfo') || {};
|
|
|
if (accessToken) {
|
|
|
getChromeStorage('selectCurrencyInfo', (res) => {
|
|
@@ -1485,7 +1512,9 @@ const getCurrencyInfo = async () => {
|
|
|
if(res.code == 0 && res.data) {
|
|
|
currentCurrencyInfo.value = res.data;
|
|
|
tempCurrentCurrencyInfo.value = res.data;
|
|
|
- onIptSetErrorTxt();
|
|
|
+ if(!loop) {
|
|
|
+ onIptSetErrorTxt();
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
}
|