修复竞争比
This commit is contained in:
@@ -292,7 +292,7 @@ class CrawlerService
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算竞争比(格式:1:比例,保留2位小数)
|
||||
* 计算竞争比(格式:1:比例,四舍五入取整,无小数)
|
||||
* @param int $zprs 招聘人数
|
||||
* @param int $bkrs 审核通过人数
|
||||
* @return string
|
||||
@@ -309,16 +309,14 @@ class CrawlerService
|
||||
|
||||
// 将招聘人数简化为1,计算审核通过人数与招聘人数的比例
|
||||
$ratio = $bkrs / $zprs;
|
||||
$ratioRounded = (int) round($ratio, 0, PHP_ROUND_HALF_UP);
|
||||
|
||||
// 保留2位小数
|
||||
$ratioFormatted = number_format($ratio, 2, '.', '');
|
||||
|
||||
// 如果小数部分是.00,则显示为整数
|
||||
if (floatval($ratioFormatted) == intval($ratioFormatted)) {
|
||||
return '1:' . intval($ratioFormatted);
|
||||
// 防止四舍五入后为0的极端情况
|
||||
if ($ratioRounded < 0) {
|
||||
$ratioRounded = 0;
|
||||
}
|
||||
|
||||
return '1:' . $ratioFormatted;
|
||||
return '1:' . $ratioRounded;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
2
public/static/.gitignore
vendored
2
public/static/.gitignore
vendored
@@ -1,2 +0,0 @@
|
||||
*
|
||||
!.gitignore
|
||||
24
public/static/js/xlsx.full.min.js
vendored
Normal file
24
public/static/js/xlsx.full.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
@@ -5,7 +5,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>职位信息爬虫工具-2</title>
|
||||
<!-- SheetJS库用于导出XLSX -->
|
||||
<script src="/static/js/xlsx.full.min.js"></script>
|
||||
<script src="<?php echo request()->root(); ?>/static/js/xlsx.full.min.js?v=1"></script>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
|
||||
Reference in New Issue
Block a user