feat(通联登录): 优化验证码识别与风控锁定处理,升级插件UI
- 新增双模型验证码交叉识别提升准确率 - 增加账号风控锁定检测与异常处理 - 优化登录表单字段提交适配服务端校验 - 升级两个插件的UI为卡片式分区设计 - 升级插件版本至1.0.9
This commit is contained in:
@@ -20,7 +20,7 @@
|
||||
"""
|
||||
import os
|
||||
from datetime import date, datetime
|
||||
from typing import List, Optional, Set, Tuple
|
||||
from typing import Dict, List, Optional, Set, Tuple
|
||||
|
||||
import pandas as pd
|
||||
|
||||
|
||||
@@ -1,18 +1,36 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<!-- 未登录 / 结果横幅 -->
|
||||
<el-alert v-if="needLogin" type="warning" :closable="false" show-icon title="未登录:请先在壳子(工作台)登录统一账户,再刷新本界面" />
|
||||
<el-alert v-else-if="banner" :type="banner.type" :closable="true" show-icon @close="banner = null">
|
||||
<template #title>{{ banner.text }}</template>
|
||||
</el-alert>
|
||||
<transition name="fade-slide">
|
||||
<el-alert v-if="needLogin" type="warning" :closable="false" show-icon
|
||||
title="未登录:请先在壳子(工作台)登录统一账户,再刷新本界面" />
|
||||
<el-alert v-else-if="banner" :type="banner.type" :closable="true" show-icon @close="banner = null">
|
||||
<template #title>{{ banner.text }}</template>
|
||||
</el-alert>
|
||||
</transition>
|
||||
|
||||
<!-- 执行配置(头部含多配置方案:方案供「定时任务」引用,到点自动取方案最新参数) -->
|
||||
<el-card shadow="never" class="card">
|
||||
<el-card shadow="never" class="panel">
|
||||
<template #header>
|
||||
<div class="card-head">
|
||||
<span class="card-title">执行配置</span>
|
||||
<div class="panel-head">
|
||||
<div class="panel-title">
|
||||
<span class="title-ico">
|
||||
<svg viewBox="0 0 24 24" width="17" height="17" fill="none" stroke="currentColor"
|
||||
stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M9 5H7a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2" />
|
||||
<rect x="9" y="3" width="6" height="4" rx="1" />
|
||||
<path d="m9 14 2 2 4-4" />
|
||||
</svg>
|
||||
</span>
|
||||
<div class="title-txts">
|
||||
<div class="title-txt">执行配置</div>
|
||||
<div class="title-sub">参数自动保存到本机,方案供定时任务到点引用</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="head-tools">
|
||||
<span v-if="lastSavedAt" class="saved">已保存 {{ lastSavedAt }}</span>
|
||||
<span v-if="lastSavedAt" class="saved">
|
||||
<i class="dot" />已保存 {{ lastSavedAt }}
|
||||
</span>
|
||||
<el-select v-model="schemeSel" class="scheme-sel" size="small" :disabled="running"
|
||||
@change="onSchemeChange">
|
||||
<el-option v-for="o in schemeOptions" :key="o.value" :label="o.label" :value="o.value" />
|
||||
@@ -23,50 +41,78 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-form label-width="130px" label-position="right">
|
||||
<div class="grid">
|
||||
<el-form-item label="执行月份">
|
||||
<el-date-picker v-model="form.ref_month" type="month" value-format="YYYY-MM"
|
||||
placeholder="留空 = 上月" :disabled="running" clearable class="wide" />
|
||||
</el-form-item>
|
||||
<el-form-item label="输出目录">
|
||||
<el-input v-model="form.save_dir" :disabled="running" clearable
|
||||
placeholder="留空 = 默认目录(封存表/花名册/调动台账/汇总工作簿统一存放)" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<div class="grid">
|
||||
<el-form-item label="花名册路径">
|
||||
<el-input v-model="form.roster_path" :disabled="running" clearable
|
||||
placeholder="留空 = 输出目录/员工花名册.xlsx(每次执行自动重导,不缓存复用)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="调动台账路径">
|
||||
<el-input v-model="form.transfer_path" :disabled="running" clearable
|
||||
placeholder="留空 = 输出目录/调动台账.xlsx(每次执行自动导出)" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form label-position="top">
|
||||
<!-- 执行参数 -->
|
||||
<section class="sec">
|
||||
<div class="sec-head">
|
||||
<span class="sec-badge">01</span>
|
||||
<span class="sec-name">执行参数</span>
|
||||
<span class="sec-line" />
|
||||
</div>
|
||||
<div class="grid">
|
||||
<el-form-item label="执行月份">
|
||||
<el-date-picker v-model="form.ref_month" type="month" value-format="YYYY-MM"
|
||||
placeholder="留空 = 上月" :disabled="running" clearable class="wide" />
|
||||
</el-form-item>
|
||||
<el-form-item label="输出目录">
|
||||
<el-input v-model="form.save_dir" :disabled="running" clearable
|
||||
placeholder="留空 = 默认目录(封存表/花名册/调动台账/汇总工作簿统一存放)" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<el-form-item label="检查项">
|
||||
<!-- 数据来源 -->
|
||||
<section class="sec">
|
||||
<div class="sec-head">
|
||||
<span class="sec-badge">02</span>
|
||||
<span class="sec-name">数据来源</span>
|
||||
<span class="sec-line" />
|
||||
</div>
|
||||
<div class="grid">
|
||||
<el-form-item label="花名册路径">
|
||||
<el-input v-model="form.roster_path" :disabled="running" clearable
|
||||
placeholder="留空 = 输出目录/员工花名册.xlsx(每次执行自动重导,不缓存复用)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="调动台账路径">
|
||||
<el-input v-model="form.transfer_path" :disabled="running" clearable
|
||||
placeholder="留空 = 输出目录/调动台账.xlsx(每次执行自动导出)" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 检查项 -->
|
||||
<section class="sec">
|
||||
<div class="sec-head">
|
||||
<span class="sec-badge">03</span>
|
||||
<span class="sec-name">检查项</span>
|
||||
<span class="sec-line" />
|
||||
</div>
|
||||
<div class="checks-head">
|
||||
<el-button size="small" :disabled="running" @click="toggleAll">
|
||||
{{ allChecked ? '清空' : '全选' }}
|
||||
</el-button>
|
||||
<span class="checks-count">已选 {{ form.checks.length }} / {{ CHECK_OPTIONS.length }} 项</span>
|
||||
</div>
|
||||
<el-checkbox-group v-model="form.checks" :disabled="running" class="checks">
|
||||
<el-checkbox v-for="c in CHECK_OPTIONS" :key="c.value" :value="c.value">
|
||||
{{ c.label }}
|
||||
</el-checkbox>
|
||||
</el-checkbox-group>
|
||||
<div class="checks" :class="{ disabled: running }">
|
||||
<div v-for="c in CHECK_OPTIONS" :key="c.value" class="check-tile"
|
||||
:class="{ on: form.checks.includes(c.value) }" @click="toggleCheck(c.value)">
|
||||
<span class="tile-num">{{ c.value.replace('检查', '') }}</span>
|
||||
<span class="tile-label">{{ c.label }}</span>
|
||||
<span class="tile-flag" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="tip">只跑勾选项,未勾选的检查不执行、其 sheet 也不输出;至少勾选一项</div>
|
||||
</el-form-item>
|
||||
</section>
|
||||
|
||||
<!-- 操作 -->
|
||||
<div class="actions">
|
||||
<el-button type="primary" size="large" :loading="running" @click="run">
|
||||
<el-button type="primary" size="large" class="btn-run" :loading="running" @click="run">
|
||||
{{ running ? '执行中 ' + progress + '%' : '一键执行' }}
|
||||
</el-button>
|
||||
<el-button v-if="running" type="danger" size="large" plain :loading="stopping"
|
||||
@click="forceStop">强制停止</el-button>
|
||||
<span class="spacer" />
|
||||
<el-button size="large" :disabled="running" @click="saveNow(true)">保存配置</el-button>
|
||||
<el-button size="large" text :disabled="running" @click="resetDefaults">恢复默认</el-button>
|
||||
</div>
|
||||
@@ -74,10 +120,16 @@
|
||||
</el-card>
|
||||
|
||||
<!-- 运行状态:进度条 + 日志位置提示(日志实时显示在壳子下方日志区) -->
|
||||
<div v-if="running" class="status">
|
||||
<el-progress :percentage="progress" :stroke-width="8" class="status-bar" />
|
||||
<span class="status-txt">正在执行,日志与进度实时显示在工作台下方【运行日志】区</span>
|
||||
</div>
|
||||
<transition name="fade-slide">
|
||||
<div v-if="running" class="status">
|
||||
<el-progress :percentage="progress" :stroke-width="10" :show-text="false" class="status-bar" />
|
||||
<div class="status-row">
|
||||
<span class="pulse" />
|
||||
<span class="status-txt">正在执行,日志与进度实时显示在工作台下方【运行日志】区</span>
|
||||
<span class="status-pct">{{ progress }}%</span>
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -136,117 +188,360 @@ const allChecked = computed(() => form.checks.length === ALL_CHECKS.length)
|
||||
function toggleAll() {
|
||||
form.checks = allChecked.value ? [] : [...ALL_CHECKS]
|
||||
}
|
||||
|
||||
// 卡片式勾选块:切换单个检查项的勾选状态(与 el-checkbox-group 同语义,直接维护 checks 数组)
|
||||
function toggleCheck(value) {
|
||||
if (running.value) return
|
||||
const i = form.checks.indexOf(value)
|
||||
if (i >= 0) form.checks.splice(i, 1)
|
||||
else form.checks.push(value)
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* ---------- 页面骨架 ---------- */
|
||||
.page {
|
||||
width: 100%;
|
||||
padding: 4px 2px 20px;
|
||||
padding: 6px 4px 28px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.card {
|
||||
border-radius: 10px;
|
||||
.fade-slide-enter-active,
|
||||
.fade-slide-leave-active {
|
||||
transition: opacity 0.25s ease, transform 0.25s ease;
|
||||
}
|
||||
.fade-slide-enter-from,
|
||||
.fade-slide-leave-to {
|
||||
opacity: 0;
|
||||
transform: translateY(-6px);
|
||||
}
|
||||
|
||||
.card-head {
|
||||
/* ---------- 主容器(无边框平铺:外层由壳子 iframe 的边框统一包裹) ---------- */
|
||||
.panel {
|
||||
background: transparent;
|
||||
border-radius: 0;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
.panel :deep(.el-card__header) {
|
||||
padding: 6px 2px 16px;
|
||||
border-bottom: 1px solid var(--el-border-color-lighter);
|
||||
background: transparent;
|
||||
}
|
||||
.panel :deep(.el-card__body) {
|
||||
padding: 16px 2px 2px;
|
||||
}
|
||||
|
||||
/* ---------- 卡片头部 ---------- */
|
||||
.panel-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
.panel-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
.title-ico {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--el-color-primary);
|
||||
background: linear-gradient(135deg, var(--el-color-primary-light-8), var(--el-color-primary-light-6));
|
||||
box-shadow: inset 0 0 0 1px var(--el-color-primary-light-5);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.title-txts {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
.title-txt {
|
||||
font-weight: 700;
|
||||
font-size: 15px;
|
||||
line-height: 1.2;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
.title-sub {
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.head-tools {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.scheme-sel {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.saved {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
color: #67c23a;
|
||||
color: #2ea44f;
|
||||
background: rgba(46, 164, 79, 0.1);
|
||||
border: 1px solid rgba(46, 164, 79, 0.25);
|
||||
padding: 2px 10px;
|
||||
border-radius: 999px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.saved .dot {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: #2ea44f;
|
||||
}
|
||||
|
||||
/* ---------- 表单分区 ---------- */
|
||||
.sec {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.sec:last-of-type {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.sec-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
.sec-badge {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border-radius: 7px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
color: var(--el-color-primary);
|
||||
background: var(--el-color-primary-light-9);
|
||||
border: 1px solid var(--el-color-primary-light-7);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.sec-name {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--el-text-color-primary);
|
||||
white-space: nowrap;
|
||||
}
|
||||
.sec-line {
|
||||
flex: 1;
|
||||
height: 1px;
|
||||
background: linear-gradient(90deg, var(--el-border-color-lighter), transparent);
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: flex;
|
||||
gap: 18px;
|
||||
flex-wrap: wrap;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||
gap: 0 18px;
|
||||
}
|
||||
|
||||
.grid .el-form-item {
|
||||
flex: 1;
|
||||
min-width: 300px;
|
||||
.grid :deep(.el-form-item) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.grid :deep(.el-form-item__label) {
|
||||
padding-bottom: 6px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.grid :deep(.el-date-editor) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.wide {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
/* ---------- 检查项卡片式勾选 ---------- */
|
||||
.checks-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-bottom: 8px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.checks-count {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
color: var(--el-text-color-secondary);
|
||||
}
|
||||
|
||||
.checks {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(6, 1fr);
|
||||
gap: 10px;
|
||||
}
|
||||
.checks.disabled {
|
||||
pointer-events: none;
|
||||
opacity: 0.6;
|
||||
}
|
||||
.check-tile {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 4px 18px;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
padding: 10px 12px;
|
||||
border-radius: 10px;
|
||||
border: 1px solid var(--el-border-color-lighter);
|
||||
background: var(--el-fill-color-blank);
|
||||
cursor: pointer;
|
||||
user-select: none;
|
||||
transition: border-color 0.2s, background 0.2s, box-shadow 0.2s, transform 0.15s;
|
||||
}
|
||||
.check-tile:hover {
|
||||
border-color: var(--el-color-primary-light-5);
|
||||
background: var(--el-color-primary-light-9);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
.check-tile.on {
|
||||
border-color: var(--el-color-primary);
|
||||
background: var(--el-color-primary-light-9);
|
||||
box-shadow: 0 2px 8px var(--el-color-primary-light-6);
|
||||
}
|
||||
.tile-num {
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
border-radius: 8px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 13px;
|
||||
font-weight: 700;
|
||||
color: var(--el-text-color-regular);
|
||||
background: var(--el-fill-color-light);
|
||||
transition: all 0.2s;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.check-tile.on .tile-num {
|
||||
color: #fff;
|
||||
background: var(--el-color-primary);
|
||||
}
|
||||
.tile-label {
|
||||
flex: 1;
|
||||
font-size: 13px;
|
||||
color: var(--el-text-color-regular);
|
||||
line-height: 1.4;
|
||||
}
|
||||
.tile-flag {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 50%;
|
||||
border: 1.5px solid var(--el-border-color);
|
||||
position: relative;
|
||||
transition: all 0.2s;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.check-tile.on .tile-flag {
|
||||
border-color: var(--el-color-primary);
|
||||
background: var(--el-color-primary);
|
||||
}
|
||||
.check-tile.on .tile-flag::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
left: 5.5px;
|
||||
top: 2.5px;
|
||||
width: 5px;
|
||||
height: 9px;
|
||||
border: solid #fff;
|
||||
border-width: 0 2px 2px 0;
|
||||
transform: rotate(45deg);
|
||||
}
|
||||
|
||||
.tip {
|
||||
width: 100%;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
color: var(--el-text-color-secondary);
|
||||
line-height: 1.6;
|
||||
margin-top: 2px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
|
||||
/* ---------- 操作区 ---------- */
|
||||
.actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
border-top: 1px dashed var(--el-border-color);
|
||||
padding-top: 16px;
|
||||
margin-top: 6px;
|
||||
padding-top: 18px;
|
||||
margin-top: 18px;
|
||||
}
|
||||
|
||||
.status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 10px 14px;
|
||||
border-radius: 10px;
|
||||
background: var(--el-color-primary-light-9);
|
||||
border: 1px solid var(--el-color-primary-light-7);
|
||||
}
|
||||
|
||||
.status-bar {
|
||||
.spacer {
|
||||
flex: 1;
|
||||
}
|
||||
.btn-run {
|
||||
min-width: 150px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
letter-spacing: 2px;
|
||||
background: linear-gradient(135deg, var(--el-color-primary), var(--el-color-primary-dark-2));
|
||||
box-shadow: 0 6px 16px var(--el-color-primary-light-6);
|
||||
transition: filter 0.2s, box-shadow 0.2s, transform 0.15s;
|
||||
}
|
||||
.btn-run:hover {
|
||||
filter: brightness(1.06);
|
||||
box-shadow: 0 8px 20px var(--el-color-primary-light-5);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
.btn-run:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
.btn-run.is-loading {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* ---------- 运行状态 ---------- */
|
||||
.status {
|
||||
padding: 14px 16px;
|
||||
border-radius: 12px;
|
||||
background: linear-gradient(135deg, var(--el-color-primary-light-9), var(--el-color-primary-light-8));
|
||||
border: 1px solid var(--el-color-primary-light-6);
|
||||
box-shadow: 0 2px 10px var(--el-color-primary-light-7);
|
||||
}
|
||||
.status-bar :deep(.el-progress-bar__outer) {
|
||||
background: rgba(64, 158, 255, 0.15);
|
||||
}
|
||||
.status-bar :deep(.el-progress-bar__inner) {
|
||||
background: linear-gradient(90deg, var(--el-color-primary), var(--el-color-primary-dark-2));
|
||||
}
|
||||
.status-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.pulse {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: var(--el-color-primary);
|
||||
animation: pulse 1.4s ease-out infinite;
|
||||
}
|
||||
@keyframes pulse {
|
||||
0% {
|
||||
box-shadow: 0 0 0 0 var(--el-color-primary-light-6);
|
||||
}
|
||||
70% {
|
||||
box-shadow: 0 0 0 8px transparent;
|
||||
}
|
||||
100% {
|
||||
box-shadow: 0 0 0 0 transparent;
|
||||
}
|
||||
}
|
||||
.status-txt {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
white-space: nowrap;
|
||||
flex: 1;
|
||||
font-size: 12.5px;
|
||||
color: var(--el-text-color-regular);
|
||||
line-height: 1.5;
|
||||
}
|
||||
.status-pct {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: var(--el-color-primary);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
</style>
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+20
-20
File diff suppressed because one or more lines are too long
@@ -4,8 +4,8 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>考勤月报封存检查</title>
|
||||
<script type="module" crossorigin src="/pui/xq0011/assets/index-DROFMwiS.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/pui/xq0011/assets/index-CqpBmu33.css">
|
||||
<script type="module" crossorigin src="/pui/xq0011/assets/index-C6kdsQdY.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/pui/xq0011/assets/index-BjCl3jYx.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
@@ -1,18 +1,36 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<!-- 未登录 / 结果横幅 -->
|
||||
<el-alert v-if="needLogin" type="warning" :closable="false" show-icon title="未登录:请先在壳子(工作台)登录统一账户,再刷新本界面" />
|
||||
<el-alert v-else-if="banner" :type="banner.type" :closable="true" show-icon @close="banner = null">
|
||||
<template #title>{{ banner.text }}</template>
|
||||
</el-alert>
|
||||
<transition name="fade-slide">
|
||||
<el-alert v-if="needLogin" type="warning" :closable="false" show-icon
|
||||
title="未登录:请先在壳子(工作台)登录统一账户,再刷新本界面" />
|
||||
<el-alert v-else-if="banner" :type="banner.type" :closable="true" show-icon @close="banner = null">
|
||||
<template #title>{{ banner.text }}</template>
|
||||
</el-alert>
|
||||
</transition>
|
||||
|
||||
<!-- 执行配置(头部含多配置方案:方案供「定时任务」引用,到点自动取方案最新参数) -->
|
||||
<el-card shadow="never" class="card">
|
||||
<el-card shadow="never" class="panel">
|
||||
<template #header>
|
||||
<div class="card-head">
|
||||
<span class="card-title">执行配置</span>
|
||||
<div class="panel-head">
|
||||
<div class="panel-title">
|
||||
<span class="title-ico">
|
||||
<svg viewBox="0 0 24 24" width="17" height="17" fill="none" stroke="currentColor"
|
||||
stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z" />
|
||||
<path d="M3.3 7 12 12l8.7-5" />
|
||||
<path d="M12 22V12" />
|
||||
</svg>
|
||||
</span>
|
||||
<div class="title-txts">
|
||||
<div class="title-txt">执行配置</div>
|
||||
<div class="title-sub">参数自动保存到本机,方案供定时任务到点引用</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="head-tools">
|
||||
<span v-if="lastSavedAt" class="saved">已保存 {{ lastSavedAt }}</span>
|
||||
<span v-if="lastSavedAt" class="saved">
|
||||
<i class="dot" />已保存 {{ lastSavedAt }}
|
||||
</span>
|
||||
<el-select v-model="schemeSel" class="scheme-sel" size="small" :disabled="running"
|
||||
@change="onSchemeChange">
|
||||
<el-option v-for="o in schemeOptions" :key="o.value" :label="o.label" :value="o.value" />
|
||||
@@ -23,41 +41,61 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-form label-width="120px" label-position="right">
|
||||
<div class="grid">
|
||||
<el-form-item label="执行模式">
|
||||
<el-select v-model="form.mode" :disabled="running">
|
||||
<el-option label="两个都导" value="两个都导" />
|
||||
<el-option label="物料收发汇总表" value="物料收发汇总表" />
|
||||
<el-option label="采购订单列表" value="采购订单列表" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="ERP系统">
|
||||
<el-radio-group v-model="form.erp_system" :disabled="running">
|
||||
<el-radio-button value="新版">新版</el-radio-button>
|
||||
<el-radio-button value="旧版">旧版</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<div class="grid">
|
||||
<el-form-item label="登录账号">
|
||||
<el-input v-model="form.erp_username" placeholder="你的ERP登录账号" :disabled="running" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="登录密码">
|
||||
<el-input v-model="form.erp_password" type="password" show-password placeholder="仅保存在本机,下次免填"
|
||||
:disabled="running" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form label-position="top">
|
||||
<!-- 登录账号 -->
|
||||
<section class="sec">
|
||||
<div class="sec-head">
|
||||
<span class="sec-badge">01</span>
|
||||
<span class="sec-name">登录账号</span>
|
||||
<span class="sec-line" />
|
||||
</div>
|
||||
<div class="grid grid-4">
|
||||
<el-form-item label="执行模式">
|
||||
<el-select v-model="form.mode" :disabled="running">
|
||||
<el-option label="两个都导" value="两个都导" />
|
||||
<el-option label="物料收发汇总表" value="物料收发汇总表" />
|
||||
<el-option label="采购订单列表" value="采购订单列表" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="ERP系统">
|
||||
<el-radio-group v-model="form.erp_system" :disabled="running">
|
||||
<el-radio-button value="新版">新版</el-radio-button>
|
||||
<el-radio-button value="旧版">旧版</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="登录账号">
|
||||
<el-input v-model="form.erp_username" placeholder="你的ERP登录账号" :disabled="running" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="登录密码">
|
||||
<el-input v-model="form.erp_password" type="password" show-password placeholder="仅保存在本机,下次免填"
|
||||
:disabled="running" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<el-form-item label="查询组织">
|
||||
<el-input v-model="form.org_name" :disabled="running" clearable
|
||||
placeholder="新版默认=金七象;旧版默认=99.01.07.01.01 石桥铺会馆,切换ERP系统自动带出" />
|
||||
<div class="tip">切换 ERP 系统时会自动带出该系统默认组织;如已自定义组织名则保持不变</div>
|
||||
</el-form-item>
|
||||
|
||||
<template v-if="form.mode !== '采购订单列表'">
|
||||
<el-form-item label="仓库编码">
|
||||
<!-- 查询范围 -->
|
||||
<section class="sec">
|
||||
<div class="sec-head">
|
||||
<span class="sec-badge">02</span>
|
||||
<span class="sec-name">查询范围</span>
|
||||
<span class="sec-line" />
|
||||
</div>
|
||||
<div class="grid">
|
||||
<el-form-item label="查询组织">
|
||||
<el-input v-model="form.org_name" :disabled="running" clearable
|
||||
placeholder="新版默认=金七象;旧版默认=99.01.07.01.01 石桥铺会馆,切换ERP系统自动带出" />
|
||||
<div class="tip">切换 ERP 系统时会自动带出该系统默认组织;如已自定义组织名则保持不变</div>
|
||||
</el-form-item>
|
||||
<el-form-item v-if="form.mode !== '采购订单列表'" label="日期选项">
|
||||
<el-select v-model="form.date_options" multiple filterable allow-create default-first-option
|
||||
:reserve-keyword="false" placeholder="勾选预设,或输入自定义区间后回车" :disabled="running" class="wide">
|
||||
<el-option v-for="d in DATE_PRESETS" :key="d" :value="d" :label="d" />
|
||||
</el-select>
|
||||
<div class="tip">N天 = 今天往前推N天,逐档导出;自定义区间格式:2026-01-01~2026-09-15(输入后回车)</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form-item v-if="form.mode !== '采购订单列表'" label="仓库编码">
|
||||
<el-select v-model="form.stock_codes" multiple filterable allow-create default-first-option
|
||||
:reserve-keyword="false" placeholder="勾选预设或输入新编码后回车" :disabled="running" class="wide">
|
||||
<el-option v-for="c in STOCK_PRESETS" :key="c" :value="c" :label="c" />
|
||||
@@ -65,41 +103,50 @@
|
||||
<div class="tip">查询统一下载全部仓库,下载后按所选编码对应的中文仓库名自动筛选;留空=全部不筛选。切换 ERP 系统自动带出该系统默认仓库(新版=五个三方仓;旧版=03010127 代管仓)
|
||||
</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="日期选项">
|
||||
<el-select v-model="form.date_options" multiple filterable allow-create default-first-option
|
||||
:reserve-keyword="false" placeholder="勾选预设,或输入自定义区间后回车" :disabled="running" class="wide">
|
||||
<el-option v-for="d in DATE_PRESETS" :key="d" :value="d" :label="d" />
|
||||
</el-select>
|
||||
<div class="tip">N天 = 今天往前推N天,逐档导出;自定义区间格式:2026-01-01~2026-09-15(输入后回车)</div>
|
||||
</el-form-item>
|
||||
</template>
|
||||
</section>
|
||||
|
||||
<div class="grid">
|
||||
<el-form-item v-if="form.mode !== '物料收发汇总表'" label="快捷方案">
|
||||
<el-input v-model="form.scheme_name" :disabled="running" clearable placeholder="采购订单列表使用的过滤方案名(精确匹配)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="保存目录">
|
||||
<el-input v-model="form.save_dir" :disabled="running" clearable placeholder="留空 = 桌面/采购计划报表_今天日期" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
<!-- 导出设置 -->
|
||||
<section class="sec">
|
||||
<div class="sec-head">
|
||||
<span class="sec-badge">03</span>
|
||||
<span class="sec-name">导出设置</span>
|
||||
<span class="sec-line" />
|
||||
</div>
|
||||
<div class="grid">
|
||||
<el-form-item v-if="form.mode !== '物料收发汇总表'" label="快捷方案">
|
||||
<el-input v-model="form.scheme_name" :disabled="running" clearable placeholder="采购订单列表使用的过滤方案名(精确匹配)" />
|
||||
</el-form-item>
|
||||
<el-form-item label="保存目录">
|
||||
<el-input v-model="form.save_dir" :disabled="running" clearable placeholder="留空 = 桌面/采购计划报表_今天日期" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 操作 -->
|
||||
<div class="actions">
|
||||
<el-button type="primary" size="large" :loading="running" @click="run">
|
||||
<el-button type="primary" size="large" class="btn-run" :loading="running" @click="run">
|
||||
{{ running ? '执行中 ' + progress + '%' : '一键执行' }}
|
||||
</el-button>
|
||||
<el-button v-if="running" type="danger" size="large" plain :loading="stopping"
|
||||
@click="forceStop">强制停止</el-button>
|
||||
<span class="spacer" />
|
||||
<el-button size="large" :disabled="running" @click="saveNow(true)">保存配置</el-button>
|
||||
<el-button size="large" text :disabled="running" @click="resetDefaults">恢复默认</el-button>
|
||||
</div>
|
||||
</el-form>
|
||||
</el-card>
|
||||
|
||||
<!-- 运行状态:进度条 + 日志位置提示(日志实时显示在壳子下方日志区) -->
|
||||
<div v-if="running" class="status">
|
||||
<el-progress :percentage="progress" :stroke-width="8" class="status-bar" />
|
||||
<span class="status-txt">正在执行,日志与进度实时显示在工作台下方【运行日志】区</span>
|
||||
</div>
|
||||
<!-- 运行状态 -->
|
||||
<transition name="fade-slide">
|
||||
<div v-if="running" class="status">
|
||||
<el-progress :percentage="progress" :stroke-width="10" :show-text="false" class="status-bar" />
|
||||
<div class="status-row">
|
||||
<span class="pulse" />
|
||||
<span class="status-txt">正在执行,日志与进度实时显示在工作台下方【运行日志】区</span>
|
||||
<span class="status-pct">{{ progress }}%</span>
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -181,58 +228,166 @@ watch(() => form.erp_system, (sys) => {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* ---------- 页面骨架 ---------- */
|
||||
.page {
|
||||
width: 100%;
|
||||
padding: 4px 2px 20px;
|
||||
padding: 6px 4px 28px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.card {
|
||||
border-radius: 10px;
|
||||
.fade-slide-enter-active,
|
||||
.fade-slide-leave-active {
|
||||
transition: opacity 0.25s ease, transform 0.25s ease;
|
||||
}
|
||||
.fade-slide-enter-from,
|
||||
.fade-slide-leave-to {
|
||||
opacity: 0;
|
||||
transform: translateY(-6px);
|
||||
}
|
||||
|
||||
.card-head {
|
||||
/* ---------- 主容器(无边框平铺:外层由壳子 iframe 的边框统一包裹) ---------- */
|
||||
.panel {
|
||||
background: transparent;
|
||||
border-radius: 0;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
.panel :deep(.el-card__header) {
|
||||
padding: 6px 2px 16px;
|
||||
border-bottom: 1px solid var(--el-border-color-lighter);
|
||||
background: transparent;
|
||||
}
|
||||
.panel :deep(.el-card__body) {
|
||||
padding: 16px 2px 2px;
|
||||
}
|
||||
|
||||
/* ---------- 卡片头部 ---------- */
|
||||
.panel-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
.panel-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
.title-ico {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--el-color-primary);
|
||||
background: linear-gradient(135deg, var(--el-color-primary-light-8), var(--el-color-primary-light-6));
|
||||
box-shadow: inset 0 0 0 1px var(--el-color-primary-light-5);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.title-txts {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
.title-txt {
|
||||
font-weight: 700;
|
||||
font-size: 15px;
|
||||
line-height: 1.2;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
.title-sub {
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.head-tools {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.scheme-sel {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.saved {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
color: #67c23a;
|
||||
color: #2ea44f;
|
||||
background: rgba(46, 164, 79, 0.1);
|
||||
border: 1px solid rgba(46, 164, 79, 0.25);
|
||||
padding: 2px 10px;
|
||||
border-radius: 999px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.saved .dot {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: #2ea44f;
|
||||
}
|
||||
|
||||
/* ---------- 表单分区 ---------- */
|
||||
.sec {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.sec:last-of-type {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.sec-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
.sec-badge {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border-radius: 7px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
color: var(--el-color-primary);
|
||||
background: var(--el-color-primary-light-9);
|
||||
border: 1px solid var(--el-color-primary-light-7);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.sec-name {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--el-text-color-primary);
|
||||
white-space: nowrap;
|
||||
}
|
||||
.sec-line {
|
||||
flex: 1;
|
||||
height: 1px;
|
||||
background: linear-gradient(90deg, var(--el-border-color-lighter), transparent);
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: flex;
|
||||
gap: 18px;
|
||||
flex-wrap: wrap;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||
gap: 0 18px;
|
||||
}
|
||||
|
||||
.grid .el-form-item {
|
||||
flex: 1;
|
||||
min-width: 280px;
|
||||
/* 登录账号区:四个字段同一行(内嵌客户端宽度充裕,固定 4 列) */
|
||||
.grid-4 {
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
}
|
||||
.grid :deep(.el-form-item) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.grid :deep(.el-form-item__label) {
|
||||
padding-bottom: 6px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.wide {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -240,37 +395,92 @@ watch(() => form.erp_system, (sys) => {
|
||||
.tip {
|
||||
width: 100%;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
color: var(--el-text-color-secondary);
|
||||
line-height: 1.6;
|
||||
margin-top: 2px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
/* ---------- 操作区 ---------- */
|
||||
.actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
border-top: 1px dashed var(--el-border-color);
|
||||
padding-top: 16px;
|
||||
margin-top: 6px;
|
||||
padding-top: 18px;
|
||||
margin-top: 18px;
|
||||
}
|
||||
|
||||
.status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 10px 14px;
|
||||
border-radius: 10px;
|
||||
background: var(--el-color-primary-light-9);
|
||||
border: 1px solid var(--el-color-primary-light-7);
|
||||
}
|
||||
|
||||
.status-bar {
|
||||
.spacer {
|
||||
flex: 1;
|
||||
}
|
||||
.btn-run {
|
||||
min-width: 150px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
letter-spacing: 2px;
|
||||
background: linear-gradient(135deg, var(--el-color-primary), var(--el-color-primary-dark-2));
|
||||
box-shadow: 0 6px 16px var(--el-color-primary-light-6);
|
||||
transition: filter 0.2s, box-shadow 0.2s, transform 0.15s;
|
||||
}
|
||||
.btn-run:hover {
|
||||
filter: brightness(1.06);
|
||||
box-shadow: 0 8px 20px var(--el-color-primary-light-5);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
.btn-run:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
.btn-run.is-loading {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* ---------- 运行状态 ---------- */
|
||||
.status {
|
||||
padding: 14px 16px;
|
||||
border-radius: 12px;
|
||||
background: linear-gradient(135deg, var(--el-color-primary-light-9), var(--el-color-primary-light-8));
|
||||
border: 1px solid var(--el-color-primary-light-6);
|
||||
box-shadow: 0 2px 10px var(--el-color-primary-light-7);
|
||||
}
|
||||
.status-bar :deep(.el-progress-bar__outer) {
|
||||
background: rgba(64, 158, 255, 0.15);
|
||||
}
|
||||
.status-bar :deep(.el-progress-bar__inner) {
|
||||
background: linear-gradient(90deg, var(--el-color-primary), var(--el-color-primary-dark-2));
|
||||
}
|
||||
.status-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.pulse {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: var(--el-color-primary);
|
||||
animation: pulse 1.4s ease-out infinite;
|
||||
}
|
||||
@keyframes pulse {
|
||||
0% {
|
||||
box-shadow: 0 0 0 0 var(--el-color-primary-light-6);
|
||||
}
|
||||
70% {
|
||||
box-shadow: 0 0 0 8px transparent;
|
||||
}
|
||||
100% {
|
||||
box-shadow: 0 0 0 0 transparent;
|
||||
}
|
||||
}
|
||||
.status-txt {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
white-space: nowrap;
|
||||
flex: 1;
|
||||
font-size: 12.5px;
|
||||
color: var(--el-text-color-regular);
|
||||
line-height: 1.5;
|
||||
}
|
||||
.status-pct {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: var(--el-color-primary);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
</style>
|
||||
|
||||
+16
-16
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
@@ -4,8 +4,8 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>ERP报表导出</title>
|
||||
<script type="module" crossorigin src="/pui/xq0031_xq0032/assets/index-C0BJWpiK.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/pui/xq0031_xq0032/assets/index-EmQ-Keqw.css">
|
||||
<script type="module" crossorigin src="/pui/xq0031_xq0032/assets/index-EpDPYe3Q.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/pui/xq0031_xq0032/assets/index-u2-ZnLC2.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>␍
|
||||
|
||||
@@ -52,7 +52,7 @@ def _build_tasks(mode, day_date, month_date):
|
||||
class TongLianExportPlugin(ScenePlugin):
|
||||
id = "xq0045_xq0046"
|
||||
name = "金色印象通联数据导出"
|
||||
version = "1.0.7"
|
||||
version = "1.0.9"
|
||||
description = ("通联支付交易数据自动导出:XQ0045 按日 / XQ0046 按月,"
|
||||
"账号全量数据导出(含全部商户),服务端生成文件直存本地,"
|
||||
"并按商户分组自动拆分为金色印象门店/品牌管理公司/其他账号 3 个工作簿")
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
- print → config.log;返回 requests.Session(登录后会话直接可用,无需浏览器常驻)。
|
||||
|
||||
登录方式(接口优先,浏览器兜底):
|
||||
1) 接口登录(首选,已实测一次成功):GET /login(拿 SESSION + 页面内嵌 publicKey)
|
||||
→ GET /getvalidCode?type=cuserrorCode 验证码图 → ddddocr 识别(4位)
|
||||
1) 接口登录(首选,已实测一次成功):GET /login(拿 SESSION + 页面内嵌 publicKey +
|
||||
隐藏表单字段 token/logintype/isscanlogin)
|
||||
→ GET /getvalidCode?type=cuserrorCode 验证码图 → ddddocr 双模型交叉识别(4位)
|
||||
→ JSEncrypt 兼容 RSA 加密密码(PKCS#1 v1.5 + base64)→ POST /login(userid/
|
||||
encpassword/cuserrorCode,带 Referer)→ 302 离开 /login 即成功;
|
||||
encpassword/cuserrorCode + 表单隐藏字段,带 Referer)→ 302 离开 /login 即成功;
|
||||
2) 浏览器兜底:DrissionPage 现场登录(验证码元素截图 + ddddocr),成功后从浏览器
|
||||
cookies 构建 requests.Session。
|
||||
|
||||
@@ -37,6 +38,7 @@ _PUBKEY_RE = re.compile(r"var publicKey='([^']+)'")
|
||||
_LOGIN_FORM_RE = re.compile(r'<form[^>]*id=["\']?accountForm|action=["\']?/login')
|
||||
|
||||
_ocr = None
|
||||
_ocr_beta = None
|
||||
|
||||
|
||||
def _get_ocr():
|
||||
@@ -48,6 +50,73 @@ def _get_ocr():
|
||||
return _ocr
|
||||
|
||||
|
||||
def _get_ocr_beta():
|
||||
"""ddddocr beta 模型单例:与默认模型交叉校验,提升易混字符识别置信度。"""
|
||||
global _ocr_beta
|
||||
if _ocr_beta is None:
|
||||
import ddddocr
|
||||
_ocr_beta = ddddocr.DdddOcr(show_ad=False, beta=True)
|
||||
return _ocr_beta
|
||||
|
||||
|
||||
# 命中即终止登录(重试验证码无济于事)
|
||||
_ERR_TERMINAL = ('锁定', '次数已达上限', '密码错误', '账号或密码', '用户名不存在',
|
||||
'用户不存在', '不存在该账号', '密码已过期', '登录失败次数')
|
||||
# 风控锁定提示(出现即停止一切登录尝试,浏览器兜底也跳过,避免给锁定“续期”)
|
||||
_LOCK_HINT_RE = re.compile(r'锁定|次数已达上限|次数已达|2小时')
|
||||
|
||||
|
||||
class LoginLockedError(Exception):
|
||||
"""通联账号被风控锁定(服务端提示「次数已达上限」等)。命中后不再做任何登录尝试。"""
|
||||
|
||||
|
||||
def _extract_errormsg(text):
|
||||
"""读取服务端回显的登录错误文案(登录页内嵌 var errormsg='...')。空串=无明确提示。
|
||||
|
||||
实测:验证码错误时 errormsg 为空(页面静默重渲染);账号/密码类错误会回显
|
||||
(如“用户名不存在/密码错误”)。
|
||||
"""
|
||||
m = re.search(r"var errormsg='([^']*)'", text or '')
|
||||
return m.group(1).strip() if m and m.group(1) else ''
|
||||
|
||||
|
||||
def _parse_login_form(html):
|
||||
"""解析登录表单隐藏字段,随 POST 一并提交(与真实浏览器一致,防服务端收紧校验):
|
||||
token(CSRF 随机值,随页面下发)、logintype、isscanlogin。缺失时回退默认值。
|
||||
"""
|
||||
def _v(name, default=''):
|
||||
m = re.search(r'name="%s"\s+value="([^"]*)"' % name, html or '')
|
||||
return m.group(1) if m else default
|
||||
return {'token': _v('token'), 'logintype': _v('logintype', 'userid_login'),
|
||||
'isscanlogin': _v('isscanlogin', '0')}
|
||||
|
||||
|
||||
def _read_captcha_confident(session, max_refresh=3):
|
||||
"""获取验证码并交叉识别:默认模型与 beta 模型结果一致才采用(对 0/O、1/l/I 等
|
||||
易混字符更稳),不一致则刷新验证码重试——仅刷新不提交,不消耗服务端登录尝试次数。
|
||||
|
||||
返回 (code, agreed);多次未达成一致时回退默认模型结果(保持原行为),
|
||||
连续读不出 4 位验证码时返回 (None, False)。
|
||||
"""
|
||||
ocr, ocr_beta = _get_ocr(), _get_ocr_beta()
|
||||
last_code = ''
|
||||
for _ in range(max(1, max_refresh)):
|
||||
try:
|
||||
img = session.get(_VALIDCODE_URL, timeout=20).content
|
||||
except Exception as e:
|
||||
config.log(f"[通联登录] 获取验证码图异常:{e}")
|
||||
return None, False
|
||||
code = ocr.classification(img).strip()
|
||||
if len(code) != 4:
|
||||
continue
|
||||
last_code = code
|
||||
if ocr_beta.classification(img).strip() == code:
|
||||
return code, True
|
||||
if not last_code:
|
||||
return None, False
|
||||
return last_code, False
|
||||
|
||||
|
||||
def _human_pause(a=None, b=None):
|
||||
"""操作间随机延时,模拟人工节奏。"""
|
||||
lo, hi = HUMAN_DELAY if (a is None or b is None) else (a, b)
|
||||
@@ -71,10 +140,12 @@ def _rsa_encrypt(pubkey, pwd):
|
||||
def _api_login(username, password):
|
||||
"""接口登录(纯 requests,不弹浏览器)。成功返回 requests.Session,失败返回 None。
|
||||
|
||||
服务端行为(探针实测):
|
||||
服务端行为(探针实测复核):
|
||||
- /login 页面内嵌固定 RSA 公钥(publicKey,1024 位 PKCS#1);
|
||||
- 验证码 4 位,GET /getvalidCode?type=cuserrorCode 返回图片(session 绑定);
|
||||
- POST /login 需带 Referer(外链校验),成功 302 到 /main。
|
||||
- 表单含隐藏字段 token(CSRF)/logintype/isscanlogin,POST /login 需带 Referer
|
||||
(外链校验);验证码错误时服务端静默重渲染登录页(errormsg 为空),账号/密码
|
||||
类错误在 errormsg 回显;成功 302 离开 /login。
|
||||
"""
|
||||
session = requests.Session()
|
||||
session.headers.update({"User-Agent": _UA})
|
||||
@@ -91,28 +162,24 @@ def _api_login(username, password):
|
||||
return None
|
||||
pubkey = m.group(1)
|
||||
enc = _rsa_encrypt(pubkey, password)
|
||||
form_extra = _parse_login_form(html)
|
||||
except Exception as e:
|
||||
config.log(f"[通联登录] 接口登录准备异常:{e}")
|
||||
return None
|
||||
|
||||
ocr = _get_ocr()
|
||||
for attempt in range(config.API_CAPTCHA_RETRY):
|
||||
try:
|
||||
img = session.get(_VALIDCODE_URL, timeout=20).content
|
||||
except Exception as e:
|
||||
config.log(f"[通联登录] 获取验证码图异常:{e}")
|
||||
code, agreed = _read_captcha_confident(session)
|
||||
if not code:
|
||||
config.log("[通联登录] 连续未能识别出 4 位验证码,停止接口登录")
|
||||
return None
|
||||
code = ocr.classification(img).strip()
|
||||
config.log(f"[通联登录] 接口登录 第 {attempt + 1}/{config.API_CAPTCHA_RETRY} 次验证码识别:{code!r}")
|
||||
if len(code) != 4:
|
||||
time.sleep(1)
|
||||
continue
|
||||
agree_note = "" if agreed else "(双模型未一致,按默认模型提交)"
|
||||
config.log(f"[通联登录] 接口登录 第 {attempt + 1}/{config.API_CAPTCHA_RETRY} 次验证码识别:{code!r}{agree_note}")
|
||||
data = {'userid': username, 'encpassword': enc, 'cuserrorCode': code}
|
||||
data.update({k: v for k, v in form_extra.items() if v})
|
||||
try:
|
||||
resp = session.post(config.LOGIN_URL, data={
|
||||
'userid': username,
|
||||
'encpassword': enc,
|
||||
'cuserrorCode': code,
|
||||
}, headers={'Referer': config.LOGIN_URL}, timeout=20, allow_redirects=True)
|
||||
resp = session.post(config.LOGIN_URL, data=data,
|
||||
headers={'Referer': config.LOGIN_URL},
|
||||
timeout=20, allow_redirects=True)
|
||||
except Exception as e:
|
||||
config.log(f"[通联登录] 提交登录异常:{e}")
|
||||
return None
|
||||
@@ -121,11 +188,13 @@ def _api_login(username, password):
|
||||
return session
|
||||
# 仍在登录页:验证码错/账号密码错/风控。每次提交都计入服务端尝试次数,
|
||||
# 失败后退避并停止(不连续重试,避免触发登录次数风控锁定)
|
||||
hit = re.search(r'验证码错误|验证码不正确|账号或密码|密码错误|登录失败|次数已达上限|锁定', resp.text)
|
||||
if hit:
|
||||
config.log(f"[通联登录] 服务端提示:{hit.group(0)}")
|
||||
if '次数已达上限' in hit.group(0) or '锁定' in hit.group(0):
|
||||
errormsg = _extract_errormsg(resp.text)
|
||||
if errormsg:
|
||||
config.log(f"[通联登录] 服务端提示:{errormsg}")
|
||||
if '锁定' in errormsg or '次数' in errormsg:
|
||||
config.log("[通联登录] 检测到风控锁定提示,立即停止登录尝试")
|
||||
raise LoginLockedError(errormsg)
|
||||
if any(k in errormsg for k in _ERR_TERMINAL):
|
||||
return None
|
||||
time.sleep(config.LOGIN_FAIL_BACKOFF)
|
||||
config.log("[通联登录] 接口登录验证码多次未通过,停止重试")
|
||||
@@ -173,10 +242,8 @@ def _read_img_bytes(img):
|
||||
|
||||
|
||||
def _recognize_captcha(img_bytes):
|
||||
"""ddddocr 识别图形验证码,返回文本。懒加载避免无关场景导入开销。"""
|
||||
import ddddocr
|
||||
ocr = ddddocr.DdddOcr(show_ad=False)
|
||||
return ocr.classification(img_bytes).strip()
|
||||
"""ddddocr 识别图形验证码,返回文本。复用全局单例,避免重复加载模型。"""
|
||||
return _get_ocr().classification(img_bytes).strip()
|
||||
|
||||
|
||||
def _refresh_captcha(page, img):
|
||||
@@ -214,7 +281,11 @@ def _ensure_account_tab(page):
|
||||
|
||||
|
||||
def _wait_login_result(page):
|
||||
"""提交后轮询判定登录结果,返回 bool。"""
|
||||
"""提交后轮询判定登录结果。
|
||||
|
||||
返回:True=登录成功;str=失败提示文案;''=超时未判定。
|
||||
调用方据此可区分「验证码/账号错」与「风控锁定」。
|
||||
"""
|
||||
for _ in range(30): # 最多等 15 秒
|
||||
time.sleep(0.5)
|
||||
if _on_target(page):
|
||||
@@ -232,8 +303,8 @@ def _wait_login_result(page):
|
||||
text = ''
|
||||
if text:
|
||||
config.log(f"[通联登录] 失败提示:{text}")
|
||||
return False
|
||||
return False
|
||||
return text
|
||||
return ''
|
||||
|
||||
|
||||
def _input_value(ele):
|
||||
@@ -314,8 +385,12 @@ def _try_login_once(page, username, password):
|
||||
_human_pause(0.2, 0.6)
|
||||
btn.click()
|
||||
|
||||
if _wait_login_result(page):
|
||||
result = _wait_login_result(page)
|
||||
if result is True:
|
||||
return True
|
||||
if result and _LOCK_HINT_RE.search(result):
|
||||
config.log("[通联登录] 检测到风控锁定提示,停止浏览器登录")
|
||||
return False
|
||||
_refresh_captcha(page, img)
|
||||
return False
|
||||
|
||||
@@ -405,7 +480,12 @@ def tl_login(username, password):
|
||||
下次运行直接复用免登录(探活失败才重新登录)。
|
||||
"""
|
||||
username = (username or '').strip()
|
||||
password = password or ''
|
||||
raw_password = password or ''
|
||||
# 清洗密码首尾空白(含全角空格等):配置被误存前导空格时,直接拿原值登录必被
|
||||
# 服务端判“账户名或登录密码不正确”,累计触发风控锁定。密码内部空格保留。
|
||||
password = raw_password.strip()
|
||||
if password != raw_password:
|
||||
config.log("[通联登录] 已清洗密码首尾空白字符(如真实密码首尾确有空格,请到插件界面更正后重试)")
|
||||
if not (username and password):
|
||||
config.log("[通联登录] 账号/密码缺失(请在插件界面填写并保存配置)")
|
||||
return None
|
||||
@@ -420,7 +500,13 @@ def tl_login(username, password):
|
||||
# 2) 接口登录(首选,不弹浏览器)
|
||||
config.log("[通联登录] 本地会话失效,开始重新登录(单点登录:本次登录会顶掉其它")
|
||||
config.log("[通联登录] 设备/浏览器上的同一账号登录)")
|
||||
session = _api_login(username, password)
|
||||
try:
|
||||
session = _api_login(username, password)
|
||||
except LoginLockedError as e:
|
||||
# 账号已被风控锁定:浏览器兜底同样会被拒,且每次提交都会给锁定“续期”,
|
||||
# 直接停止,等锁定解除后再跑(服务端一般提示 2 小时后恢复)。
|
||||
config.log(f"[通联登录] 账号已被风控锁定({e}),跳过浏览器登录,请稍后再试")
|
||||
return None
|
||||
if session is not None:
|
||||
save_session(username, session)
|
||||
return session
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"schema_version": 1,
|
||||
"id": "xq0045_xq0046",
|
||||
"name": "金色印象通联数据导出",
|
||||
"version": "1.0.7",
|
||||
"version": "1.0.9",
|
||||
"description": "通联支付商户服务平台(cus.allinpay.com)交易数据自动导出:XQ0045 按日、XQ0046 按月,账号全量数据导出(含全部商户),服务端生成文件直存本地,并按商户分组自动拆分为金色印象门店/品牌管理公司/其他账号 3 个工作簿",
|
||||
"category": "报表",
|
||||
"icon": "",
|
||||
|
||||
@@ -1,18 +1,36 @@
|
||||
<template>
|
||||
<div class="page">
|
||||
<!-- 未登录 / 结果横幅 -->
|
||||
<el-alert v-if="needLogin" type="warning" :closable="false" show-icon title="未登录:请先在壳子(工作台)登录统一账户,再刷新本界面" />
|
||||
<el-alert v-else-if="banner" :type="banner.type" :closable="true" show-icon @close="banner = null">
|
||||
<template #title>{{ banner.text }}</template>
|
||||
</el-alert>
|
||||
<transition name="fade-slide">
|
||||
<el-alert v-if="needLogin" type="warning" :closable="false" show-icon
|
||||
title="未登录:请先在壳子(工作台)登录统一账户,再刷新本界面" />
|
||||
<el-alert v-else-if="banner" :type="banner.type" :closable="true" show-icon @close="banner = null">
|
||||
<template #title>{{ banner.text }}</template>
|
||||
</el-alert>
|
||||
</transition>
|
||||
|
||||
<!-- 执行配置(头部含多配置方案:方案供「定时任务」引用,到点自动取方案最新参数) -->
|
||||
<el-card shadow="never" class="card">
|
||||
<el-card shadow="never" class="panel">
|
||||
<template #header>
|
||||
<div class="card-head">
|
||||
<span class="card-title">执行配置</span>
|
||||
<div class="panel-head">
|
||||
<div class="panel-title">
|
||||
<span class="title-ico">
|
||||
<svg viewBox="0 0 24 24" width="17" height="17" fill="none" stroke="currentColor"
|
||||
stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
|
||||
<polyline points="7 10 12 15 17 10" />
|
||||
<line x1="12" y1="15" x2="12" y2="3" />
|
||||
</svg>
|
||||
</span>
|
||||
<div class="title-txts">
|
||||
<div class="title-txt">执行配置</div>
|
||||
<div class="title-sub">参数自动保存到本机,方案供定时任务到点引用</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="head-tools">
|
||||
<span v-if="lastSavedAt" class="saved">已保存 {{ lastSavedAt }}</span>
|
||||
<span v-if="lastSavedAt" class="saved">
|
||||
<i class="dot" />已保存 {{ lastSavedAt }}
|
||||
</span>
|
||||
<el-select v-model="schemeSel" class="scheme-sel" size="small" :disabled="running"
|
||||
@change="onSchemeChange">
|
||||
<el-option v-for="o in schemeOptions" :key="o.value" :label="o.label" :value="o.value" />
|
||||
@@ -23,79 +41,95 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<el-form label-width="110px" label-position="right">
|
||||
<!-- 通联账号密码 -->
|
||||
<div class="grid">
|
||||
<el-form-item label="通联账号">
|
||||
<el-input v-model="form.tl_username" placeholder="商户服务平台登录账号" :disabled="running" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="登录密码">
|
||||
<el-input v-model="form.tl_password" type="password" show-password placeholder="仅保存在本机,下次免填"
|
||||
:disabled="running" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<!-- 执行模式 + 导出内容 -->
|
||||
<div class="grid">
|
||||
<el-form-item label="执行模式">
|
||||
<el-radio-group v-model="form.mode" :disabled="running">
|
||||
<el-radio-button value="日">按日</el-radio-button>
|
||||
<el-radio-button value="月">按月</el-radio-button>
|
||||
<el-radio-button value="日+月">日 + 月</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="导出内容">
|
||||
<el-radio-group v-model="form.content" :disabled="running">
|
||||
<el-radio-button value="交易查询">交易查询</el-radio-button>
|
||||
<el-radio-button value="账单">账单</el-radio-button>
|
||||
<el-radio-button value="两个都导">两个都导</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</div>
|
||||
<el-form label-position="top">
|
||||
<!-- 登录账号 -->
|
||||
<section class="sec">
|
||||
<div class="sec-head">
|
||||
<span class="sec-badge">01</span>
|
||||
<span class="sec-name">登录账号</span>
|
||||
<span class="sec-line" />
|
||||
</div>
|
||||
<div class="grid">
|
||||
<el-form-item label="通联账号">
|
||||
<el-input v-model="form.tl_username" placeholder="商户服务平台登录账号" :disabled="running" clearable />
|
||||
</el-form-item>
|
||||
<el-form-item label="登录密码">
|
||||
<el-input v-model="form.tl_password" type="password" show-password placeholder="仅保存在本机,下次免填"
|
||||
:disabled="running" />
|
||||
</el-form-item>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- 日期选择器(组件复用:交易查询与账单共用,插件内部按导出类型自动换算区间) -->
|
||||
<div v-if="form.mode === '日+月'" class="grid">
|
||||
<el-form-item label="按日导出">
|
||||
<!-- 导出参数 -->
|
||||
<section class="sec">
|
||||
<div class="sec-head">
|
||||
<span class="sec-badge">02</span>
|
||||
<span class="sec-name">导出参数</span>
|
||||
<span class="sec-line" />
|
||||
</div>
|
||||
<div class="grid">
|
||||
<el-form-item label="执行模式">
|
||||
<el-radio-group v-model="form.mode" :disabled="running">
|
||||
<el-radio-button value="日">按日</el-radio-button>
|
||||
<el-radio-button value="月">按月</el-radio-button>
|
||||
<el-radio-button value="日+月">日 + 月</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
<el-form-item label="导出内容">
|
||||
<el-radio-group v-model="form.content" :disabled="running">
|
||||
<el-radio-button value="交易查询">交易查询</el-radio-button>
|
||||
<el-radio-button value="账单">账单</el-radio-button>
|
||||
<el-radio-button value="两个都导">两个都导</el-radio-button>
|
||||
</el-radio-group>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<!-- 日期选择器(组件复用:交易查询与账单共用,插件内部按导出类型自动换算区间) -->
|
||||
<div v-if="form.mode === '日+月'" class="grid">
|
||||
<el-form-item label="按日导出">
|
||||
<el-date-picker v-model="form.day_date" type="date" value-format="YYYY-MM-DD"
|
||||
placeholder="选择日期(默认昨天)" :disabled="running"
|
||||
:disabled-date="disableFuture" class="wide" />
|
||||
<div class="tip">默认昨天;区间=所选日 00:00 ~ 次日 24:00(跨 2 天)</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="按月导出">
|
||||
<el-date-picker v-model="form.month_date" type="month" value-format="YYYY-MM"
|
||||
placeholder="选择月份(默认上月)" :disabled="running"
|
||||
:disabled-date="disableFutureMonth" class="wide" />
|
||||
<div class="tip">默认上月;区间=当月1日 10:00 ~ 下月1日 10:00(对账10点切日)</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<el-form-item v-else-if="form.mode === '日'" label="按日导出">
|
||||
<el-date-picker v-model="form.day_date" type="date" value-format="YYYY-MM-DD"
|
||||
placeholder="选择日期(默认昨天)" :disabled="running"
|
||||
:disabled-date="disableFuture" class="wide" />
|
||||
<div class="tip">默认昨天;区间=所选日 00:00 ~ 次日 24:00(跨 2 天)</div>
|
||||
<div class="tip">默认昨天;区间=所选日 00:00 ~ 次日 24:00(跨 2 天);账单 = 所选日账单</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="按月导出">
|
||||
|
||||
<el-form-item v-else label="按月导出">
|
||||
<el-date-picker v-model="form.month_date" type="month" value-format="YYYY-MM"
|
||||
placeholder="选择月份(默认上月)" :disabled="running"
|
||||
:disabled-date="disableFutureMonth" class="wide" />
|
||||
<div class="tip">默认上月;区间=当月1日 10:00 ~ 下月1日 10:00(对账10点切日)</div>
|
||||
<div class="tip">默认上月;区间=当月1日 10:00 ~ 下月1日 10:00(对账10点切日);账单 = 该月账单</div>
|
||||
</el-form-item>
|
||||
</div>
|
||||
|
||||
<el-form-item v-else-if="form.mode === '日'" label="按日导出">
|
||||
<el-date-picker v-model="form.day_date" type="date" value-format="YYYY-MM-DD"
|
||||
placeholder="选择日期(默认昨天)" :disabled="running"
|
||||
:disabled-date="disableFuture" class="wide" />
|
||||
<div class="tip">默认昨天;区间=所选日 00:00 ~ 次日 24:00(跨 2 天);账单 = 所选日账单</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-else label="按月导出">
|
||||
<el-date-picker v-model="form.month_date" type="month" value-format="YYYY-MM"
|
||||
placeholder="选择月份(默认上月)" :disabled="running"
|
||||
:disabled-date="disableFutureMonth" class="wide" />
|
||||
<div class="tip">默认上月;区间=当月1日 10:00 ~ 下月1日 10:00(对账10点切日);账单 = 该月账单</div>
|
||||
</el-form-item>
|
||||
|
||||
<!-- 保存目录 -->
|
||||
<el-form-item label="保存目录">
|
||||
<el-input v-model="form.save_dir" :disabled="running" clearable
|
||||
placeholder="留空 = 桌面/金色印象通联数据_今天日期" class="wide" />
|
||||
<div class="tip">交易查询=每日期一份账号全量文件(日_日期.xlsx / 月_月份.xlsx,含全部商户);账单=按 账单_YYYYMM 目录存放</div>
|
||||
</el-form-item>
|
||||
<el-form-item label="保存目录">
|
||||
<el-input v-model="form.save_dir" :disabled="running" clearable
|
||||
placeholder="留空 = 桌面/金色印象通联数据_今天日期" />
|
||||
<div class="tip">交易查询=每日期一份账号全量文件(日_日期.xlsx / 月_月份.xlsx,含全部商户);账单=按 账单_YYYYMM 目录存放</div>
|
||||
</el-form-item>
|
||||
</section>
|
||||
|
||||
<!-- 操作 -->
|
||||
<div class="actions">
|
||||
<el-button type="primary" size="large" :loading="running" @click="run">
|
||||
<el-button type="primary" size="large" class="btn-run" :loading="running" @click="run">
|
||||
{{ running ? '执行中 ' + progress + '%' : '一键执行' }}
|
||||
</el-button>
|
||||
<el-button v-if="running" type="danger" size="large" plain :loading="stopping"
|
||||
@click="forceStop">强制停止</el-button>
|
||||
<span class="spacer" />
|
||||
<el-button size="large" :disabled="running" @click="saveNow(true)">保存配置</el-button>
|
||||
<el-button size="large" text :disabled="running" @click="resetDefaults">恢复默认</el-button>
|
||||
</div>
|
||||
@@ -103,10 +137,16 @@
|
||||
</el-card>
|
||||
|
||||
<!-- 运行状态 -->
|
||||
<div v-if="running" class="status">
|
||||
<el-progress :percentage="progress" :stroke-width="8" class="status-bar" />
|
||||
<span class="status-txt">正在执行,日志与进度实时显示在工作台下方【运行日志】区</span>
|
||||
</div>
|
||||
<transition name="fade-slide">
|
||||
<div v-if="running" class="status">
|
||||
<el-progress :percentage="progress" :stroke-width="10" :show-text="false" class="status-bar" />
|
||||
<div class="status-row">
|
||||
<span class="pulse" />
|
||||
<span class="status-txt">正在执行,日志与进度实时显示在工作台下方【运行日志】区</span>
|
||||
<span class="status-pct">{{ progress }}%</span>
|
||||
</div>
|
||||
</div>
|
||||
</transition>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -191,58 +231,165 @@ const {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/* ---------- 页面骨架 ---------- */
|
||||
.page {
|
||||
width: 100%;
|
||||
padding: 4px 2px 20px;
|
||||
padding: 6px 4px 28px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 12px;
|
||||
gap: 14px;
|
||||
}
|
||||
|
||||
.card {
|
||||
border-radius: 10px;
|
||||
.fade-slide-enter-active,
|
||||
.fade-slide-leave-active {
|
||||
transition: opacity 0.25s ease, transform 0.25s ease;
|
||||
}
|
||||
.fade-slide-enter-from,
|
||||
.fade-slide-leave-to {
|
||||
opacity: 0;
|
||||
transform: translateY(-6px);
|
||||
}
|
||||
|
||||
.card-head {
|
||||
/* ---------- 主容器(无边框平铺:外层由壳子 iframe 的边框统一包裹) ---------- */
|
||||
.panel {
|
||||
background: transparent;
|
||||
border-radius: 0;
|
||||
border: none;
|
||||
box-shadow: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
.panel :deep(.el-card__header) {
|
||||
padding: 6px 2px 16px;
|
||||
border-bottom: 1px solid var(--el-border-color-lighter);
|
||||
background: transparent;
|
||||
}
|
||||
.panel :deep(.el-card__body) {
|
||||
padding: 16px 2px 2px;
|
||||
}
|
||||
|
||||
/* ---------- 卡片头部 ---------- */
|
||||
.panel-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.card-title {
|
||||
font-weight: 600;
|
||||
font-size: 14px;
|
||||
.panel-title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
}
|
||||
.title-ico {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
border-radius: 10px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: var(--el-color-primary);
|
||||
background: linear-gradient(135deg, var(--el-color-primary-light-8), var(--el-color-primary-light-6));
|
||||
box-shadow: inset 0 0 0 1px var(--el-color-primary-light-5);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.title-txts {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
.title-txt {
|
||||
font-weight: 700;
|
||||
font-size: 15px;
|
||||
line-height: 1.2;
|
||||
color: var(--el-text-color-primary);
|
||||
}
|
||||
.title-sub {
|
||||
font-size: 12px;
|
||||
color: var(--el-text-color-secondary);
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.head-tools {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.scheme-sel {
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
.saved {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
font-size: 12px;
|
||||
font-weight: 400;
|
||||
color: #67c23a;
|
||||
color: #2ea44f;
|
||||
background: rgba(46, 164, 79, 0.1);
|
||||
border: 1px solid rgba(46, 164, 79, 0.25);
|
||||
padding: 2px 10px;
|
||||
border-radius: 999px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.saved .dot {
|
||||
width: 6px;
|
||||
height: 6px;
|
||||
border-radius: 50%;
|
||||
background: #2ea44f;
|
||||
}
|
||||
|
||||
/* ---------- 表单分区 ---------- */
|
||||
.sec {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.sec:last-of-type {
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
.sec-head {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-bottom: 14px;
|
||||
}
|
||||
.sec-badge {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
border-radius: 7px;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 12px;
|
||||
font-weight: 700;
|
||||
color: var(--el-color-primary);
|
||||
background: var(--el-color-primary-light-9);
|
||||
border: 1px solid var(--el-color-primary-light-7);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.sec-name {
|
||||
font-size: 14px;
|
||||
font-weight: 600;
|
||||
color: var(--el-text-color-primary);
|
||||
white-space: nowrap;
|
||||
}
|
||||
.sec-line {
|
||||
flex: 1;
|
||||
height: 1px;
|
||||
background: linear-gradient(90deg, var(--el-border-color-lighter), transparent);
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: flex;
|
||||
gap: 18px;
|
||||
flex-wrap: wrap;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||
gap: 0 18px;
|
||||
}
|
||||
|
||||
.grid .el-form-item {
|
||||
flex: 1;
|
||||
min-width: 280px;
|
||||
.grid :deep(.el-form-item) {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.grid :deep(.el-form-item__label) {
|
||||
padding-bottom: 6px;
|
||||
font-weight: 500;
|
||||
}
|
||||
.grid :deep(.el-date-editor) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.wide {
|
||||
width: 100%;
|
||||
}
|
||||
@@ -250,37 +397,92 @@ const {
|
||||
.tip {
|
||||
width: 100%;
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
color: var(--el-text-color-secondary);
|
||||
line-height: 1.6;
|
||||
margin-top: 2px;
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
/* ---------- 操作区 ---------- */
|
||||
.actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
border-top: 1px dashed var(--el-border-color);
|
||||
padding-top: 16px;
|
||||
margin-top: 6px;
|
||||
padding-top: 18px;
|
||||
margin-top: 18px;
|
||||
}
|
||||
|
||||
.status {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 10px 14px;
|
||||
border-radius: 10px;
|
||||
background: var(--el-color-primary-light-9);
|
||||
border: 1px solid var(--el-color-primary-light-7);
|
||||
}
|
||||
|
||||
.status-bar {
|
||||
.spacer {
|
||||
flex: 1;
|
||||
}
|
||||
.btn-run {
|
||||
min-width: 150px;
|
||||
border: none;
|
||||
border-radius: 10px;
|
||||
letter-spacing: 2px;
|
||||
background: linear-gradient(135deg, var(--el-color-primary), var(--el-color-primary-dark-2));
|
||||
box-shadow: 0 6px 16px var(--el-color-primary-light-6);
|
||||
transition: filter 0.2s, box-shadow 0.2s, transform 0.15s;
|
||||
}
|
||||
.btn-run:hover {
|
||||
filter: brightness(1.06);
|
||||
box-shadow: 0 8px 20px var(--el-color-primary-light-5);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
.btn-run:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
.btn-run.is-loading {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
/* ---------- 运行状态 ---------- */
|
||||
.status {
|
||||
padding: 14px 16px;
|
||||
border-radius: 12px;
|
||||
background: linear-gradient(135deg, var(--el-color-primary-light-9), var(--el-color-primary-light-8));
|
||||
border: 1px solid var(--el-color-primary-light-6);
|
||||
box-shadow: 0 2px 10px var(--el-color-primary-light-7);
|
||||
}
|
||||
.status-bar :deep(.el-progress-bar__outer) {
|
||||
background: rgba(64, 158, 255, 0.15);
|
||||
}
|
||||
.status-bar :deep(.el-progress-bar__inner) {
|
||||
background: linear-gradient(90deg, var(--el-color-primary), var(--el-color-primary-dark-2));
|
||||
}
|
||||
.status-row {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-top: 8px;
|
||||
}
|
||||
.pulse {
|
||||
width: 8px;
|
||||
height: 8px;
|
||||
border-radius: 50%;
|
||||
background: var(--el-color-primary);
|
||||
animation: pulse 1.4s ease-out infinite;
|
||||
}
|
||||
@keyframes pulse {
|
||||
0% {
|
||||
box-shadow: 0 0 0 0 var(--el-color-primary-light-6);
|
||||
}
|
||||
70% {
|
||||
box-shadow: 0 0 0 8px transparent;
|
||||
}
|
||||
100% {
|
||||
box-shadow: 0 0 0 0 transparent;
|
||||
}
|
||||
}
|
||||
.status-txt {
|
||||
font-size: 12px;
|
||||
color: #606266;
|
||||
white-space: nowrap;
|
||||
flex: 1;
|
||||
font-size: 12.5px;
|
||||
color: var(--el-text-color-regular);
|
||||
line-height: 1.5;
|
||||
}
|
||||
.status-pct {
|
||||
font-size: 14px;
|
||||
font-weight: 700;
|
||||
color: var(--el-color-primary);
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
</style>
|
||||
|
||||
+17
-17
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
@@ -4,8 +4,8 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>金色印象通联数据导出</title>
|
||||
<script type="module" crossorigin src="/pui/xq0045_xq0046/assets/index-G-MPtpyg.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/pui/xq0045_xq0046/assets/index-BlDidYGJ.css">
|
||||
<script type="module" crossorigin src="/pui/xq0045_xq0046/assets/index-Bge9B6U7.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/pui/xq0045_xq0046/assets/index-qWMFdWZT.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
"""
|
||||
import os
|
||||
from datetime import date, datetime
|
||||
from typing import List, Optional, Set, Tuple
|
||||
from typing import Dict, List, Optional, Set, Tuple
|
||||
|
||||
import pandas as pd
|
||||
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+20
-20
File diff suppressed because one or more lines are too long
@@ -4,8 +4,8 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>考勤月报封存检查</title>
|
||||
<script type="module" crossorigin src="/pui/xq0011/assets/index-DROFMwiS.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/pui/xq0011/assets/index-CqpBmu33.css">
|
||||
<script type="module" crossorigin src="/pui/xq0011/assets/index-C6kdsQdY.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/pui/xq0011/assets/index-BjCl3jYx.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
@@ -4,8 +4,8 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>ERP报表导出</title>
|
||||
<script type="module" crossorigin src="/pui/xq0031_xq0032/assets/index-B7DSB6ed.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/pui/xq0031_xq0032/assets/index-C1QhPHbp.css">
|
||||
<script type="module" crossorigin src="/pui/xq0031_xq0032/assets/index-EpDPYe3Q.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/pui/xq0031_xq0032/assets/index-u2-ZnLC2.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>␍
|
||||
|
||||
@@ -52,7 +52,7 @@ def _build_tasks(mode, day_date, month_date):
|
||||
class TongLianExportPlugin(ScenePlugin):
|
||||
id = "xq0045_xq0046"
|
||||
name = "金色印象通联数据导出"
|
||||
version = "1.0.7"
|
||||
version = "1.0.9"
|
||||
description = ("通联支付交易数据自动导出:XQ0045 按日 / XQ0046 按月,"
|
||||
"账号全量数据导出(含全部商户),服务端生成文件直存本地,"
|
||||
"并按商户分组自动拆分为金色印象门店/品牌管理公司/其他账号 3 个工作簿")
|
||||
|
||||
@@ -6,10 +6,11 @@
|
||||
- print → config.log;返回 requests.Session(登录后会话直接可用,无需浏览器常驻)。
|
||||
|
||||
登录方式(接口优先,浏览器兜底):
|
||||
1) 接口登录(首选,已实测一次成功):GET /login(拿 SESSION + 页面内嵌 publicKey)
|
||||
→ GET /getvalidCode?type=cuserrorCode 验证码图 → ddddocr 识别(4位)
|
||||
1) 接口登录(首选,已实测一次成功):GET /login(拿 SESSION + 页面内嵌 publicKey +
|
||||
隐藏表单字段 token/logintype/isscanlogin)
|
||||
→ GET /getvalidCode?type=cuserrorCode 验证码图 → ddddocr 双模型交叉识别(4位)
|
||||
→ JSEncrypt 兼容 RSA 加密密码(PKCS#1 v1.5 + base64)→ POST /login(userid/
|
||||
encpassword/cuserrorCode,带 Referer)→ 302 离开 /login 即成功;
|
||||
encpassword/cuserrorCode + 表单隐藏字段,带 Referer)→ 302 离开 /login 即成功;
|
||||
2) 浏览器兜底:DrissionPage 现场登录(验证码元素截图 + ddddocr),成功后从浏览器
|
||||
cookies 构建 requests.Session。
|
||||
|
||||
@@ -37,6 +38,7 @@ _PUBKEY_RE = re.compile(r"var publicKey='([^']+)'")
|
||||
_LOGIN_FORM_RE = re.compile(r'<form[^>]*id=["\']?accountForm|action=["\']?/login')
|
||||
|
||||
_ocr = None
|
||||
_ocr_beta = None
|
||||
|
||||
|
||||
def _get_ocr():
|
||||
@@ -48,6 +50,73 @@ def _get_ocr():
|
||||
return _ocr
|
||||
|
||||
|
||||
def _get_ocr_beta():
|
||||
"""ddddocr beta 模型单例:与默认模型交叉校验,提升易混字符识别置信度。"""
|
||||
global _ocr_beta
|
||||
if _ocr_beta is None:
|
||||
import ddddocr
|
||||
_ocr_beta = ddddocr.DdddOcr(show_ad=False, beta=True)
|
||||
return _ocr_beta
|
||||
|
||||
|
||||
# 命中即终止登录(重试验证码无济于事)
|
||||
_ERR_TERMINAL = ('锁定', '次数已达上限', '密码错误', '账号或密码', '用户名不存在',
|
||||
'用户不存在', '不存在该账号', '密码已过期', '登录失败次数')
|
||||
# 风控锁定提示(出现即停止一切登录尝试,浏览器兜底也跳过,避免给锁定“续期”)
|
||||
_LOCK_HINT_RE = re.compile(r'锁定|次数已达上限|次数已达|2小时')
|
||||
|
||||
|
||||
class LoginLockedError(Exception):
|
||||
"""通联账号被风控锁定(服务端提示「次数已达上限」等)。命中后不再做任何登录尝试。"""
|
||||
|
||||
|
||||
def _extract_errormsg(text):
|
||||
"""读取服务端回显的登录错误文案(登录页内嵌 var errormsg='...')。空串=无明确提示。
|
||||
|
||||
实测:验证码错误时 errormsg 为空(页面静默重渲染);账号/密码类错误会回显
|
||||
(如“用户名不存在/密码错误”)。
|
||||
"""
|
||||
m = re.search(r"var errormsg='([^']*)'", text or '')
|
||||
return m.group(1).strip() if m and m.group(1) else ''
|
||||
|
||||
|
||||
def _parse_login_form(html):
|
||||
"""解析登录表单隐藏字段,随 POST 一并提交(与真实浏览器一致,防服务端收紧校验):
|
||||
token(CSRF 随机值,随页面下发)、logintype、isscanlogin。缺失时回退默认值。
|
||||
"""
|
||||
def _v(name, default=''):
|
||||
m = re.search(r'name="%s"\s+value="([^"]*)"' % name, html or '')
|
||||
return m.group(1) if m else default
|
||||
return {'token': _v('token'), 'logintype': _v('logintype', 'userid_login'),
|
||||
'isscanlogin': _v('isscanlogin', '0')}
|
||||
|
||||
|
||||
def _read_captcha_confident(session, max_refresh=3):
|
||||
"""获取验证码并交叉识别:默认模型与 beta 模型结果一致才采用(对 0/O、1/l/I 等
|
||||
易混字符更稳),不一致则刷新验证码重试——仅刷新不提交,不消耗服务端登录尝试次数。
|
||||
|
||||
返回 (code, agreed);多次未达成一致时回退默认模型结果(保持原行为),
|
||||
连续读不出 4 位验证码时返回 (None, False)。
|
||||
"""
|
||||
ocr, ocr_beta = _get_ocr(), _get_ocr_beta()
|
||||
last_code = ''
|
||||
for _ in range(max(1, max_refresh)):
|
||||
try:
|
||||
img = session.get(_VALIDCODE_URL, timeout=20).content
|
||||
except Exception as e:
|
||||
config.log(f"[通联登录] 获取验证码图异常:{e}")
|
||||
return None, False
|
||||
code = ocr.classification(img).strip()
|
||||
if len(code) != 4:
|
||||
continue
|
||||
last_code = code
|
||||
if ocr_beta.classification(img).strip() == code:
|
||||
return code, True
|
||||
if not last_code:
|
||||
return None, False
|
||||
return last_code, False
|
||||
|
||||
|
||||
def _human_pause(a=None, b=None):
|
||||
"""操作间随机延时,模拟人工节奏。"""
|
||||
lo, hi = HUMAN_DELAY if (a is None or b is None) else (a, b)
|
||||
@@ -71,10 +140,12 @@ def _rsa_encrypt(pubkey, pwd):
|
||||
def _api_login(username, password):
|
||||
"""接口登录(纯 requests,不弹浏览器)。成功返回 requests.Session,失败返回 None。
|
||||
|
||||
服务端行为(探针实测):
|
||||
服务端行为(探针实测复核):
|
||||
- /login 页面内嵌固定 RSA 公钥(publicKey,1024 位 PKCS#1);
|
||||
- 验证码 4 位,GET /getvalidCode?type=cuserrorCode 返回图片(session 绑定);
|
||||
- POST /login 需带 Referer(外链校验),成功 302 到 /main。
|
||||
- 表单含隐藏字段 token(CSRF)/logintype/isscanlogin,POST /login 需带 Referer
|
||||
(外链校验);验证码错误时服务端静默重渲染登录页(errormsg 为空),账号/密码
|
||||
类错误在 errormsg 回显;成功 302 离开 /login。
|
||||
"""
|
||||
session = requests.Session()
|
||||
session.headers.update({"User-Agent": _UA})
|
||||
@@ -91,28 +162,24 @@ def _api_login(username, password):
|
||||
return None
|
||||
pubkey = m.group(1)
|
||||
enc = _rsa_encrypt(pubkey, password)
|
||||
form_extra = _parse_login_form(html)
|
||||
except Exception as e:
|
||||
config.log(f"[通联登录] 接口登录准备异常:{e}")
|
||||
return None
|
||||
|
||||
ocr = _get_ocr()
|
||||
for attempt in range(config.API_CAPTCHA_RETRY):
|
||||
try:
|
||||
img = session.get(_VALIDCODE_URL, timeout=20).content
|
||||
except Exception as e:
|
||||
config.log(f"[通联登录] 获取验证码图异常:{e}")
|
||||
code, agreed = _read_captcha_confident(session)
|
||||
if not code:
|
||||
config.log("[通联登录] 连续未能识别出 4 位验证码,停止接口登录")
|
||||
return None
|
||||
code = ocr.classification(img).strip()
|
||||
config.log(f"[通联登录] 接口登录 第 {attempt + 1}/{config.API_CAPTCHA_RETRY} 次验证码识别:{code!r}")
|
||||
if len(code) != 4:
|
||||
time.sleep(1)
|
||||
continue
|
||||
agree_note = "" if agreed else "(双模型未一致,按默认模型提交)"
|
||||
config.log(f"[通联登录] 接口登录 第 {attempt + 1}/{config.API_CAPTCHA_RETRY} 次验证码识别:{code!r}{agree_note}")
|
||||
data = {'userid': username, 'encpassword': enc, 'cuserrorCode': code}
|
||||
data.update({k: v for k, v in form_extra.items() if v})
|
||||
try:
|
||||
resp = session.post(config.LOGIN_URL, data={
|
||||
'userid': username,
|
||||
'encpassword': enc,
|
||||
'cuserrorCode': code,
|
||||
}, headers={'Referer': config.LOGIN_URL}, timeout=20, allow_redirects=True)
|
||||
resp = session.post(config.LOGIN_URL, data=data,
|
||||
headers={'Referer': config.LOGIN_URL},
|
||||
timeout=20, allow_redirects=True)
|
||||
except Exception as e:
|
||||
config.log(f"[通联登录] 提交登录异常:{e}")
|
||||
return None
|
||||
@@ -121,11 +188,13 @@ def _api_login(username, password):
|
||||
return session
|
||||
# 仍在登录页:验证码错/账号密码错/风控。每次提交都计入服务端尝试次数,
|
||||
# 失败后退避并停止(不连续重试,避免触发登录次数风控锁定)
|
||||
hit = re.search(r'验证码错误|验证码不正确|账号或密码|密码错误|登录失败|次数已达上限|锁定', resp.text)
|
||||
if hit:
|
||||
config.log(f"[通联登录] 服务端提示:{hit.group(0)}")
|
||||
if '次数已达上限' in hit.group(0) or '锁定' in hit.group(0):
|
||||
errormsg = _extract_errormsg(resp.text)
|
||||
if errormsg:
|
||||
config.log(f"[通联登录] 服务端提示:{errormsg}")
|
||||
if '锁定' in errormsg or '次数' in errormsg:
|
||||
config.log("[通联登录] 检测到风控锁定提示,立即停止登录尝试")
|
||||
raise LoginLockedError(errormsg)
|
||||
if any(k in errormsg for k in _ERR_TERMINAL):
|
||||
return None
|
||||
time.sleep(config.LOGIN_FAIL_BACKOFF)
|
||||
config.log("[通联登录] 接口登录验证码多次未通过,停止重试")
|
||||
@@ -173,10 +242,8 @@ def _read_img_bytes(img):
|
||||
|
||||
|
||||
def _recognize_captcha(img_bytes):
|
||||
"""ddddocr 识别图形验证码,返回文本。懒加载避免无关场景导入开销。"""
|
||||
import ddddocr
|
||||
ocr = ddddocr.DdddOcr(show_ad=False)
|
||||
return ocr.classification(img_bytes).strip()
|
||||
"""ddddocr 识别图形验证码,返回文本。复用全局单例,避免重复加载模型。"""
|
||||
return _get_ocr().classification(img_bytes).strip()
|
||||
|
||||
|
||||
def _refresh_captcha(page, img):
|
||||
@@ -214,7 +281,11 @@ def _ensure_account_tab(page):
|
||||
|
||||
|
||||
def _wait_login_result(page):
|
||||
"""提交后轮询判定登录结果,返回 bool。"""
|
||||
"""提交后轮询判定登录结果。
|
||||
|
||||
返回:True=登录成功;str=失败提示文案;''=超时未判定。
|
||||
调用方据此可区分「验证码/账号错」与「风控锁定」。
|
||||
"""
|
||||
for _ in range(30): # 最多等 15 秒
|
||||
time.sleep(0.5)
|
||||
if _on_target(page):
|
||||
@@ -232,8 +303,8 @@ def _wait_login_result(page):
|
||||
text = ''
|
||||
if text:
|
||||
config.log(f"[通联登录] 失败提示:{text}")
|
||||
return False
|
||||
return False
|
||||
return text
|
||||
return ''
|
||||
|
||||
|
||||
def _input_value(ele):
|
||||
@@ -314,8 +385,12 @@ def _try_login_once(page, username, password):
|
||||
_human_pause(0.2, 0.6)
|
||||
btn.click()
|
||||
|
||||
if _wait_login_result(page):
|
||||
result = _wait_login_result(page)
|
||||
if result is True:
|
||||
return True
|
||||
if result and _LOCK_HINT_RE.search(result):
|
||||
config.log("[通联登录] 检测到风控锁定提示,停止浏览器登录")
|
||||
return False
|
||||
_refresh_captcha(page, img)
|
||||
return False
|
||||
|
||||
@@ -405,7 +480,12 @@ def tl_login(username, password):
|
||||
下次运行直接复用免登录(探活失败才重新登录)。
|
||||
"""
|
||||
username = (username or '').strip()
|
||||
password = password or ''
|
||||
raw_password = password or ''
|
||||
# 清洗密码首尾空白(含全角空格等):配置被误存前导空格时,直接拿原值登录必被
|
||||
# 服务端判“账户名或登录密码不正确”,累计触发风控锁定。密码内部空格保留。
|
||||
password = raw_password.strip()
|
||||
if password != raw_password:
|
||||
config.log("[通联登录] 已清洗密码首尾空白字符(如真实密码首尾确有空格,请到插件界面更正后重试)")
|
||||
if not (username and password):
|
||||
config.log("[通联登录] 账号/密码缺失(请在插件界面填写并保存配置)")
|
||||
return None
|
||||
@@ -420,7 +500,13 @@ def tl_login(username, password):
|
||||
# 2) 接口登录(首选,不弹浏览器)
|
||||
config.log("[通联登录] 本地会话失效,开始重新登录(单点登录:本次登录会顶掉其它")
|
||||
config.log("[通联登录] 设备/浏览器上的同一账号登录)")
|
||||
session = _api_login(username, password)
|
||||
try:
|
||||
session = _api_login(username, password)
|
||||
except LoginLockedError as e:
|
||||
# 账号已被风控锁定:浏览器兜底同样会被拒,且每次提交都会给锁定“续期”,
|
||||
# 直接停止,等锁定解除后再跑(服务端一般提示 2 小时后恢复)。
|
||||
config.log(f"[通联登录] 账号已被风控锁定({e}),跳过浏览器登录,请稍后再试")
|
||||
return None
|
||||
if session is not None:
|
||||
save_session(username, session)
|
||||
return session
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"schema_version": 1,
|
||||
"id": "xq0045_xq0046",
|
||||
"name": "金色印象通联数据导出",
|
||||
"version": "1.0.7",
|
||||
"version": "1.0.9",
|
||||
"description": "通联支付商户服务平台(cus.allinpay.com)交易数据自动导出:XQ0045 按日、XQ0046 按月,账号全量数据导出(含全部商户),服务端生成文件直存本地,并按商户分组自动拆分为金色印象门店/品牌管理公司/其他账号 3 个工作簿",
|
||||
"category": "报表",
|
||||
"icon": "",
|
||||
|
||||
File diff suppressed because one or more lines are too long
+17
-17
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
@@ -4,8 +4,8 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>金色印象通联数据导出</title>
|
||||
<script type="module" crossorigin src="/pui/xq0045_xq0046/assets/index-G-MPtpyg.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/pui/xq0045_xq0046/assets/index-BlDidYGJ.css">
|
||||
<script type="module" crossorigin src="/pui/xq0045_xq0046/assets/index-Bge9B6U7.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/pui/xq0045_xq0046/assets/index-qWMFdWZT.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
Reference in New Issue
Block a user