This commit is contained in:
aozhiwei 2022-09-22 10:58:10 +08:00
parent bb53b5ead6
commit c12a61e362
4 changed files with 22 additions and 18 deletions

View File

@ -40,8 +40,8 @@ CREATE TABLE `t_user` (
`history_best_rank` int(11) NOT NULL DEFAULT '0' COMMENT '历史最高段位',
`score` int(11) NOT NULL DEFAULT '0' COMMENT '积分',
`history_best_score` int(11) NOT NULL DEFAULT '0' COMMENT '历史最高积分',
`gold` bigint NOT NULL DEFAULT '0' COMMENT '金币',
`diamond` bigint NOT NULL DEFAULT '0' COMMENT '钻石',
`gold` double NOT NULL DEFAULT '0' COMMENT '金币',
`diamond` double NOT NULL DEFAULT '0' COMMENT '钻石',
`hero_id` int(11) NOT NULL DEFAULT '0' COMMENT '当前上阵英雄id',
`first_fight` int(11) NOT NULL DEFAULT '0' COMMENT '是否首战',
`last_season_id` int(11) NOT NULL DEFAULT '0' COMMENT '最后一次赛季id',

View File

@ -41,6 +41,16 @@ function isValidSex($sex)
return in_array($sex, array(0, 1, 2));
}
function cegFormat($ceg)
{
return floor($ceg * 100) / 100;
}
function cecFormat($cec)
{
return floor($cec * 100) / 100;
}
$_myself = null;
function myself()

View File

@ -39,8 +39,8 @@ class User extends BaseModel {
'history_best_rank' => $row['history_best_rank'],
'score' => $row['score'],
'history_best_score' => $row['history_best_score'],
'gold' => $row['gold'],
'diamond' => $row['diamond'],
'gold' => cegFormat($row['gold']),
'diamond' => cecFormat($row['diamond']),
'hero_id' => $row['hero_id'],
'first_fight' => $row['first_fight'],
'already_guide' => $row['already_guide'],
@ -68,8 +68,8 @@ class User extends BaseModel {
'history_best_rank' => $row['history_best_rank'],
'score' => $row['score'],
'history_best_score' => $row['history_best_score'],
'gold' => $row['gold'],
'diamond' => $row['diamond'],
'gold' => cegFormat($row['gold']),
'diamond' => cecFormat($row['diamond']),
'hero_id' => $row['hero_id'],
'first_fight' => $row['first_fight'],
'already_guide' => $row['already_guide'],
@ -94,8 +94,8 @@ class User extends BaseModel {
'exp' => $row['exp'],
'rank' => $row['rank'],
'score' => $row['score'],
'gold' => $row['gold'],
'diamond' => $row['diamond'],
'gold' => cegFormat($row['gold']),
'diamond' => cecFormat($row['diamond']),
'hero_id' => $row['hero_id'],
'pve_instance_id' => $row['pve_instance_id'],
'like_count' => $row['like_count'],

View File

@ -40,7 +40,7 @@ class FormulaService extends BaseService {
(1 - ($ranked >= 30 ? 1 : 0)) *
($kills >= 1 ? 1 : 0) *
($aliveTime >= 30 ? 1 : 0);
return round($ceg);
return cegFormat(($ceg));
}
public static function calcHeroPveCeg($heroDto, $instanceLevel, $instanceRank, $bossReward)
@ -53,13 +53,7 @@ class FormulaService extends BaseService {
(0.8 - ($instanceRank - 1) * 0.25 + $bossReward * 0.2) *
1/10;
error_log(json_encode(array(
'instanceLevel' => $instanceLevel,
'instanceRank' => $instanceRank,
'bossReward' => $bossReward,
'ceg' => $ceg
)));
return round($ceg);
return cegFormat($ceg);
}
public static function calcWeaponPvpCeg($weaponDto, $params)
@ -86,7 +80,7 @@ class FormulaService extends BaseService {
(1 - ($ranked >= 30 ? 1 : 0)) *
($kills >= 1 ? 1 : 0) *
($aliveTime >= 30 ? 1 : 0);
return round($ceg);
return cegFormat($ceg);
}
public static function calcWeaponPveCeg($weaponDb, $instanceLevel, $instanceRank, $bossReward)
@ -99,7 +93,7 @@ class FormulaService extends BaseService {
(0.8 - ($instanceRank - 1) * 0.25 + $bossReward * 0.2) *
1/10;
return round(ceg);
return cegFormat(ceg);
}
public static function calcHeroFragmentProbabilityPvp($params,