From b458e63245d42375c20ee1052b55c0dbe5665a7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E5=BF=97?= Date: Tue, 20 Jan 2026 18:08:06 +0800 Subject: [PATCH] update --- app/controller/Crawler.php | 6 +++--- app/service/CrawlerService.php | 6 +++--- view/crawler/index.html | 25 ++++++++++++++++++++++--- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/app/controller/Crawler.php b/app/controller/Crawler.php index d06c5b4..0e34604 100644 --- a/app/controller/Crawler.php +++ b/app/controller/Crawler.php @@ -366,10 +366,10 @@ class Crawler extends BaseController $item = $info; } - // 计算竞争比 + // 计算竞争比(格式:招聘人数:审核通过人数) $zprs = isset($item['zprs']) ? intval($item['zprs']) : 0; $bkrs = isset($item['bkrs']) ? intval($item['bkrs']) : 0; - $competitionRatio = $zprs > 0 ? ($bkrs / $zprs) : 0; + $competitionRatio = $zprs > 0 && $bkrs > 0 ? $zprs . ':' . $bkrs : ($zprs > 0 ? $zprs . ':0' : '0:0'); $result = [ 'sbmc' => $item['sbmc'] ?? '', // 省份 @@ -379,7 +379,7 @@ class Crawler extends BaseController 'zwdm' => $item['zwdm'] ?? $zwdm, // 职位代码 'zprs' => $zprs, // 招聘人数 'bkrs' => $bkrs, // 审核通过人数 - 'competition_ratio' => number_format($competitionRatio, 2), // 竞争比 + 'competition_ratio' => $competitionRatio, // 竞争比(格式:招聘人数:审核通过人数) ]; return json([ diff --git a/app/service/CrawlerService.php b/app/service/CrawlerService.php index 71462dc..4d76682 100644 --- a/app/service/CrawlerService.php +++ b/app/service/CrawlerService.php @@ -175,10 +175,10 @@ class CrawlerService $item = $info; } - // 计算竞争比 + // 计算竞争比(格式:招聘人数:审核通过人数) $zprs = isset($item['zprs']) ? intval($item['zprs']) : 0; $bkrs = isset($item['bkrs']) ? intval($item['bkrs']) : 0; - $competitionRatio = $zprs > 0 ? ($bkrs / $zprs) : 0; + $competitionRatio = $zprs > 0 && $bkrs > 0 ? $zprs . ':' . $bkrs : ($zprs > 0 ? $zprs . ':0' : '0:0'); $results[] = [ 'sbmc' => $item['sbmc'] ?? '', // 省份 @@ -188,7 +188,7 @@ class CrawlerService 'zwdm' => $item['zwdm'] ?? $zwdm, // 职位代码 'zprs' => $zprs, // 招聘人数 'bkrs' => $bkrs, // 审核通过人数 - 'competition_ratio' => number_format($competitionRatio, 2), // 竞争比 + 'competition_ratio' => $competitionRatio, // 竞争比(格式:招聘人数:审核通过人数) ]; } diff --git a/view/crawler/index.html b/view/crawler/index.html index eec21d6..c4127ce 100644 --- a/view/crawler/index.html +++ b/view/crawler/index.html @@ -298,7 +298,7 @@

职位信息结果

- +