更新检测流程

This commit is contained in:
2026-06-05 13:18:57 +08:00
parent 81f5039458
commit 761a5cb69c
15 changed files with 2446 additions and 311 deletions
@@ -1,3 +1,4 @@
<script setup>
import { reactive, ref, watch } from 'vue';
import { ElMessage } from 'element-plus';
+230 -129
View File
@@ -1,5 +1,14 @@
<script setup>
import { computed, h, nextTick, onMounted, onUnmounted, reactive, ref, watch } from "vue";
import {
computed,
h,
nextTick,
onMounted,
onUnmounted,
reactive,
ref,
watch,
} from "vue";
import { ElMessage, ElMessageBox } from "element-plus";
import Edit from "./components/edit.vue";
import DetailDialog from "./components/detail.vue";
@@ -88,7 +97,15 @@ const typeTabs = computed(() => {
});
watch(
() => [query.account, query.token, query.remark, query.status, query.platform, query.usable, activeTypeTab.value],
() => [
query.account,
query.token,
query.remark,
query.status,
query.platform,
query.usable,
activeTypeTab.value,
],
() => {
if (skipWatchFetchDuringUnusedJump.value) return;
pagination.page = 1;
@@ -183,7 +200,7 @@ function buildCopyTextByRow(row) {
if (row?.account) parts.push(row.account);
if (row?.password) parts.push(row.password);
if (row?.token) parts.push(row.token);
return parts.join('\n');
return parts.join("\n");
}
function rowToText(row) {
@@ -191,20 +208,20 @@ function rowToText(row) {
if (row?.account) parts.push(row.account);
if (row?.password) parts.push(row.password);
if (row?.token) parts.push(row.token);
return parts.join(' / ');
return parts.join(" / ");
}
async function copyToClipboard(text) {
if (!text) {
ElMessage.warning('无可复制内容');
ElMessage.warning("无可复制内容");
return false;
}
try {
await navigator.clipboard.writeText(text);
ElMessage.success('已复制');
ElMessage.success("已复制");
return true;
} catch (e) {
ElMessage.error('复制失败,请检查浏览器权限');
ElMessage.error("复制失败,请检查浏览器权限");
return false;
}
}
@@ -378,16 +395,20 @@ function extractStatusTagType(row) {
}
const tooltipOpts = {
popperClass: 'pool-tooltip',
popperStyle: { maxWidth: '600px', wordBreak: 'break-all', whiteSpace: 'pre-wrap' },
popperClass: "pool-tooltip",
popperStyle: {
maxWidth: "600px",
wordBreak: "break-all",
whiteSpace: "pre-wrap",
},
};
const PLATFORM_MAP = {
local: { label: '本地', type: 'info' },
xianyu: { label: '闲鱼', type: 'warning' },
pinduoduo: { label: '拼多多', type: 'danger' },
jingdong: { label: '京东', type: 'primary' },
douyin: { label: '抖音', type: 'success' },
local: { label: "本地", type: "info" },
xianyu: { label: "闲鱼", type: "warning" },
pinduoduo: { label: "拼多多", type: "danger" },
jingdong: { label: "京东", type: "primary" },
douyin: { label: "抖音", type: "success" },
};
function platformText(platform) {
@@ -416,12 +437,17 @@ function isUsedTagType(isUsed) {
function decodeJwtPayload(rawToken) {
const token = String(rawToken || "").trim();
if (!token) return null;
const pureToken = token.includes("::") ? token.split("::").pop().trim() : token;
const pureToken = token.includes("::")
? token.split("::").pop().trim()
: token;
const parts = pureToken.split(".");
if (parts.length < 2) return null;
try {
const base64 = parts[1].replace(/-/g, "+").replace(/_/g, "/");
const padded = base64.padEnd(base64.length + ((4 - (base64.length % 4)) % 4), "=");
const padded = base64.padEnd(
base64.length + ((4 - (base64.length % 4)) % 4),
"=",
);
const json = decodeURIComponent(
atob(padded)
.split("")
@@ -528,7 +554,8 @@ async function fetchList() {
remark: query.remark || undefined,
status: query.status || undefined,
platform: query.platform || undefined,
usable: query.usable === "1" || query.usable === "0" ? query.usable : undefined,
usable:
query.usable === "1" || query.usable === "0" ? query.usable : undefined,
type: activeTypeTab.value === "all" ? undefined : activeTypeTab.value,
});
if (res?.code !== 200) {
@@ -553,7 +580,8 @@ async function jumpToLastUnusedPage() {
token: query.token || undefined,
remark: query.remark || undefined,
status: "unused",
usable: query.usable === "1" || query.usable === "0" ? query.usable : undefined,
usable:
query.usable === "1" || query.usable === "0" ? query.usable : undefined,
type,
});
if (res?.code !== 200) {
@@ -581,29 +609,44 @@ function updateDeviceType() {
onMounted(() => {
updateDeviceType();
window.addEventListener('resize', updateDeviceType);
window.addEventListener("resize", updateDeviceType);
fetchList();
});
onUnmounted(() => {
window.removeEventListener('resize', updateDeviceType);
window.removeEventListener("resize", updateDeviceType);
});
// ---- 接口说明数据 ----
const BASE_URL = "https://api.yunzer.cn";
const paramDocs = [
{ name: 'type', required: true, desc: '来源平台,用于标记本次提取来自哪个渠道', values: 'xianyu / taobao / pinduoduo / jingdong / local' },
{ name: 'module', required: true, desc: '号池模块,指定从哪个产品的号池提取', values: 'cursor / windsurf / krio' },
{ name: 'data_type', required: false, desc: '账号类型,不传则提取任意类型', values: 'account / tk / account_tk' },
{
name: "type",
required: true,
desc: "来源平台,用于标记本次提取来自哪个渠道",
values: "xianyu / taobao / pinduoduo / jingdong / local",
},
{
name: "module",
required: true,
desc: "号池模块,指定从哪个产品的号池提取",
values: "cursor / windsurf / krio",
},
{
name: "data_type",
required: false,
desc: "账号类型,不传则提取任意类型",
values: "account / tk / account_tk",
},
];
const platformDocs = [
{ value: 'xianyu', label: '闲鱼', desc: '闲鱼平台发货调用' },
{ value: 'pinduoduo', label: '拼多多', desc: '拼多多平台发货调用' },
{ value: 'jingdong', label: '京东', desc: '京东平台发货调用' },
{ value: 'douyin', label: '抖音', desc: '抖音平台发货调用' },
{ value: 'local', label: '本地', desc: '本地手动调用' },
{ value: "xianyu", label: "闲鱼", desc: "闲鱼平台发货调用" },
{ value: "pinduoduo", label: "拼多多", desc: "拼多多平台发货调用" },
{ value: "jingdong", label: "京东", desc: "京东平台发货调用" },
{ value: "douyin", label: "抖音", desc: "抖音平台发货调用" },
{ value: "local", label: "本地", desc: "本地手动调用" },
];
const moduleDocs = [
@@ -657,26 +700,48 @@ function copyCardInfo(row) {
if (row.account) parts.push(row.account);
if (row.password) parts.push(row.password);
if (row.token) parts.push(row.token);
if (!parts.length) { ElMessage.warning('无可复制内容'); return; }
navigator.clipboard.writeText(parts.join('\n')).then(() => {
ElMessage.success('已复制');
if (!parts.length) {
ElMessage.warning("无可复制内容");
return;
}
navigator.clipboard.writeText(parts.join("\n")).then(() => {
ElMessage.success("已复制");
});
}
const CURSOR_PRO_LIMIT_TEXT = 'Get Cursor Pro for more Agent usage, unlimited Tab, and more.';
const CURSOR_PRO_LIMIT_TEXT =
"Get Cursor Pro for more Agent usage, unlimited Tab, and more.";
function formatCursorProbeDialogText(d) {
const detail = String(d?.detail || '');
const rawPreview = String(d?.rawPreview || '');
if (detail.includes(CURSOR_PRO_LIMIT_TEXT) || rawPreview.includes(CURSOR_PRO_LIMIT_TEXT)) {
return '该TOKEN已用完';
const detail = String(d?.detail || "").trim();
const rawPreview = String(d?.rawPreview || "").trim();
const serverOutput = detail || rawPreview;
// 1. 优先以新版后端的 ok 字段(也就是底层探针的交叉判定结论)为核心准则
if (d && typeof d.ok === "boolean") {
if (d.ok) {
return serverOutput || "该TOKEN可用";
}
return `该TOKEN已用完 (${detail || rawPreview || "额度枯竭"})`;
}
return '该TOKEN可用';
// 2. 兼容旧数据的兜底检测
const CURSOR_PRO_LIMIT_TEXT =
"Get Cursor Pro for more Agent usage, unlimited Tab, and more.";
if (
detail.includes(CURSOR_PRO_LIMIT_TEXT) ||
rawPreview.includes(CURSOR_PRO_LIMIT_TEXT)
) {
return `该TOKEN已用完 (${detail || rawPreview})`;
}
return serverOutput || "该TOKEN可用";
}
async function handleProbeToken(row) {
if (!row?.token) {
ElMessage.warning('该行无 Token');
ElMessage.warning("该行无 Token");
return;
}
probeLoadingId.value = row.id;
@@ -686,17 +751,17 @@ async function handleProbeToken(row) {
accessToken: row.token,
});
if (res?.code !== 200) {
ElMessage.error(res?.msg || '探测失败');
ElMessage.error(res?.msg || "探测失败");
return;
}
const d = res?.data || {};
const text = formatCursorProbeDialogText(d);
try {
await ElMessageBox({
title: '检测结果',
message: h('div', { class: 'cursor-probe-result' }, text),
confirmButtonText: '关闭',
customClass: 'cursor-probe-dialog',
title: "检测结果",
message: h("div", { class: "cursor-probe-result" }, text),
confirmButtonText: "关闭",
customClass: "cursor-probe-dialog",
closeOnClickModal: true,
});
} catch {
@@ -704,7 +769,7 @@ async function handleProbeToken(row) {
}
await fetchList();
} catch {
ElMessage.error('探测请求失败');
ElMessage.error("探测请求失败");
} finally {
probeLoadingId.value = null;
}
@@ -721,8 +786,7 @@ async function handleBatchProbe() {
return;
}
const skipped = selectedRows.value.length - rows.length;
const skipHint =
skipped > 0 ? `(已跳过 ${skipped} 条无 Token` : "";
const skipHint = skipped > 0 ? `(已跳过 ${skipped} 条无 Token` : "";
try {
await ElMessageBox.confirm(
`将对 ${rows.length} 条 Token进行检测,是否继续?${skipHint}`,
@@ -812,7 +876,6 @@ async function handleBatchProbe() {
// closeOnClickModal: true,
// });
// }
</script>
<template>
@@ -888,8 +951,12 @@ async function handleBatchProbe() {
<el-button @click="resetQuery">重置</el-button>
</div>
<div class="toolbar-right">
<el-button type="primary" @click="openAddDialog('single')">添加账号</el-button>
<el-button type="success" @click="openAddDialog('batch')">批量添加</el-button>
<el-button type="primary" @click="openAddDialog('single')"
>添加账号</el-button
>
<el-button type="success" @click="openAddDialog('batch')"
>批量添加</el-button
>
<el-button @click="replenishVisible = true">补号</el-button>
<el-button @click="markExtractForSelected">批量提取</el-button>
<el-button plain @click="handleBatchProbe">批量检测</el-button>
@@ -917,84 +984,108 @@ async function handleBatchProbe() {
:loading="loading"
@selection-change="handleSelectionChange"
>
<el-table-column type="selection" width="52" />
<el-table-column prop="id" label="ID" width="80" />
<el-table-column label="账号类型" width="160" align="center">
<template #default="{ row }">
<el-tag>{{ typeText(row.type) }}</el-tag>
</template>
</el-table-column>
<el-table-column prop="account" label="账号" min-width="180" show-overflow-tooltip :tooltip-options="tooltipOpts" />
<!-- <el-table-column prop="password" label="密码" min-width="160" show-overflow-tooltip :tooltip-options="tooltipOpts">
<el-table-column type="selection" width="52" />
<el-table-column prop="id" label="ID" width="80" />
<el-table-column label="账号类型" width="160" align="center">
<template #default="{ row }">
<el-tag>{{ typeText(row.type) }}</el-tag>
</template>
</el-table-column>
<el-table-column
prop="account"
label="账号"
min-width="180"
show-overflow-tooltip
:tooltip-options="tooltipOpts"
/>
<!-- <el-table-column prop="password" label="密码" min-width="160" show-overflow-tooltip :tooltip-options="tooltipOpts">
<template #default="{ row }">{{ row.password || '-' }}</template>
</el-table-column>
<el-table-column label="Token" min-width="200" show-overflow-tooltip :tooltip-options="tooltipOpts">
<template #default="{ row }">{{ row.token || '-' }}</template>
</el-table-column> -->
<el-table-column label="提取状态" width="100">
<template #default="{ row }">
<el-tag :type="extractStatusTagType(row)">
{{ extractStatusLabel(row) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="探测可用" width="100" align="center">
<template #default="{ row }">
<el-tag :type="isUsedTagType(row.isUsed)" size="small">
{{ isUsedLabel(row.isUsed) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="accessToken失效时间" width="190" align="center">
<template #default="{ row }">
<el-tag :type="accessTokenExpireTagType(row.accessTokenExpireStatus)" size="small">
{{ row.accessTokenExpireText || "-" }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="提取平台" width="120">
<template #default="{ row }">
<el-tag
v-if="row.extractedPlatform"
:type="platformTagType(row.extractedPlatform)"
size="small"
>
{{ platformText(row.extractedPlatform) }}
</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column prop="extractedAt" label="提取时间" width="180" />
<el-table-column prop="remark" label="备注" min-width="140" show-overflow-tooltip :tooltip-options="tooltipOpts" />
<el-table-column label="操作" width="300" fixed="right" align="center">
<template #default="{ row }">
<el-button
v-if="row.token"
link
type="info"
:loading="probeLoadingId === row.id"
@click="handleProbeToken(row)"
>检测</el-button
>
<el-button link type="primary" @click="openDetail(row)"
>详情</el-button
>
<el-button
v-if="!row.extractedAt && !row.extracted"
link
type="warning"
@click="openExtractByRow(row)"
>提取</el-button
>
<el-button
v-if="row.extracted"
link
type="success"
@click="copyCardInfo(row)"
>复制</el-button
>
</template>
</el-table-column>
<el-table-column label="提取状态" width="100">
<template #default="{ row }">
<el-tag :type="extractStatusTagType(row)">
{{ extractStatusLabel(row) }}
</el-tag>
</template>
</el-table-column>
<el-table-column label="探测可用" width="100" align="center">
<template #default="{ row }">
<el-tag :type="isUsedTagType(row.isUsed)" size="small">
{{ isUsedLabel(row.isUsed) }}
</el-tag>
</template>
</el-table-column>
<!-- <el-table-column
label="accessToken失效时间"
width="190"
align="center"
>
<template #default="{ row }">
<el-tag
:type="accessTokenExpireTagType(row.accessTokenExpireStatus)"
size="small"
>
{{ row.accessTokenExpireText || "-" }}
</el-tag>
</template>
</el-table-column> -->
<el-table-column label="提取平台" width="120">
<template #default="{ row }">
<el-tag
v-if="row.extractedPlatform"
:type="platformTagType(row.extractedPlatform)"
size="small"
>
{{ platformText(row.extractedPlatform) }}
</el-tag>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column prop="extractedAt" label="提取时间" width="180" />
<el-table-column
prop="remark"
label="备注"
min-width="140"
show-overflow-tooltip
:tooltip-options="tooltipOpts"
/>
<el-table-column
label="操作"
width="300"
fixed="right"
align="center"
>
<template #default="{ row }">
<el-button
v-if="row.token"
link
type="info"
:loading="probeLoadingId === row.id"
@click="handleProbeToken(row)"
>检测</el-button
>
<el-button link type="primary" @click="openDetail(row)"
>详情</el-button
>
<el-button
v-if="!row.extractedAt && !row.extracted"
link
type="warning"
@click="openExtractByRow(row)"
>提取</el-button
>
<el-button
v-if="row.extracted"
link
type="success"
@click="copyCardInfo(row)"
>复制</el-button
>
</template>
</el-table-column>
</el-table>
</div>
@@ -1003,7 +1094,9 @@ async function handleBatchProbe() {
v-model:current-page="pagination.page"
v-model:page-size="pagination.pageSize"
background
:layout="isMobile ? 'prev, pager, next' : 'total, prev, pager, next, jumper'"
:layout="
isMobile ? 'prev, pager, next' : 'total, prev, pager, next, jumper'
"
:page-sizes="[20, 50, 100]"
:total="total"
/>
@@ -1055,7 +1148,9 @@ async function handleBatchProbe() {
destroy-on-close
>
<el-alert type="info" :closable="false" style="margin-bottom: 12px">
将对已选的 <strong>{{ selectedRows.length }}</strong> 条记录执行提取并标记为已提取
将对已选的
<strong>{{ selectedRows.length }}</strong>
条记录执行提取并标记为已提取
</el-alert>
<el-form label-width="84px">
<el-form-item label="提取平台">
@@ -1079,7 +1174,11 @@ async function handleBatchProbe() {
</el-form>
<template #footer>
<el-button @click="batchExtractVisible = false">取消</el-button>
<el-button type="primary" :loading="loading" @click="handleBatchExtract">
<el-button
type="primary"
:loading="loading"
@click="handleBatchExtract"
>
确认提取
</el-button>
</template>
@@ -1299,7 +1398,6 @@ async function handleBatchProbe() {
gap: 12px;
padding: 8px 12px 12px;
}
}
/* 接口说明抽屉 */
@@ -1421,10 +1519,13 @@ async function handleBatchProbe() {
}
.cursor-probe-dialog .cursor-probe-result {
margin: 0;
text-align: center;
font-size: 16px;
max-height: 420px;
overflow: auto;
text-align: left;
font-size: 14px;
line-height: 1.6;
font-weight: 600;
font-weight: 500;
white-space: pre-wrap;
word-break: break-all;
}
.cursor-probe-dialog .cursor-expire-result {