From a764948bc73ec009b299746b3a09e4ceb8223ef3 Mon Sep 17 00:00:00 2001 From: you Date: Fri, 25 Oct 2024 01:13:16 +0300 Subject: [PATCH] test-server --- src/lib/tools/requests/requests.js | 6 +- src/lib/tools/strings/Strings.js | 11 ++ src/lib/ui-components/navbar.svelte | 4 + src/routes/disputes/+page.svelte | 6 +- src/routes/newuser/+page.svelte | 1 + src/routes/orders/+page.svelte | 5 + src/routes/payouts/+page.svelte | 4 +- src/routes/sms/+page.svelte | 242 ++++++++++++++++++++++++++++ src/routes/withdrawals/+page.svelte | 195 ++++++++++++++++++++++ svelte.config.js | 4 +- 10 files changed, 469 insertions(+), 9 deletions(-) create mode 100644 src/routes/sms/+page.svelte create mode 100644 src/routes/withdrawals/+page.svelte diff --git a/src/lib/tools/requests/requests.js b/src/lib/tools/requests/requests.js index 8796f7e..5384da5 100644 --- a/src/lib/tools/requests/requests.js +++ b/src/lib/tools/requests/requests.js @@ -13,10 +13,10 @@ function defaultDataResponseProcessor(data) { } +export const API_PATH_MAIN = "https://hostapay.trade/api/v1/"; +export const API_PATH_TEST = "https://test.0x000f.ru/api/v1/"; -let BasicURLValue = "https://hostapay.trade/api/v1/"; - - +let BasicURLValue = API_PATH_TEST; async function makePost(url, data, options = undefined, responseProcessor = defaultResponseProcessor, diff --git a/src/lib/tools/strings/Strings.js b/src/lib/tools/strings/Strings.js index 716c0b9..c63e346 100644 --- a/src/lib/tools/strings/Strings.js +++ b/src/lib/tools/strings/Strings.js @@ -9,4 +9,15 @@ export function isStringEmptyOrSpaces(str) { } } return false; +} + +export function truncateMiddle(str, n) { + if (str.length <= 2 * n) { + return str; // Если длина строки меньше или равна 2n, то ничего не обрезаем + } + + const leftPart = str.slice(0, n); // Первые n символов + const rightPart = str.slice(-n); // Последние n символов + + return leftPart + '...' + rightPart; // Соединяем с "..." } \ No newline at end of file diff --git a/src/lib/ui-components/navbar.svelte b/src/lib/ui-components/navbar.svelte index 21d21b0..7098a2a 100644 --- a/src/lib/ui-components/navbar.svelte +++ b/src/lib/ui-components/navbar.svelte @@ -47,6 +47,8 @@ {#if jwtDecode(getAuthInfo()?.a)?.role == "4"}
  • Мерчанты
  • Валюты
  • +
  • СМС
  • +
  • Вывод средств
  • {/if} @@ -78,6 +80,8 @@ {#if jwtDecode(getAuthInfo()?.a)?.role == "4"}
  • {showMenu = false;}} href="/admin/merchants">Мерчанты
  • {showMenu = false;}} href="/admin/currencies">Валюты
  • +
  • {showMenu = false;}} href="/admin/sms">СМС
  • +
  • {showMenu = false;}} href="/admin/withdrawals">Вывод средств
  • {/if} \ No newline at end of file diff --git a/src/routes/disputes/+page.svelte b/src/routes/disputes/+page.svelte index bbcb8cd..037483a 100644 --- a/src/routes/disputes/+page.svelte +++ b/src/routes/disputes/+page.svelte @@ -1,6 +1,6 @@ + +
    +
    +
    +

    Сообщения

    +
    +
    +
    + +
    +

    + SMS +

    + { + if (e.currentTarget.checked) { + selectedNotificationType = "push"; + } else { + selectedNotificationType = "sms"; + } + getNotifications(); + }} + type="checkbox" + class="toggle border-base-content bg-base-content hover:bg-base-content" + checked="checked" + /> +

    + Push +

    +
    +
    +

    С:

    + +
    +
    +

    По:

    + +
    +
    +

    Токен:

    + +
    +
    + { + currentPage = n; + getNotifications(); + }} + disableButtons={disabledPages} + css={"btn-neutral self-center mt-8"} + /> +
    + {#if showLoadingNotifies} + + {:else if noData} +

    Нет данных

    + {:else} + + + + {#each tableHeads as head} + + {/each} + + + + {#each notifications as noti} + + {#each tableHeads as head} + + {/each} + + {/each} + +
    {headNamesMap[head]}
    {noti[head]}
    + {/if} +
    +
    +
    diff --git a/src/routes/withdrawals/+page.svelte b/src/routes/withdrawals/+page.svelte new file mode 100644 index 0000000..a0483cb --- /dev/null +++ b/src/routes/withdrawals/+page.svelte @@ -0,0 +1,195 @@ + + +
    +
    +
    +

    Вывод средств

    +
    +
    + { + currentPage = n; + getWithdrawals(); + }} + disableButtons={disabledPages} + css={"btn-neutral self-center mt-8"} + /> +
    + {#if showLoadingWithdrawals} + + {:else if noData} +

    Нет данных

    + {:else} + + + + {#each tableHeads as head} + + {/each} + + + + {#each withdrawals as noti} + + {#each tableHeads as head} + {#if head === "tx_hash" || head === "address"} + + {:else if head === "is_active"} + + {:else if head === "amount"} + + {:else if head === "opt" && noti["is_active"] === "t"} + + {:else} + + {/if} + {/each} + + {/each} + +
    {headNamesMap[head]}
    {truncateMiddle(noti[head], 4)}{noti[head] === "t" ? "Активна" : "Неактивна"}{(Number(noti[head]) / 1e6).toFixed(0)} USDT + + {noti[head]}
    + {/if} +
    +
    +
    + +{#if showClosingWindow} +
    +
    +

    Хэш

    + +

    UUID

    + + + +
    +
    +{/if} diff --git a/svelte.config.js b/svelte.config.js index e990545..39f3486 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -32,7 +32,9 @@ const config = { "/payouts", "/merchants", "/orders", - "/currencies" + "/currencies", + "/sms", + "/withdrawals" ], }, },