You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
799 B
34 lines
799 B
<?php
|
|
|
|
namespace app\common\model;
|
|
|
|
class Pass extends BaseModel
|
|
{
|
|
public static $unit = [1 => '>', 2 => '<', 3 => '=', 4 => '≥', 5 => '<=', 6 => '!='];
|
|
|
|
/**
|
|
* 馆舍客流情况-拥挤程度
|
|
* @param $proportion // 比例
|
|
* @return string
|
|
*/
|
|
public static function getPassType($proportion)
|
|
{
|
|
# 舒适:阈值<80%
|
|
if ($proportion < 0.8) {
|
|
return '舒适';
|
|
}
|
|
# 饱和:80%<阈值<100%
|
|
if (0.8 < $proportion || $proportion < 1) {
|
|
return '饱和';
|
|
}
|
|
# 拥挤:阈值=100%
|
|
if ($proportion == 1) {
|
|
return '拥挤';
|
|
}
|
|
# 拥挤:阈值=100%
|
|
if ($proportion >= 1.2) {
|
|
return '爆满';
|
|
}
|
|
return '';
|
|
}
|
|
}
|