diff --git a/build_exe.bat b/build_exe.bat index 5c3a7ee..6a3746b 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.6 +set APP_VERSION=1.7 echo [1/2] 安装打包依赖... pip install pyinstaller PySide6 --quiet diff --git a/client/browser/applicant.py b/client/browser/applicant.py index 2c3ba14..8fc0060 100644 --- a/client/browser/applicant.py +++ b/client/browser/applicant.py @@ -28,22 +28,6 @@ from ..server_api import ServerAPI # 职位列表页(注意是 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 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, min_score: int, delay_range: tuple[int, int], boss_online_only: bool = False, daily_limit: int = 0, @@ -199,7 +183,7 @@ class Applicant: return 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, ) self.session_id = session["id"] @@ -217,7 +201,7 @@ class Applicant: self._thread = threading.Thread( target=self._run, - args=(keywords, city_code, salary_min, salary_max, + args=(keywords, city, salary_min, salary_max, min_score, delay_range), 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): try: self.manager.ensure_browser_started() @@ -283,7 +267,7 @@ class Applicant: logger.warning(f"获取公司黑名单失败,黑名单过滤跳过:{e}") self._blacklist = set() - city_name = CITY_NAMES.get(str(city_code), "") + city_name = str(city or "").strip() for keyword in keywords: if self._should_stop(): break diff --git a/client/server_api.py b/client/server_api.py index 1064ac4..a99531c 100644 --- a/client/server_api.py +++ b/client/server_api.py @@ -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: resp = self._req("post", f"{self.base_url}/api/sessions/start", json={ "keywords": keywords, - "city_code": city_code, + "city": city, "salary_min": salary_min, "salary_max": salary_max, }, diff --git a/client/web/app.py b/client/web/app.py index ed5ec63..3e20d05 100644 --- a/client/web/app.py +++ b/client/web/app.py @@ -160,7 +160,7 @@ def start_apply_shared(params: dict) -> dict: return {"ok": False, "msg": "已有投递任务在运行"} applicant.start( 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_max=params.get("salary_max"), min_score=int(params.get("min_score") or 65), @@ -207,7 +207,7 @@ class AuthReq(BaseModel): class StartApplyReq(BaseModel): keywords: list[str] - city_code: str + city: str salary_min: int | None = None salary_max: int | None = None min_score: int = 65 diff --git a/client/web/static/app.js b/client/web/static/app.js index 97c542f..7fc2fa8 100644 --- a/client/web/static/app.js +++ b/client/web/static/app.js @@ -372,7 +372,7 @@ $('btnStartApply').addEventListener('click', async () => { method: 'POST', body: JSON.stringify({ keywords, - city_code: $('cityCode').value, + city: $('city').value, salary_min: parseInt($('salaryMin').value) || null, salary_max: parseInt($('salaryMax').value) || null, min_score: parseInt($('minScore').value) || 65, diff --git a/client/web/templates/index.html b/client/web/templates/index.html index 8ef2b26..1ee7428 100644 --- a/client/web/templates/index.html +++ b/client/web/templates/index.html @@ -88,15 +88,15 @@
- + + + + + + + +
diff --git a/docs/schema.sql b/docs/schema.sql index 5983adb..3157d73 100644 --- a/docs/schema.sql +++ b/docs/schema.sql @@ -63,7 +63,7 @@ CREATE TABLE IF NOT EXISTS apply_sessions ( user_id INT NOT NULL, status VARCHAR(20) NOT NULL DEFAULT 'running' COMMENT '会话状态:running/stopped/finished', keywords VARCHAR(512) NULL COMMENT '搜索关键词(逗号分隔)', - city_code VARCHAR(20) NULL COMMENT '城市代码', + city VARCHAR(20) NULL COMMENT '城市名称', salary_min INT NULL COMMENT '最低薪资(K)', salary_max INT NULL COMMENT '最高薪资(K)', 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) -- REFERENCES users (id) ON DELETE CASCADE -- ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + +-- 老库城市字段改名(城市代码 → 城市名称): +ALTER TABLE apply_sessions + CHANGE COLUMN city_code city VARCHAR(20) NULL COMMENT '城市名称'; diff --git a/server/models.py b/server/models.py index ba902ae..f7f52a4 100644 --- a/server/models.py +++ b/server/models.py @@ -86,8 +86,8 @@ class ApplySession(Base): status = Column(String(20), default="running", nullable=False) # 搜索关键词(逗号分隔) 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_max = Column(Integer, nullable=True) diff --git a/server/routers/rpa.py b/server/routers/rpa.py index 98cbdc0..1fd3e99 100644 --- a/server/routers/rpa.py +++ b/server/routers/rpa.py @@ -89,8 +89,8 @@ def create_task( if req.task_type == "start_apply": params = req.params or {} - if not params.get("keywords") or not params.get("city_code"): - raise HTTPException(status_code=422, detail="开始投递必须提供 keywords 与 city_code") + if not params.get("keywords") or not params.get("city"): + raise HTTPException(status_code=422, detail="开始投递必须提供 keywords 与 city") task = RpaTask( user_id=current_user.id, diff --git a/server/routers/sessions.py b/server/routers/sessions.py index 18e2493..cf83f96 100644 --- a/server/routers/sessions.py +++ b/server/routers/sessions.py @@ -34,7 +34,7 @@ def start_session( user_id=current_user.id, status="running", keywords=req.keywords, - city_code=req.city_code, + city=req.city, salary_min=req.salary_min, salary_max=req.salary_max, ) diff --git a/server/schemas.py b/server/schemas.py index 13c9356..61f861b 100644 --- a/server/schemas.py +++ b/server/schemas.py @@ -94,7 +94,7 @@ class ResumeUpdateIn(BaseModel): # ======================================================= class SessionStartIn(BaseModel): keywords: str - city_code: str + city: str salary_min: Optional[int] = None salary_max: Optional[int] = None @@ -103,7 +103,7 @@ class SessionOut(BaseModel): id: int status: str keywords: Optional[str] - city_code: Optional[str] + city: Optional[str] salary_min: Optional[int] salary_max: Optional[int] applied_count: int diff --git a/server/static/view.html b/server/static/view.html index 9db78f8..bbec44d 100644 --- a/server/static/view.html +++ b/server/static/view.html @@ -198,13 +198,26 @@
进度:- | 更新:-
-
- - - - - - +
+
+
+
+
+
+
+
+
+
+
+
+
+ +
@@ -479,13 +492,14 @@ document.getElementById('blNext').onclick = () => { blState.page++; loadBlacklis // 远程控制 document.getElementById('btnStartRemote').onclick = () => { const keywords = (document.getElementById('rKeywords').value || '').split(/[,,\s]+/).filter(Boolean); - const cityCode = (document.getElementById('rCity').value || '').trim(); if (!keywords.length) { alert('请填写搜索关键词'); return; } - if (!cityCode) { alert('请填写城市码'); return; } if (!confirm('确认远程启动投递任务?')) return; sendTask('start_apply', { - keywords, city_code: cityCode, + keywords, + city: document.getElementById('rCity').value, 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, boss_online_only: document.getElementById('rOnlineOnly').checked, allow_headhunter: document.getElementById('rHunter').checked,