diff --git a/build_exe.bat b/build_exe.bat
index 8c1daeb..45f08b0 100644
--- a/build_exe.bat
+++ b/build_exe.bat
@@ -7,7 +7,7 @@ REM 每次升级改 APP_VERSION,避免与正在运行的旧版本目录冲突
REM 使用:把整个文件夹拷到目标机器(或压缩成 zip 发送),
REM 双击文件夹里的 Boss直聘AI投递-%APP_VERSION%.exe 运行。
REM ============================================================
-set APP_VERSION=1.3
+set APP_VERSION=1.4
echo [1/2] 安装打包依赖...
pip install pyinstaller PySide6 --quiet
diff --git a/client/debug_expect_class.py b/client/debug_expect_class.py
new file mode 100644
index 0000000..bee4b1a
--- /dev/null
+++ b/client/debug_expect_class.py
@@ -0,0 +1,34 @@
+"""排查:期望项 .expect-item 的 class 结构(含选中态标记)"""
+import json
+import time
+from pathlib import Path
+
+from client.browser.cdp_lite import LiteCDP, CDPSession
+from client.browser.manager import BrowserManager
+
+OUT = Path(__file__).resolve().parent / "data" / "debug" / "期望项结构.txt"
+
+_JS = """JSON.stringify([...document.querySelectorAll('.expect-item')].map(e => ({
+ cls: String(e.className),
+ text: (e.innerText || '').trim().slice(0, 50),
+ html: e.outerHTML.replace(/\\s+/g, ' ').slice(0, 300),
+})))"""
+
+
+def main():
+ BrowserManager().ensure_browser_started()
+ lite = LiteCDP()
+ tab = lite.open_tab("https://www.zhipin.com/web/geek/jobs")
+ time.sleep(8)
+ s = CDPSession(tab["webSocketDebuggerUrl"])
+ raw = s.eval_js(_JS)
+ items = json.loads(raw or "[]")
+ lines = [json.dumps(it, ensure_ascii=False) for it in items]
+ OUT.write_text("\n".join(lines) or "(未找到 .expect-item)", encoding="utf-8")
+ s.close()
+ lite.close_tab(tab["id"])
+ print("完成 ->", OUT)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/client/debug_expect_locate.py b/client/debug_expect_locate.py
new file mode 100644
index 0000000..5d485c3
--- /dev/null
+++ b/client/debug_expect_locate.py
@@ -0,0 +1,28 @@
+"""验证:_select_expect_js 新版返回结构(坐标/落点元素/全量项/视口)"""
+import json
+import time
+from pathlib import Path
+
+from client.browser.applicant import _select_expect_js
+from client.browser.cdp_lite import LiteCDP, CDPSession
+from client.browser.manager import BrowserManager
+
+OUT = Path(__file__).resolve().parent / "data" / "debug" / "期望定位验证.txt"
+
+
+def main():
+ BrowserManager().ensure_browser_started()
+ lite = LiteCDP()
+ tab = lite.open_tab("https://www.zhipin.com/web/geek/jobs")
+ time.sleep(8)
+ s = CDPSession(tab["webSocketDebuggerUrl"])
+ raw = s.eval_js(_select_expect_js("Java", "天津"))
+ OUT.write_text(json.dumps(json.loads(raw or "{}"),
+ ensure_ascii=False, indent=2), encoding="utf-8")
+ s.close()
+ lite.close_tab(tab["id"])
+ print("完成 ->", OUT)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/client/server_api.py b/client/server_api.py
index 671a376..6929c4f 100644
--- a/client/server_api.py
+++ b/client/server_api.py
@@ -247,11 +247,21 @@ class ServerAPI:
return resp.json().get("applied", False)
def list_blacklist(self) -> list[str]:
- """公司黑名单名单(公司名列表,拉黑后不再投递该公司)"""
- resp = self._req("get", f"{self.base_url}/api/blacklist",
- headers=self._headers(), timeout=15)
- resp.raise_for_status()
- return [i["company"] for i in resp.json()]
+ """公司黑名单名单(公司名列表,拉黑后不再投递该公司)。
+ 接口分页返回,这里翻页拉全(黑名单用于投递前过滤,必须拿到全量)"""
+ companies: list[str] = []
+ page = 1
+ while True:
+ resp = self._req("get", f"{self.base_url}/api/blacklist",
+ params={"page": page, "page_size": 100},
+ headers=self._headers(), timeout=15)
+ resp.raise_for_status()
+ data = resp.json()
+ companies.extend(i["company"] for i in data.get("items", []))
+ if page >= data.get("pages", 1) or page >= 10:
+ break
+ page += 1
+ return companies
def get_stats(self) -> dict:
resp = self._req("get", f"{self.base_url}/api/jobs/stats", headers=self._headers(), timeout=15)
@@ -275,6 +285,22 @@ class ServerAPI:
resp.raise_for_status()
return resp.json()
+ def get_history_page(self, page: int = 1, page_size: int = 20,
+ apply_type: str | None = None,
+ start: str | None = None, end: str | None = None) -> dict:
+ """投递记录分页筛选(北京时间范围 + 投递结果,时间倒序)"""
+ params: dict = {"page": page, "page_size": page_size}
+ if apply_type:
+ params["apply_type"] = apply_type
+ if start:
+ params["start"] = start
+ if end:
+ params["end"] = end
+ resp = self._req("get", f"{self.base_url}/api/jobs/page",
+ params=params, headers=self._headers(), timeout=15)
+ resp.raise_for_status()
+ return resp.json()
+
# ------------------------------------------------------------------
# 连通性
# ------------------------------------------------------------------
diff --git a/client/web/app.py b/client/web/app.py
index 42f16c4..0b457f7 100644
--- a/client/web/app.py
+++ b/client/web/app.py
@@ -428,6 +428,19 @@ def history(limit: int = 50, apply_type: str | None = None):
return state.server_api.get_history(limit=limit, apply_type=apply_type)
+@app.get("/api/history-page")
+def history_page(page: int = 1, page_size: int = 20,
+ apply_type: str | None = None,
+ start: str | None = None, end: str | None = None):
+ """投递记录分页筛选(时间范围 + 投递结果,时间倒序)"""
+ if not state.connected:
+ return {"items": [], "total": 0, "applied": 0, "skipped": 0,
+ "page": page, "page_size": page_size, "pages": 0}
+ return state.server_api.get_history_page(
+ page=page, page_size=page_size, apply_type=apply_type,
+ start=start, end=end)
+
+
@app.get("/api/stats")
def stats():
if not state.connected:
diff --git a/client/web/static/app.js b/client/web/static/app.js
index 4ee3e7e..97c542f 100644
--- a/client/web/static/app.js
+++ b/client/web/static/app.js
@@ -425,21 +425,42 @@ function startApplyPoll() {
}
// ==========================================================
-// Step 5: 历史与统计
+// Step 5: 历史与统计(筛选 + 分页)
// ==========================================================
+const histState = { range: 'today', start: '', end: '', type: '', page: 1, pageSize: 20 };
+
+function fmtDate(d) {
+ return d.getFullYear() + '-' + String(d.getMonth() + 1).padStart(2, '0')
+ + '-' + String(d.getDate()).padStart(2, '0');
+}
+function histRangeDates() {
+ const now = new Date(), today = fmtDate(now);
+ if (histState.range === 'today') return [today, today];
+ if (histState.range === 'week') {
+ const d = new Date(now); d.setDate(d.getDate() - ((d.getDay() + 6) % 7)); // 周一
+ return [fmtDate(d), today];
+ }
+ if (histState.range === 'month') {
+ return [fmtDate(new Date(now.getFullYear(), now.getMonth(), 1)), today];
+ }
+ return [histState.start, histState.end]; // 自定义
+}
+
async function loadHistory() {
try {
- const [stats, history] = await Promise.all([
- api('/api/stats'),
- api('/api/history?limit=50'),
- ]);
+ const [start, end] = histRangeDates();
+ if (histState.range === 'custom' && (!start || !end)) return;
+ const params = new URLSearchParams({ page: histState.page, page_size: histState.pageSize });
+ if (start) params.set('start', start);
+ if (end) params.set('end', end);
+ if (histState.type) params.set('apply_type', histState.type);
+ const d = await api('/api/history-page?' + params);
$('statsGrid').innerHTML = `
-
${stats.total_applied || 0}
累计投递
- ${stats.total_chat || 0}
立即沟通
- ${stats.total_deliver || 0}
投递简历
- ${stats.today_applied || 0}
今日投递
+ ${d.applied || 0}
已投递(筛选范围)
+ ${d.skipped || 0}
已跳过(筛选范围)
+ ${d.total || 0}
处理总数(筛选范围)
`;
- $('historyBody').innerHTML = history.map(h => `
+ $('historyBody').innerHTML = (d.items || []).map(h => `
| ${escapeHtml(h.job_title || '-')} |
${escapeHtml(h.company || '-')} |
@@ -448,7 +469,10 @@ async function loadHistory() {
${h.ai_score >= 0 ? h.ai_score : '-'} |
${formatTime(h.applied_at)} |
- `).join('') || '| 暂无记录 |
';
+ `).join('') || '| 该筛选条件下暂无记录 |
';
+ $('histPageInfo').textContent = `共 ${d.total} 条 · 第 ${d.page} / ${Math.max(d.pages, 1)} 页`;
+ $('btnHistPrev').disabled = d.page <= 1;
+ $('btnHistNext').disabled = d.page >= d.pages;
} catch (e) { console.error(e); }
}
@@ -478,6 +502,37 @@ function escapeHtml(s) {
}[c]));
}
+// ---------- 记录筛选/分页事件 ----------
+document.querySelectorAll('[data-hrange]').forEach(el => el.addEventListener('click', () => {
+ document.querySelectorAll('[data-hrange]').forEach(c => c.classList.toggle('active', c === el));
+ histState.range = el.dataset.hrange;
+ $('histCustomRange').classList.toggle('hidden', histState.range !== 'custom');
+ if (histState.range !== 'custom') { histState.page = 1; loadHistory(); }
+}));
+$('btnHistQuery').onclick = () => {
+ histState.start = $('histDateStart').value;
+ histState.end = $('histDateEnd').value;
+ if (!histState.start || !histState.end) { toast('请选择起止日期'); return; }
+ if (histState.start > histState.end) { toast('起始日期不能晚于结束日期'); return; }
+ histState.page = 1; loadHistory();
+};
+document.querySelectorAll('[data-htype]').forEach(el => el.addEventListener('click', () => {
+ document.querySelectorAll('[data-htype]').forEach(c => c.classList.toggle('active', c === el));
+ histState.type = el.dataset.htype;
+ histState.page = 1; loadHistory();
+}));
+$('histPageSize').onchange = e => {
+ histState.pageSize = parseInt(e.target.value, 10);
+ histState.page = 1; loadHistory();
+};
+$('btnHistPrev').onclick = () => { if (histState.page > 1) { histState.page--; loadHistory(); } };
+$('btnHistNext').onclick = () => { histState.page++; loadHistory(); };
+
// ---------- 启动 ----------
+{ // 自定义日期默认填入今天
+ const today = fmtDate(new Date());
+ $('histDateStart').value = today;
+ $('histDateEnd').value = today;
+}
refreshStatus();
setInterval(refreshStatus, 8000);
diff --git a/client/web/static/style.css b/client/web/static/style.css
index 7d6228d..af19a03 100644
--- a/client/web/static/style.css
+++ b/client/web/static/style.css
@@ -314,6 +314,24 @@ body {
.tag.deliver { background: #dbeafe; color: var(--primary); }
.tag.skipped { background: #f3f4f6; color: var(--text-light); }
+/* ===== 记录筛选栏与分页 ===== */
+.filters-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 12px; font-size: 13px; }
+.filters-bar .grp { display: flex; align-items: center; gap: 6px; }
+.filters-bar .grp > label { color: var(--text-light); }
+.chip {
+ padding: 4px 12px; border: 1px solid var(--border); border-radius: 14px;
+ cursor: pointer; color: var(--text-light); background: #fff; font-size: 12px;
+}
+.chip:hover { border-color: var(--primary); color: var(--primary); }
+.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
+.filters-bar input[type=date] { padding: 3px 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; }
+.filters-bar select { padding: 3px 6px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; }
+.btn-query { padding: 4px 14px; background: var(--primary); border: none; color: #fff; border-radius: 6px; cursor: pointer; font-size: 12px; }
+.pager-bar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 12px; font-size: 13px; color: var(--text-light); }
+.pager-bar button { padding: 4px 12px; border: 1px solid var(--border); background: #fff; border-radius: 6px; cursor: pointer; font-size: 12px; }
+.pager-bar button:hover:not(:disabled) { border-color: var(--primary); color: var(--primary); }
+.pager-bar button:disabled { color: #ccc; cursor: not-allowed; }
+
/* ===== Toast ===== */
.toast {
position: fixed;
diff --git a/client/web/templates/index.html b/client/web/templates/index.html
index 766f408..8ef2b26 100644
--- a/client/web/templates/index.html
+++ b/client/web/templates/index.html
@@ -145,6 +145,34 @@
投递记录与统计
将鼠标悬停在职位名上,可查看归档的 JD 摘要与跳过原因。
+
+
+
+ 今日
+ 本周
+ 本月
+ 自定义
+
+ ~
+
+
+
+
+
+ 全部
+ 已沟通
+ 已投递
+ 已跳过
+
+
+
+
+
+
+
diff --git a/server/routers/blacklist.py b/server/routers/blacklist.py
index b7d0b21..6c09293 100644
--- a/server/routers/blacklist.py
+++ b/server/routers/blacklist.py
@@ -1,7 +1,9 @@
"""
公司黑名单路由:拉黑后 RPA 不再投递该公司的任何职位
"""
-from fastapi import APIRouter, Depends, HTTPException
+from datetime import timedelta
+
+from fastapi import APIRouter, Depends, HTTPException, Query
from sqlalchemy.orm import Session
from ..auth import get_current_user
@@ -12,15 +14,30 @@ from ..schemas import BlacklistIn, BlacklistOut, Message
router = APIRouter(prefix="/api/blacklist", tags=["公司黑名单"])
-@router.get("", response_model=list[BlacklistOut])
+@router.get("", response_model=dict)
def list_blacklist(
+ page: int = Query(1, ge=1, description="页码(1 起)"),
+ page_size: int = Query(20, ge=1, le=500, description="每页条数"),
current_user: User = Depends(get_current_user),
db: Session = Depends(get_db),
):
- """查询当前用户的黑名单列表(按拉黑时间倒序)"""
- return db.query(CompanyBlacklist).filter(
+ """查询当前用户的黑名单列表(按拉黑时间倒序,分页返回)"""
+ query = db.query(CompanyBlacklist).filter(
CompanyBlacklist.user_id == current_user.id,
- ).order_by(CompanyBlacklist.created_at.desc()).all()
+ )
+ total = query.count()
+ rows = query.order_by(CompanyBlacklist.created_at.desc()) \
+ .offset((page - 1) * page_size).limit(page_size).all()
+ items = [{
+ "id": r.id,
+ "company": r.company,
+ "created_at": (r.created_at + timedelta(hours=8)).strftime("%Y-%m-%d %H:%M:%S"),
+ } for r in rows]
+ return {
+ "items": items, "total": total,
+ "page": page, "page_size": page_size,
+ "pages": (total + page_size - 1) // page_size if page_size else 1,
+ }
@router.post("", response_model=BlacklistOut)
diff --git a/server/routers/jobs.py b/server/routers/jobs.py
index 09d8361..6db47f4 100644
--- a/server/routers/jobs.py
+++ b/server/routers/jobs.py
@@ -146,6 +146,61 @@ def list_applications(
return query.order_by(JobApplication.applied_at.desc()).limit(limit).all()
+@router.get("/page", response_model=dict)
+def page_applications(
+ page: int = Query(1, ge=1, description="页码(1 起)"),
+ page_size: int = Query(20, ge=1, le=100, description="每页条数"),
+ apply_type: Optional[str] = Query(None, description="投递结果:chat/deliver/skipped"),
+ start: Optional[str] = Query(None, description="起始日期(北京时间,YYYY-MM-DD,含)"),
+ end: Optional[str] = Query(None, description="结束日期(北京时间,YYYY-MM-DD,含)"),
+ current_user: User = Depends(get_current_user),
+ db: Session = Depends(get_db),
+):
+ """投递记录分页筛选(北京时间范围 + 投递结果),时间倒序"""
+ query = db.query(JobApplication).filter(JobApplication.user_id == current_user.id)
+
+ # 北京时间日期区间 → UTC 区间(北京 00:00 == UTC 前一日 16:00)
+ try:
+ if start:
+ d = datetime.strptime(start, "%Y-%m-%d")
+ query = query.filter(JobApplication.applied_at >= d - timedelta(hours=8))
+ if end:
+ d = datetime.strptime(end, "%Y-%m-%d") + timedelta(days=1)
+ query = query.filter(JobApplication.applied_at < d - timedelta(hours=8))
+ except ValueError:
+ raise HTTPException(status_code=422, detail="日期格式应为 YYYY-MM-DD")
+
+ if apply_type:
+ query = query.filter(JobApplication.apply_type == apply_type)
+
+ # 筛选范围内统计(不受分页影响)
+ total = query.count()
+ applied = query.filter(JobApplication.apply_type.in_(["chat", "deliver"])).count()
+ skipped = query.filter(JobApplication.apply_type == "skipped").count()
+
+ rows = query.order_by(JobApplication.applied_at.desc()) \
+ .offset((page - 1) * page_size).limit(page_size).all()
+ items = [{
+ "job_title": r.job_title,
+ "company": r.company,
+ "salary": r.salary,
+ "location": r.location,
+ "apply_type": r.apply_type,
+ "ai_score": r.ai_score,
+ "ai_reason": r.ai_reason,
+ "skip_reason": r.skip_reason,
+ "greeting": r.greeting,
+ # JD 全文截断,供客户端悬停摘要展示,控制分页响应体积
+ "jd_text": (r.jd_text or "")[:500],
+ "applied_at": (r.applied_at + timedelta(hours=8)).strftime("%Y-%m-%d %H:%M:%S"),
+ } for r in rows]
+ return {
+ "items": items, "total": total, "applied": applied, "skipped": skipped,
+ "page": page, "page_size": page_size,
+ "pages": (total + page_size - 1) // page_size if page_size else 1,
+ }
+
+
@router.get("/stats", response_model=StatsOut)
def get_stats(
current_user: User = Depends(get_current_user),
diff --git a/server/static/view.html b/server/static/view.html
index 48c1500..0c791e3 100644
--- a/server/static/view.html
+++ b/server/static/view.html
@@ -33,8 +33,19 @@
aside .menu-item.active { background: #e8f4ff; color: #1890ff; border-left-color: #1890ff; font-weight: 600; }
.content { flex: 1; min-width: 0; }
- /* 今日数据 */
- .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
+ /* 筛选栏 */
+ .filters { background: #fff; border-radius: 10px; padding: 14px 18px; box-shadow: 0 2px 8px rgba(0,0,0,.05); margin-bottom: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; font-size: 13px; }
+ .filters .grp { display: flex; align-items: center; gap: 8px; }
+ .filters .grp > label.t { color: #888; }
+ .chip { padding: 5px 14px; border: 1px solid #d9d9d9; border-radius: 16px; cursor: pointer; color: #555; background: #fff; font-size: 13px; }
+ .chip:hover { border-color: #1890ff; color: #1890ff; }
+ .chip.active { background: #1890ff; border-color: #1890ff; color: #fff; }
+ .filters input[type=date] { padding: 4px 8px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 13px; }
+ .filters .btn-query { padding: 5px 16px; background: #1890ff; border: none; color: #fff; border-radius: 6px; cursor: pointer; font-size: 13px; }
+ .filters select { padding: 4px 8px; border: 1px solid #d9d9d9; border-radius: 6px; font-size: 13px; }
+
+ /* 统计卡 */
+ .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.stat-card { background: #fff; border-radius: 10px; padding: 18px 22px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.stat-card .num { font-size: 30px; font-weight: 700; }
.stat-card .label { font-size: 13px; color: #888; margin-top: 4px; }
@@ -49,7 +60,13 @@
.badge.skipped { background: #fff7e6; color: #faad14; border: 1px solid #ffd591; }
.score-high { color: #52c41a; font-weight: 700; } .score-mid { color: #faad14; font-weight: 700; } .score-low { color: #e64340; font-weight: 700; }
.remark { color: #999; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
- .empty { text-align: center; padding: 40px; color: #999; }
+ .empty { text-align: center; padding: 40px; color: #999; background: #fff; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,.05); }
+
+ /* 分页 */
+ .pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 14px; font-size: 13px; color: #666; }
+ .pager button { padding: 5px 14px; border: 1px solid #d9d9d9; background: #fff; border-radius: 6px; cursor: pointer; font-size: 13px; }
+ .pager button:hover:not(:disabled) { border-color: #1890ff; color: #1890ff; }
+ .pager button:disabled { color: #ccc; cursor: not-allowed; }
/* 快捷拉黑按钮 */
.bl-btn { border: 1px solid #ffd6d6; background: #fff; color: #e64340; border-radius: 4px; font-size: 12px; padding: 1px 8px; cursor: pointer; margin-left: 6px; }
@@ -92,26 +109,62 @@
-
-
-
-
-
-
+
+
+
+
+
+ 今日
+ 本周
+ 本月
+ 自定义
+
+ ~
+
+
+
+
+
+ 全部
+ 已沟通
+ 已投递
+ 已跳过
+
+
+
+
+
+
+
+
-
今天还没有投递记录
+
该筛选条件下没有投递记录
+
+
@@ -120,12 +173,18 @@
-
拉黑后,投递任务将自动跳过该公司的所有职位;在「今日投递数据」的公司列也可快捷拉黑。
+
拉黑后,投递任务将自动跳过该公司的所有职位;在「投递数据」的公司列也可快捷拉黑。
黑名单为空
+
+
@@ -134,7 +193,11 @@