兜底
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@ REM 每次升级改 APP_VERSION,避免与正在运行的旧版本目录冲突
|
|||||||
REM 使用:把整个文件夹拷到目标机器(或压缩成 zip 发送),
|
REM 使用:把整个文件夹拷到目标机器(或压缩成 zip 发送),
|
||||||
REM 双击文件夹里的 Boss直聘AI投递-%APP_VERSION%.exe 运行。
|
REM 双击文件夹里的 Boss直聘AI投递-%APP_VERSION%.exe 运行。
|
||||||
REM ============================================================
|
REM ============================================================
|
||||||
set APP_VERSION=1.6
|
set APP_VERSION=1.7
|
||||||
|
|
||||||
echo [1/2] 安装打包依赖...
|
echo [1/2] 安装打包依赖...
|
||||||
pip install pyinstaller PySide6 --quiet
|
pip install pyinstaller PySide6 --quiet
|
||||||
|
|||||||
@@ -28,22 +28,6 @@ from ..server_api import ServerAPI
|
|||||||
# 职位列表页(注意是 jobs 复数)
|
# 职位列表页(注意是 jobs 复数)
|
||||||
JOBS_PAGE = "https://www.zhipin.com/web/geek/jobs"
|
JOBS_PAGE = "https://www.zhipin.com/web/geek/jobs"
|
||||||
|
|
||||||
# 常见城市编码 → 名称(用于在期望条件栏匹配目标城市)
|
|
||||||
CITY_NAMES = {
|
|
||||||
"101010100": "北京", "101020100": "上海", "101280100": "广州",
|
|
||||||
"101280600": "深圳", "101190100": "杭州", "101030100": "天津",
|
|
||||||
"101200100": "武汉", "101110100": "西安", "101270100": "成都",
|
|
||||||
"101040100": "重庆", "101190400": "苏州", "101200200": "南京",
|
|
||||||
"101210100": "合肥", "101180100": "郑州", "101230100": "福州",
|
|
||||||
"101240100": "南昌", "101250100": "济南", "101260100": "贵阳",
|
|
||||||
"101290100": "昆明", "101300100": "兰州", "101050100": "哈尔滨",
|
|
||||||
"101060100": "长春", "101070100": "沈阳", "101080100": "呼和浩特",
|
|
||||||
"101090100": "石家庄", "101100100": "太原", "101120100": "青岛",
|
|
||||||
"101190500": "宁波", "101280300": "佛山", "101280200": "珠海",
|
|
||||||
"101120200": "大连", "101210200": "厦门", "101180200": "开封",
|
|
||||||
"101200300": "无锡", "101190200": "温州", "101270200": "绵阳",
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class JobCard:
|
class JobCard:
|
||||||
@@ -189,7 +173,7 @@ class Applicant:
|
|||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
# 启停控制
|
# 启停控制
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
def start(self, keywords: list[str], city_code: str,
|
def start(self, keywords: list[str], city: str,
|
||||||
salary_min: int | None, salary_max: int | None,
|
salary_min: int | None, salary_max: int | None,
|
||||||
min_score: int, delay_range: tuple[int, int],
|
min_score: int, delay_range: tuple[int, int],
|
||||||
boss_online_only: bool = False, daily_limit: int = 0,
|
boss_online_only: bool = False, daily_limit: int = 0,
|
||||||
@@ -199,7 +183,7 @@ class Applicant:
|
|||||||
return
|
return
|
||||||
|
|
||||||
session = self.server.start_session(
|
session = self.server.start_session(
|
||||||
keywords=",".join(keywords), city_code=city_code,
|
keywords=",".join(keywords), city=city,
|
||||||
salary_min=salary_min, salary_max=salary_max,
|
salary_min=salary_min, salary_max=salary_max,
|
||||||
)
|
)
|
||||||
self.session_id = session["id"]
|
self.session_id = session["id"]
|
||||||
@@ -217,7 +201,7 @@ class Applicant:
|
|||||||
|
|
||||||
self._thread = threading.Thread(
|
self._thread = threading.Thread(
|
||||||
target=self._run,
|
target=self._run,
|
||||||
args=(keywords, city_code, salary_min, salary_max,
|
args=(keywords, city, salary_min, salary_max,
|
||||||
min_score, delay_range),
|
min_score, delay_range),
|
||||||
daemon=True,
|
daemon=True,
|
||||||
)
|
)
|
||||||
@@ -252,7 +236,7 @@ class Applicant:
|
|||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
# 主循环
|
# 主循环
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
def _run(self, keywords, city_code, salary_min, salary_max,
|
def _run(self, keywords, city, salary_min, salary_max,
|
||||||
min_score, delay_range):
|
min_score, delay_range):
|
||||||
try:
|
try:
|
||||||
self.manager.ensure_browser_started()
|
self.manager.ensure_browser_started()
|
||||||
@@ -283,7 +267,7 @@ class Applicant:
|
|||||||
logger.warning(f"获取公司黑名单失败,黑名单过滤跳过:{e}")
|
logger.warning(f"获取公司黑名单失败,黑名单过滤跳过:{e}")
|
||||||
self._blacklist = set()
|
self._blacklist = set()
|
||||||
|
|
||||||
city_name = CITY_NAMES.get(str(city_code), "")
|
city_name = str(city or "").strip()
|
||||||
for keyword in keywords:
|
for keyword in keywords:
|
||||||
if self._should_stop():
|
if self._should_stop():
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -210,13 +210,13 @@ class ServerAPI:
|
|||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
# 投递会话
|
# 投递会话
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
def start_session(self, keywords: str, city_code: str,
|
def start_session(self, keywords: str, city: str,
|
||||||
salary_min: int | None, salary_max: int | None) -> dict:
|
salary_min: int | None, salary_max: int | None) -> dict:
|
||||||
resp = self._req("post",
|
resp = self._req("post",
|
||||||
f"{self.base_url}/api/sessions/start",
|
f"{self.base_url}/api/sessions/start",
|
||||||
json={
|
json={
|
||||||
"keywords": keywords,
|
"keywords": keywords,
|
||||||
"city_code": city_code,
|
"city": city,
|
||||||
"salary_min": salary_min,
|
"salary_min": salary_min,
|
||||||
"salary_max": salary_max,
|
"salary_max": salary_max,
|
||||||
},
|
},
|
||||||
|
|||||||
+2
-2
@@ -160,7 +160,7 @@ def start_apply_shared(params: dict) -> dict:
|
|||||||
return {"ok": False, "msg": "已有投递任务在运行"}
|
return {"ok": False, "msg": "已有投递任务在运行"}
|
||||||
applicant.start(
|
applicant.start(
|
||||||
keywords=list(params.get("keywords") or []),
|
keywords=list(params.get("keywords") or []),
|
||||||
city_code=str(params.get("city_code") or ""),
|
city=str(params.get("city") or ""),
|
||||||
salary_min=params.get("salary_min"),
|
salary_min=params.get("salary_min"),
|
||||||
salary_max=params.get("salary_max"),
|
salary_max=params.get("salary_max"),
|
||||||
min_score=int(params.get("min_score") or 65),
|
min_score=int(params.get("min_score") or 65),
|
||||||
@@ -207,7 +207,7 @@ class AuthReq(BaseModel):
|
|||||||
|
|
||||||
class StartApplyReq(BaseModel):
|
class StartApplyReq(BaseModel):
|
||||||
keywords: list[str]
|
keywords: list[str]
|
||||||
city_code: str
|
city: str
|
||||||
salary_min: int | None = None
|
salary_min: int | None = None
|
||||||
salary_max: int | None = None
|
salary_max: int | None = None
|
||||||
min_score: int = 65
|
min_score: int = 65
|
||||||
|
|||||||
@@ -372,7 +372,7 @@ $('btnStartApply').addEventListener('click', async () => {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
keywords,
|
keywords,
|
||||||
city_code: $('cityCode').value,
|
city: $('city').value,
|
||||||
salary_min: parseInt($('salaryMin').value) || null,
|
salary_min: parseInt($('salaryMin').value) || null,
|
||||||
salary_max: parseInt($('salaryMax').value) || null,
|
salary_max: parseInt($('salaryMax').value) || null,
|
||||||
min_score: parseInt($('minScore').value) || 65,
|
min_score: parseInt($('minScore').value) || 65,
|
||||||
|
|||||||
@@ -88,15 +88,15 @@
|
|||||||
<div class="form-row">
|
<div class="form-row">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>城市</label>
|
<label>城市</label>
|
||||||
<select id="cityCode">
|
<select id="city">
|
||||||
<option value="101010100">北京</option>
|
<option value="北京">北京</option>
|
||||||
<option value="101020100">上海</option>
|
<option value="上海">上海</option>
|
||||||
<option value="101280100">广州</option>
|
<option value="广州">广州</option>
|
||||||
<option value="101280600">深圳</option>
|
<option value="深圳">深圳</option>
|
||||||
<option value="101210100">杭州</option>
|
<option value="杭州">杭州</option>
|
||||||
<option value="101190100">成都</option>
|
<option value="成都">成都</option>
|
||||||
<option value="101110100">西安</option>
|
<option value="西安">西安</option>
|
||||||
<option value="101120100">济南</option>
|
<option value="济南">济南</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|||||||
+5
-1
@@ -63,7 +63,7 @@ CREATE TABLE IF NOT EXISTS apply_sessions (
|
|||||||
user_id INT NOT NULL,
|
user_id INT NOT NULL,
|
||||||
status VARCHAR(20) NOT NULL DEFAULT 'running' COMMENT '会话状态:running/stopped/finished',
|
status VARCHAR(20) NOT NULL DEFAULT 'running' COMMENT '会话状态:running/stopped/finished',
|
||||||
keywords VARCHAR(512) NULL COMMENT '搜索关键词(逗号分隔)',
|
keywords VARCHAR(512) NULL COMMENT '搜索关键词(逗号分隔)',
|
||||||
city_code VARCHAR(20) NULL COMMENT '城市代码',
|
city VARCHAR(20) NULL COMMENT '城市名称',
|
||||||
salary_min INT NULL COMMENT '最低薪资(K)',
|
salary_min INT NULL COMMENT '最低薪资(K)',
|
||||||
salary_max INT NULL COMMENT '最高薪资(K)',
|
salary_max INT NULL COMMENT '最高薪资(K)',
|
||||||
applied_count INT NOT NULL DEFAULT 0 COMMENT '本次会话投递数',
|
applied_count INT NOT NULL DEFAULT 0 COMMENT '本次会话投递数',
|
||||||
@@ -174,3 +174,7 @@ CREATE TABLE IF NOT EXISTS rpa_task (
|
|||||||
-- CONSTRAINT fk_blacklist_user FOREIGN KEY (user_id)
|
-- CONSTRAINT fk_blacklist_user FOREIGN KEY (user_id)
|
||||||
-- REFERENCES users (id) ON DELETE CASCADE
|
-- REFERENCES users (id) ON DELETE CASCADE
|
||||||
-- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
-- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
||||||
|
|
||||||
|
-- 老库城市字段改名(城市代码 → 城市名称):
|
||||||
|
ALTER TABLE apply_sessions
|
||||||
|
CHANGE COLUMN city_code city VARCHAR(20) NULL COMMENT '城市名称';
|
||||||
|
|||||||
+2
-2
@@ -86,8 +86,8 @@ class ApplySession(Base):
|
|||||||
status = Column(String(20), default="running", nullable=False)
|
status = Column(String(20), default="running", nullable=False)
|
||||||
# 搜索关键词(逗号分隔)
|
# 搜索关键词(逗号分隔)
|
||||||
keywords = Column(String(512), nullable=True)
|
keywords = Column(String(512), nullable=True)
|
||||||
# 城市代码
|
# 城市
|
||||||
city_code = Column(String(20), nullable=True)
|
city = Column(String(20), nullable=True)
|
||||||
# 薪资范围
|
# 薪资范围
|
||||||
salary_min = Column(Integer, nullable=True)
|
salary_min = Column(Integer, nullable=True)
|
||||||
salary_max = Column(Integer, nullable=True)
|
salary_max = Column(Integer, nullable=True)
|
||||||
|
|||||||
@@ -89,8 +89,8 @@ def create_task(
|
|||||||
|
|
||||||
if req.task_type == "start_apply":
|
if req.task_type == "start_apply":
|
||||||
params = req.params or {}
|
params = req.params or {}
|
||||||
if not params.get("keywords") or not params.get("city_code"):
|
if not params.get("keywords") or not params.get("city"):
|
||||||
raise HTTPException(status_code=422, detail="开始投递必须提供 keywords 与 city_code")
|
raise HTTPException(status_code=422, detail="开始投递必须提供 keywords 与 city")
|
||||||
|
|
||||||
task = RpaTask(
|
task = RpaTask(
|
||||||
user_id=current_user.id,
|
user_id=current_user.id,
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ def start_session(
|
|||||||
user_id=current_user.id,
|
user_id=current_user.id,
|
||||||
status="running",
|
status="running",
|
||||||
keywords=req.keywords,
|
keywords=req.keywords,
|
||||||
city_code=req.city_code,
|
city=req.city,
|
||||||
salary_min=req.salary_min,
|
salary_min=req.salary_min,
|
||||||
salary_max=req.salary_max,
|
salary_max=req.salary_max,
|
||||||
)
|
)
|
||||||
|
|||||||
+2
-2
@@ -94,7 +94,7 @@ class ResumeUpdateIn(BaseModel):
|
|||||||
# =======================================================
|
# =======================================================
|
||||||
class SessionStartIn(BaseModel):
|
class SessionStartIn(BaseModel):
|
||||||
keywords: str
|
keywords: str
|
||||||
city_code: str
|
city: str
|
||||||
salary_min: Optional[int] = None
|
salary_min: Optional[int] = None
|
||||||
salary_max: Optional[int] = None
|
salary_max: Optional[int] = None
|
||||||
|
|
||||||
@@ -103,7 +103,7 @@ class SessionOut(BaseModel):
|
|||||||
id: int
|
id: int
|
||||||
status: str
|
status: str
|
||||||
keywords: Optional[str]
|
keywords: Optional[str]
|
||||||
city_code: Optional[str]
|
city: Optional[str]
|
||||||
salary_min: Optional[int]
|
salary_min: Optional[int]
|
||||||
salary_max: Optional[int]
|
salary_max: Optional[int]
|
||||||
applied_count: int
|
applied_count: int
|
||||||
|
|||||||
+24
-10
@@ -198,13 +198,26 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="bl-tip" id="rsDetail">进度:- | 更新:-</div>
|
<div class="bl-tip" id="rsDetail">进度:- | 更新:-</div>
|
||||||
|
|
||||||
<div class="bl-add" style="flex-wrap:wrap;">
|
<div class="bl-add" style="flex-wrap:wrap;align-items:flex-end;">
|
||||||
<input type="text" id="rKeywords" placeholder="搜索关键词,多个用逗号分隔,如:java,后端" style="flex:2;min-width:220px;">
|
<div style="flex:2;min-width:220px;"><label style="font-size:12px;color:#666;">搜索关键词(多个用逗号分隔)</label>
|
||||||
<input type="text" id="rCity" placeholder="城市码(如 101010100=北京)" style="flex:1;min-width:150px;">
|
<input type="text" id="rKeywords" placeholder="如:Python开发,后端工程师" value="Python开发"></div>
|
||||||
<input type="number" id="rScore" placeholder="及格分" value="65" style="width:80px;">
|
<div style="min-width:110px;"><label style="font-size:12px;color:#666;">城市</label>
|
||||||
<input type="number" id="rLimit" placeholder="每日上限(0不限)" value="0" style="width:130px;">
|
<select id="rCity" style="width:100%;padding:9px 10px;border:1px solid #d9d9d9;border-radius:6px;">
|
||||||
<label style="display:flex;align-items:center;gap:4px;font-size:13px;"><input type="checkbox" id="rOnlineOnly"> 只投在线Boss</label>
|
<option value="北京">北京</option><option value="上海">上海</option>
|
||||||
<label style="display:flex;align-items:center;gap:4px;font-size:13px;"><input type="checkbox" id="rHunter"> 考虑猎头</label>
|
<option value="广州">广州</option><option value="深圳">深圳</option>
|
||||||
|
<option value="杭州">杭州</option><option value="成都">成都</option>
|
||||||
|
<option value="西安">西安</option><option value="济南">济南</option>
|
||||||
|
</select></div>
|
||||||
|
<div style="width:110px;"><label style="font-size:12px;color:#666;">AI 最低匹配分</label>
|
||||||
|
<input type="number" id="rScore" value="65" min="0" max="100"></div>
|
||||||
|
<div style="width:100px;"><label style="font-size:12px;color:#666;">最低薪资 (K)</label>
|
||||||
|
<input type="number" id="rSalaryMin" value="15" min="0"></div>
|
||||||
|
<div style="width:100px;"><label style="font-size:12px;color:#666;">最高薪资 (K)</label>
|
||||||
|
<input type="number" id="rSalaryMax" value="40" min="0"></div>
|
||||||
|
<div style="width:140px;"><label style="font-size:12px;color:#666;">每日投递上限(0=不限)</label>
|
||||||
|
<input type="number" id="rLimit" value="30" min="0"></div>
|
||||||
|
<label style="display:flex;align-items:center;gap:4px;font-size:13px;padding-bottom:10px;"><input type="checkbox" id="rOnlineOnly"> 只投递 Boss 在线的</label>
|
||||||
|
<label style="display:flex;align-items:center;gap:4px;font-size:13px;padding-bottom:10px;"><input type="checkbox" id="rHunter"> 考虑猎头职位</label>
|
||||||
<button id="btnStartRemote" style="background:#1890ff;">开始投递</button>
|
<button id="btnStartRemote" style="background:#1890ff;">开始投递</button>
|
||||||
<button id="btnStopRemote">结束投递</button>
|
<button id="btnStopRemote">结束投递</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -479,13 +492,14 @@ document.getElementById('blNext').onclick = () => { blState.page++; loadBlacklis
|
|||||||
// 远程控制
|
// 远程控制
|
||||||
document.getElementById('btnStartRemote').onclick = () => {
|
document.getElementById('btnStartRemote').onclick = () => {
|
||||||
const keywords = (document.getElementById('rKeywords').value || '').split(/[,,\s]+/).filter(Boolean);
|
const keywords = (document.getElementById('rKeywords').value || '').split(/[,,\s]+/).filter(Boolean);
|
||||||
const cityCode = (document.getElementById('rCity').value || '').trim();
|
|
||||||
if (!keywords.length) { alert('请填写搜索关键词'); return; }
|
if (!keywords.length) { alert('请填写搜索关键词'); return; }
|
||||||
if (!cityCode) { alert('请填写城市码'); return; }
|
|
||||||
if (!confirm('确认远程启动投递任务?')) return;
|
if (!confirm('确认远程启动投递任务?')) return;
|
||||||
sendTask('start_apply', {
|
sendTask('start_apply', {
|
||||||
keywords, city_code: cityCode,
|
keywords,
|
||||||
|
city: document.getElementById('rCity').value,
|
||||||
min_score: parseInt(document.getElementById('rScore').value, 10) || 65,
|
min_score: parseInt(document.getElementById('rScore').value, 10) || 65,
|
||||||
|
salary_min: parseInt(document.getElementById('rSalaryMin').value, 10) || 0,
|
||||||
|
salary_max: parseInt(document.getElementById('rSalaryMax').value, 10) || 0,
|
||||||
daily_limit: parseInt(document.getElementById('rLimit').value, 10) || 0,
|
daily_limit: parseInt(document.getElementById('rLimit').value, 10) || 0,
|
||||||
boss_online_only: document.getElementById('rOnlineOnly').checked,
|
boss_online_only: document.getElementById('rOnlineOnly').checked,
|
||||||
allow_headhunter: document.getElementById('rHunter').checked,
|
allow_headhunter: document.getElementById('rHunter').checked,
|
||||||
|
|||||||
Reference in New Issue
Block a user