123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <?php
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- namespace app\common\state;
- /**
- * Description of CommonConst
- * 公共常量
- * @author sgq
- */
- class CommonConst {
- /**
- * 通过层次得到层次基础积分
- * @param type $level
- * @return int
- */
- public static function getLayerPointsByLayer($level) {
- $levelAndPoints = [
- 1 => 6000,
- 2 => 4000,
- 3 => 2000,
- 4 => 1000,
- 5 => 500,
- 6 => 200,
- 7 => 100,
- 8 => 0
- ];
- return $levelAndPoints[$level];
- }
- /**
- * 通过层次得到层次名
- * @param type $level
- * @return string
- */
- public static function getLayerNameByLayer($level) {
- $levelAndNames = [
- 1 => "第一层次",
- 2 => "第二层次",
- 3 => "第三层次",
- 4 => "第四层次",
- 5 => "第五层次",
- 6 => "第六层次",
- 7 => "第七层次",
- 8 => "非优秀人才"
- ];
- return $levelAndNames[$level];
- }
- /**
- * 通过积分得到层次
- * @param type $points
- * @return int
- */
- public static function getLayerByPoints($points) {
- $level = 1;
- while ($levelPoints = CommonConst::getLayerPointsByLayer($level)) {
- if ($points >= $levelPoints) {
- break;
- }
- $level++;
- }
- return $level;
- }
- }
|