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 @@