修改赛季结算相关接口
This commit is contained in:
parent
32c6f0c498
commit
446ca66ade
@ -4,48 +4,39 @@ const http = require('j7/http');
|
||||
|
||||
|
||||
const constant = require('../constant');
|
||||
|
||||
|
||||
class Star {
|
||||
class DailyTask {
|
||||
async start() {
|
||||
console.log('Star And Pass Start');
|
||||
let url_star = getUrl('Star','resetStar');
|
||||
let url_pass = getUrl('Pass','resetPassLevel');
|
||||
console.log('DailyTask Start ... ');
|
||||
let url_star = getUrl('missionStarSeasonSettlement');
|
||||
let url_pass = getUrl('battlePassSeasonSettlement');
|
||||
let url_ranking = getUrl('battleRankingSeasonSettlement');
|
||||
while (true) {
|
||||
await http.get(url_star,null)
|
||||
await http.get(url_pass,null)
|
||||
await http.get(url_ranking,null)
|
||||
const nowTime = utils.getUtcTime();
|
||||
const daySeconds = utils.getDaySeconds(nowTime, constant.TIME_ZONE);
|
||||
const sleepTime = daySeconds + 3600 * 24 - nowTime;
|
||||
console.log('Star.sleepTime:' + sleepTime, new Date(), sleepTime / 60);
|
||||
console.log('DailyTask.sleepTime:' + sleepTime, new Date(), sleepTime / 60);
|
||||
await utils.sleep(sleepTime * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function getUrl(controller,action){
|
||||
// let url = 'http://james.com/webapp/index.php?&c=Star&a=resetStar';
|
||||
|
||||
function getUrl(action){
|
||||
// let url = 'http://james.com/webapp/index.php?&c=DailyRequest&a=' + action;
|
||||
let url = '';
|
||||
if (utils.isOnlineEnv()) {
|
||||
url = 'https://game2006api-test.cebggame.com/webapp/index.php?&c=' + controller + '&a=' + action;
|
||||
url = 'https://game2006api-test.cebggame.com/webapp/index.php?&c=DailyRequest&a=' + action;
|
||||
} else {
|
||||
url = 'https://game2006api-test.kingsome.cn/webapp/index.php?&c=' + controller + '&a=' + action;
|
||||
url = 'https://game2006api-test.kingsome.cn/webapp/index.php?&c=DailyRequest&a=' + action;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
|
||||
function getV(){
|
||||
|
||||
}
|
||||
|
||||
function setV(){
|
||||
|
||||
}
|
||||
|
||||
function init() {
|
||||
(new Star()).start();
|
||||
(new DailyTask()).start();
|
||||
}
|
||||
|
||||
exports.init = init;
|
||||
exports.init = init;
|
@ -7,9 +7,8 @@ function add(name) {
|
||||
|
||||
function init() {
|
||||
//add('season');
|
||||
//add('feeback');
|
||||
//add('dailyTask');
|
||||
add('rankings');
|
||||
//add('star');
|
||||
}
|
||||
|
||||
exports.init = init;
|
||||
|
130
webapp/controller/DailyRequestController.class.php
Normal file
130
webapp/controller/DailyRequestController.class.php
Normal file
@ -0,0 +1,130 @@
|
||||
<?php
|
||||
require_once('services/AwardService.php');
|
||||
require_once('services/PropertyChgService.php');
|
||||
|
||||
require_once('mt/StarLevel.php');
|
||||
require_once('mt/BattlePass.php');
|
||||
require_once('mt/Rank.php');
|
||||
require_once('mt/RankSeason.php');
|
||||
|
||||
require_once('models/RealtimeData.php');
|
||||
require_once('models/Season.php');
|
||||
use phpcommon\SqlHelper;
|
||||
|
||||
use models\RealtimeData;
|
||||
use models\Season;
|
||||
|
||||
class DailyRequestController extends BaseAuthedController {
|
||||
private $awardService = null;
|
||||
private $propertyChgService = null;
|
||||
|
||||
public function _handlePre()
|
||||
{
|
||||
$this->propertyChgService = new services\PropertyChgService();
|
||||
$this->awardService = new services\AwardService();
|
||||
}
|
||||
|
||||
/**
|
||||
* 星星之路的赛季结算
|
||||
*/
|
||||
public function missionStarSeasonSettlement(){
|
||||
$season = RealtimeData::getMissionSeason();
|
||||
$currMissionSeasonMeta = \mt\StarLevel::getCurrentSeason();
|
||||
if ($currMissionSeasonMeta && $currMissionSeasonMeta['id'] > $season){
|
||||
$max_star_num = mt\Parameter::getVal('starroad_restart_point',1000);
|
||||
$rows = myself()->_getMysql('')->execQuery(
|
||||
'SELECT account_id,star_num FROM t_user WHERE star_num>:star_num',
|
||||
array(
|
||||
"star_num"=>$max_star_num
|
||||
)
|
||||
);
|
||||
if (count($rows) > 0){
|
||||
foreach ($rows as $row){
|
||||
myself()->_getMysql('')->execQuery(
|
||||
'UPDATE t_user SET star_num=:star_num WHERE account_id=:account_id',
|
||||
array(
|
||||
"star_num"=>$max_star_num,
|
||||
"account_id"=>$row['account_id'],
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
error_log("DailyRequestController : Mission Star Season ".$season." Settlement Success !" . " Request Time : ". date('Y-M-D h:i:s',time()));
|
||||
RealtimeData::setMissionSeason($currMissionSeasonMeta['id']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通行证的赛季结算
|
||||
*/
|
||||
public function battlePassSeasonSettlement(){
|
||||
$season = RealtimeData::getPassSeason();
|
||||
$currSeasonMeta = \mt\BattlePass::getCurrentSeason();
|
||||
if ($currSeasonMeta && $currSeasonMeta['id'] > $season) {
|
||||
myself()->_getMysql('')->execQuery(
|
||||
'UPDATE t_user SET activated=:activated,level=:level,exp=:exp',
|
||||
array(
|
||||
"activated" => 0,
|
||||
"level" => 1,
|
||||
"exp" => 0,
|
||||
)
|
||||
);
|
||||
error_log("DailyRequestController : Battle Pass Season ".$season." Settlement Success !" . " Request Time : ". date('Y-M-D h:i:s',time()));
|
||||
RealtimeData::setPassSeason($currSeasonMeta['id']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 排位战斗的赛季结算
|
||||
*/
|
||||
public function battleRankingSeasonSettlement(){
|
||||
$currSeasonMeta = mt\RankSeason::getCurrentSeason();
|
||||
$season = RealtimeData::getRankSeason();
|
||||
if ($currSeasonMeta && $currSeasonMeta['id'] > $season) {
|
||||
if ($season > 1){
|
||||
$SeasonMeta = mt\RankSeason::get($season-1);
|
||||
$time = strtotime($SeasonMeta['start_time']);
|
||||
$rows = myself()->_getMysql('')->execQuery(
|
||||
'SELECT account_id,`rank`,score FROM t_user ' .
|
||||
'WHERE score_modifytime > :score_modifytime AND score_modifytime <> createtime',
|
||||
array(
|
||||
'score_modifytime' => $time
|
||||
)
|
||||
);
|
||||
}else{
|
||||
$rows = myself()->_getMysql('')->execQuery(
|
||||
'SELECT account_id,`rank`,score FROM t_user ' .
|
||||
'WHERE score_modifytime <> createtime'
|
||||
);
|
||||
}
|
||||
|
||||
if (count($rows) < 1){
|
||||
error_log("resetRankGainAward : No user participates in the ranking");
|
||||
die;
|
||||
}
|
||||
foreach ($rows as $row){
|
||||
$currRankMeta = mt\Rank::getRankById($row['rank']);
|
||||
if (! $currRankMeta){
|
||||
error_log("resetRankGainAward : rankRank@rankRank.php field rank error" . json_encode($row));
|
||||
continue;
|
||||
}
|
||||
$dropRankMeta = mt\Rank::getRankById($currRankMeta['next_season']);
|
||||
if (! $dropRankMeta){
|
||||
error_log("resetRankGainAward : rankRank@rankRank.php field next_season error" . json_encode($row));
|
||||
continue;
|
||||
}
|
||||
$award = Season::seasonReward($currRankMeta);
|
||||
myself()->switchAccount($row['account_id']);
|
||||
myself()->_addItems($award, null, $this->propertyChgService);
|
||||
myself()->_updateUserInfo(array(
|
||||
'last_season_id' => $currSeasonMeta['id'],
|
||||
'rank' => $dropRankMeta['id'],
|
||||
'score' => $dropRankMeta['rank_score'],
|
||||
));
|
||||
}
|
||||
error_log("DailyRequestController : Battle Ranking Season ".$season." Settlement Success !" . " Request Time : ". date('Y-M-D h:i:s',time()));
|
||||
RealtimeData::setRankSeason($currSeasonMeta['id']);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -197,6 +197,7 @@ class HeroController extends BaseAuthedController {
|
||||
*/
|
||||
public function upgradeLv()
|
||||
{
|
||||
return;
|
||||
$heroUniId = getReqVal('hero_uniid', 0);
|
||||
$heroDb = Hero::find($heroUniId);
|
||||
$oldHero = Hero::toDto($heroDb);
|
||||
@ -446,6 +447,7 @@ class HeroController extends BaseAuthedController {
|
||||
英雄碎片合成
|
||||
*/
|
||||
public function heroPieceSys(){
|
||||
return;
|
||||
error_log("HERO PRICE : " . json_encode($_REQUEST));
|
||||
$itemId = getReqVal('item_id',0);
|
||||
$pieceNum = \mt\Parameter::getVal('hero_piece_synthesis_num',0);
|
||||
@ -475,6 +477,7 @@ class HeroController extends BaseAuthedController {
|
||||
}
|
||||
|
||||
public function beforeHeroReset(){
|
||||
return;
|
||||
$hero_unnid = getReqVal('hero_unnid',0);
|
||||
$heroDb = Hero::find($hero_unnid);
|
||||
if (!$heroDb){
|
||||
@ -535,6 +538,7 @@ class HeroController extends BaseAuthedController {
|
||||
英雄重置 2:5|3:10|4:15|5:20|6:25|7:30|8:35|9:40|10:45|11:50|12:55|13:60|14:65|15:70
|
||||
*/
|
||||
public function heroResetLevel(){
|
||||
return;
|
||||
error_log("heroResetLevel : " . json_encode($_REQUEST));
|
||||
if (!$this->_isValidAddress()) {
|
||||
$this->_rspErr(1, 'address is empty');
|
||||
|
@ -333,6 +333,7 @@ class PassController extends BaseAuthedController
|
||||
|
||||
public function resetPassLevel()
|
||||
{
|
||||
return;
|
||||
$season = RealtimeData::getPassSeason();
|
||||
if ($this->currSeasonMeta['id'] > $season) {
|
||||
myself()->_getSelfMysql()->execQuery(
|
||||
|
@ -163,6 +163,7 @@ class StarController extends BaseAuthedController {
|
||||
}
|
||||
|
||||
public function resetStar(){
|
||||
return;
|
||||
$season = RealtimeData::getMissionSeason();
|
||||
if ( $this->currMissionSeasonMeta['id'] > $season){
|
||||
$meta = mt\Parameter::getByName('starroad_restart_point');
|
||||
|
@ -88,6 +88,32 @@ class RealtimeData extends BaseModel {
|
||||
);
|
||||
}
|
||||
|
||||
//获取排位的赛季
|
||||
public static function getRankSeason(){
|
||||
$db = self::internalGet('ranking_season');
|
||||
return max(1, $db ? $db['value1']: 0);
|
||||
}
|
||||
//设置排位的赛季
|
||||
public static function setRankSeason($value){
|
||||
SqlHelper::upsert
|
||||
(myself()->_getMysql(''),
|
||||
't_realtime_data',
|
||||
array(
|
||||
'name' => 'ranking_season'
|
||||
),
|
||||
array(
|
||||
'value1' => $value,
|
||||
'modifytime' => myself()->_getNowTime()
|
||||
),
|
||||
array(
|
||||
'name' => 'ranking_season',
|
||||
'value1' => $value,
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
private static function internalGet($name)
|
||||
{
|
||||
$row = SqlHelper::ormSelectOne
|
||||
|
@ -337,44 +337,25 @@ class FormulaService extends BaseService {
|
||||
}
|
||||
|
||||
public static function calcBattleAfterRankScore($userDb,$params,$winningPro){
|
||||
/**一个玩家的赛后积分 = 赛前积分+K*(胜负率-总胜率)+2K*(表现分-段位要求的及格分)*/
|
||||
/**一个玩家的赛后积分 = 赛前积分+K/2*(MAX(胜负率-总胜率,0))+K*(表现分-段位要求的及格分)*/
|
||||
//胜负率=1-(排名-1)/(最大排名-1)
|
||||
$ranked = getXVal($params, 'pvp_personal_rank');
|
||||
$teamRank = getXVal($params, 'pvp_team_rank');
|
||||
$meta1 = mt\Parameter::getByName('rank_order_max');
|
||||
$maxRanked = $meta1 ? $meta1['param_value'] : 40; //************** parameter 参数表获取 ************
|
||||
$teamRank = min(getXVal($params, 'pvp_team_rank'),10);
|
||||
$maxRanked = mt\Parameter::getVal('rank_order_max',40); //************** parameter 参数表获取 ************
|
||||
$winRate = 1-($ranked-1)/($maxRanked-1);
|
||||
//总胜率=70%*P(个人ELO值-敌队平均ELO值)+30%*P(己队平均ELO值-敌队平均ELO值) --> P(D)=1/(1+10^(-D/400))
|
||||
$winRateSum = $winningPro;
|
||||
// //表现分=f(全局排名Top X%)*50%+f(PK人数排名Top X%)*30%+f(存活时间排名Top X%)*15%+f(英雄阶数排名Top X%)*3%+f(枪械阶数排名Top X%)*2% --> f(Top X%) = ROUND(1-(X/10-1)/9,2)
|
||||
// $rankedTopX = getXVal($params, 'ranked_topx');
|
||||
// $killsTopX = getXVal($params, 'kills_topx');
|
||||
// $heroTopX = getXVal($params, 'hero_topx');
|
||||
// $weaponTopX = getXVal($params, 'weapon_topx');
|
||||
// $survivalTopX = getXVal($params, 'survival_topx');
|
||||
// $expreScore = ROUND(1-($rankedTopX*100/10-1)/9,2) * 0.5 +
|
||||
// ROUND(1-($killsTopX*100/10-1)/9,2) * 0.3 +
|
||||
// ROUND(1-($survivalTopX*100/10-1)/9,2) * 0.15 +
|
||||
// ROUND(1-($heroTopX*100/10-1)/9,2) * 0.03 +
|
||||
// ROUND(1-($weaponTopX*100/10-1)/9,2) * 0.02;
|
||||
|
||||
//表现分=f(个人存活时间排名TopX/4)*50%+f(队伍排名TopY)*50% f(TopX) = ROUND(1-(X-1)/9,2)
|
||||
$expreScore = (ROUND(1-($ranked/4-1)/9,2))*0.5+ROUND(1-($teamRank-1)/9,2)*0.5;
|
||||
|
||||
//不同段位的及格分 = ROUND(1-(大段位排名-1)/(MAX(10)-1),2)
|
||||
$topRanking = mt\Rank::getRankById($userDb['rank'])?mt\Rank::getRankById($userDb['rank'])['rank_order']:0; //************** rankRank 参数表获取 ************
|
||||
$meta3 = mt\Parameter::getByName('rank_pass_point'); //************** parameter 参数表获取 ************
|
||||
if ($meta3){
|
||||
$valArr = explode('|',$meta3['param_value']);
|
||||
$askedScore = $valArr[$topRanking-1];
|
||||
}else{
|
||||
$askedScore = 0;
|
||||
}
|
||||
|
||||
$rankPint = mt\Parameter::getVal('rank_pass_point',0); //************** parameter 参数表获取 ************
|
||||
$rankPintArr = explode('|',$rankPint);
|
||||
$askedScore = $rankPintArr[$topRanking-1];
|
||||
//一个玩家的赛后积分 = 赛前积分+K*(胜负率-总胜率)+2K*(表现分-段位要求的及格分)
|
||||
//一个玩家的赛后积分 = 赛前积分+K/2*(MAX(胜负率-总胜率,0))+K*(表现分-段位要求的及格分) 新
|
||||
$meta2 = mt\Parameter::getByName('rank_k');
|
||||
$K = $meta2 ? $meta2['param_value'] : 40; //************** parameter 参数表获取 ************
|
||||
$K = mt\Parameter::getVal('rank_k',40); //************** parameter 参数表获取 ************
|
||||
$battleAfterScore = $userDb['score'] + $K/2 * max(($winRate-$winRateSum),0) + ($K) * ($expreScore-$askedScore);
|
||||
return round($battleAfterScore);
|
||||
}
|
||||
@ -382,14 +363,12 @@ class FormulaService extends BaseService {
|
||||
public static function calcUserEloValue($userDb,$params,$winningPro){
|
||||
/**一个玩家的赛后ELO值 = MAX(赛前ELO值+K*(胜负率-总胜率),150)*/
|
||||
//胜负率=1-(排名-1)/(最大排名-1)
|
||||
$ranked = getXVal($params, 'ranked');
|
||||
$meta1 = mt\Parameter::getByName('rank_order_max');
|
||||
$maxRanked = $meta1 ? $meta1['param_value'] : 40; //************** parameter 参数表获取 ************
|
||||
$ranked = getXVal($params, 'pvp_personal_rank');
|
||||
$maxRanked = mt\Parameter::getVal('rank_order_max',40); //************** parameter 参数表获取 ************
|
||||
$winRate = 1-($ranked-1)/($maxRanked-1);
|
||||
//总胜率=70%*P(个人ELO值-敌队平均ELO值)+30%*P(己队平均ELO值-敌队平均ELO值) --> P(D)=1/(1+10^(-D/400))
|
||||
$winRateSum = $winningPro;
|
||||
$meta2 = mt\Parameter::getByName('rank_k');
|
||||
$K = $meta2 ? $meta2['param_value'] : 40; //************** parameter 参数表获取 ************
|
||||
$K = mt\Parameter::getVal('rank_k',40); //************** parameter 参数表获取 ************
|
||||
return round(max($userDb['elo']+$K*($winRate-$winRateSum),150));
|
||||
}
|
||||
|
||||
|
@ -6,17 +6,21 @@ require_once('mt/Rank.php');
|
||||
require_once('mt/Season.php');
|
||||
require_once('models/User.php');
|
||||
require_once('models/Season.php');
|
||||
require_once('models/RealtimeData.php');
|
||||
require_once('services/PropertyChgService.php');
|
||||
|
||||
use mt;
|
||||
use models\User;
|
||||
use models\Season;
|
||||
use models\RealtimeData;
|
||||
|
||||
class SeasonService extends BaseService {
|
||||
class SeasonService extends BaseService
|
||||
{
|
||||
|
||||
public function checkSeason($userInfo,$awardService,$propertyService)
|
||||
public function checkSeason($userInfo, $awardService, $propertyService)
|
||||
{
|
||||
$currSeasonMeta = mt\RankSeason::getCurrentSeason();
|
||||
if ($currSeasonMeta && $userInfo['last_season_id'] > 0 && $currSeasonMeta['id'] > $userInfo['last_season_id'] ){
|
||||
if ($currSeasonMeta && $userInfo['last_season_id'] > 0 && $currSeasonMeta['id'] > $userInfo['last_season_id']) {
|
||||
$currRankMeta = mt\Rank::getRankById($userInfo['rank']);
|
||||
$dropRankMeta = mt\Rank::getRankById($currRankMeta ? $currRankMeta['next_season'] : 1);
|
||||
|
||||
@ -29,7 +33,7 @@ class SeasonService extends BaseService {
|
||||
'last_season_id' => $currSeasonMeta['id'],
|
||||
));
|
||||
}
|
||||
myself()->_addItems($award,$awardService,$propertyService);
|
||||
myself()->_addItems($award, $awardService, $propertyService);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@ -37,11 +41,12 @@ class SeasonService extends BaseService {
|
||||
|
||||
|
||||
//赛季结束后奖励及重置排位段位
|
||||
public function seasonAward($userInfo){
|
||||
public function seasonAward($userInfo)
|
||||
{
|
||||
$currRankMeta = mt\Rank::getRankById($userInfo['rank']);
|
||||
$dropRankMeta = mt\Rank::getRankById($currRankMeta ? $currRankMeta['next_season'] : 1);
|
||||
$award =array();
|
||||
if ($currRankMeta){
|
||||
$award = array();
|
||||
if ($currRankMeta) {
|
||||
$award = Season::seasonReward($currRankMeta);
|
||||
if ($dropRankMeta) {
|
||||
myself()->_updateUserInfo(array(
|
||||
@ -53,5 +58,44 @@ class SeasonService extends BaseService {
|
||||
return $award;
|
||||
}
|
||||
|
||||
public function resetRankGainAward()
|
||||
{
|
||||
// $currSeasonMeta = mt\RankSeason::getCurrentSeason();
|
||||
// $season = RealtimeData::getRankSeason();
|
||||
// if ($currSeasonMeta && $currSeasonMeta['id'] > $season) {
|
||||
// $rows = myself()->_getMysql('')->execQuery(
|
||||
// 'SELECT * FROM t_user ' .
|
||||
// 'WHERE score_modifytime <> createtime'
|
||||
// );
|
||||
// if (count($rows) < 1){
|
||||
// error_log("resetRankGainAward : No user participates in the ranking");
|
||||
// die;
|
||||
// }
|
||||
// foreach ($rows as $row){
|
||||
// $currRankMeta = mt\Rank::getRankById($row['rank']);
|
||||
// if (! $currRankMeta){
|
||||
// error_log("resetRankGainAward : rankRank@rankRank.php field rank error" . json_encode($row));
|
||||
// continue;
|
||||
// }
|
||||
// $dropRankMeta = mt\Rank::getRankById($currRankMeta['next_season']);
|
||||
// if (! $dropRankMeta){
|
||||
// error_log("resetRankGainAward : rankRank@rankRank.php field next_season error" . json_encode($row));
|
||||
// continue;
|
||||
// }
|
||||
// $award = Season::seasonReward($currRankMeta);
|
||||
// myself()->switchAccount($row['account_id']);
|
||||
// $propertyChgService = new PropertyChgService();
|
||||
// myself()->_addItems($award, null, $propertyChgService);
|
||||
// myself()->_updateUserInfo(array(
|
||||
// 'last_season_id' => $currSeasonMeta['id'],
|
||||
// 'rank' => $dropRankMeta['id'],
|
||||
// 'score' => $dropRankMeta['rank_score'],
|
||||
// ));
|
||||
// }
|
||||
// error_log("Battle Ranking : Season ".$season." Settlement Success !");
|
||||
// RealtimeData::setRankSeason($currSeasonMeta['id']);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -445,12 +445,14 @@ class TameBattleDataService extends BaseService {
|
||||
|
||||
$newRank = $this->userInfo['rank'];
|
||||
$newScore = $this->userInfo['score'];
|
||||
$newElo = $this->userInfo['elo'];
|
||||
|
||||
if ($pvp_mode == self::MATCH_MODE_RANK){
|
||||
myself()->_setV(TN_LAST_RANKING_TIME,0,getXVal($this->battleInfo,'game_time', 0));
|
||||
$winningPro = $this->celWinningPro($this->userInfo);
|
||||
if ($winningPro){
|
||||
|
||||
$newElo = FormulaService::calcUserEloValue($this->userInfo,$this->battleInfo,$winningPro); //赛后elo积分
|
||||
$newScore = FormulaService::calcBattleAfterRankScore($this->userInfo,$this->battleInfo,$winningPro); //赛后排位积分
|
||||
//黄金以下段位,失败时不扣积分
|
||||
if ($newScore < $this->userInfo['score'] && $this->userInfo['score']< 1300){
|
||||
@ -482,6 +484,8 @@ class TameBattleDataService extends BaseService {
|
||||
"pve_kill_boss" => getXVal($this->battleInfo,'pve_boss_killed', 0),
|
||||
"pve_instance_id" => getXVal($this->allInfo,'pve_instance_id', 0),
|
||||
// "pve_instance_mode" => getXVal($this->allInfo,'pve_instance_mode', 0),
|
||||
"old_elo" => $this->userInfo['elo'],
|
||||
"new_elo" => $newElo,
|
||||
);
|
||||
BattleSettlement::addSingle($battleUuid,$roomUuid,$data);
|
||||
}
|
||||
@ -540,17 +544,22 @@ class TameBattleDataService extends BaseService {
|
||||
$newRank = 0;
|
||||
$oldScore = 0;
|
||||
$newScore = 0;
|
||||
$oldElo = 0;
|
||||
$newElo = 0;
|
||||
$userDb = User::find(getXVal($info,'account_id', 0));
|
||||
if ($userDb){
|
||||
$oldRank = $userDb['rank'];
|
||||
$newRank = $userDb['rank'];
|
||||
$oldScore = $userDb['score'];
|
||||
$newScore = $userDb['score'];
|
||||
$oldElo = $userDb['elo'];
|
||||
$newElo = $userDb['elo'];
|
||||
if ($pvp_mode == self::MATCH_MODE_RANK){
|
||||
$heroDb = Hero::findByAccountId(getXVal($info,'account_id', 0),getXVal($info,'hero_uniid', 0));
|
||||
if ($heroDb){
|
||||
$winningPro = $this->celWinningPro($userDb);
|
||||
if ($winningPro){
|
||||
$newElo = FormulaService::calcUserEloValue($userDb,$info,$winningPro); //赛后elo积分
|
||||
$newScore = FormulaService::calcBattleAfterRankScore($userDb,$info,$winningPro); //赛后排位积分
|
||||
//黄金以下段位,失败时不扣积分
|
||||
if ($newScore < $userDb['score'] && $userDb['score']< 1300){
|
||||
@ -577,6 +586,8 @@ class TameBattleDataService extends BaseService {
|
||||
'new_rank'=> $newRank,
|
||||
'old_score'=> $oldScore,
|
||||
'new_score'=> $newScore,
|
||||
'old_elo'=> $oldElo,
|
||||
'new_elo'=> $newElo,
|
||||
'pvp_kill'=> getXVal($info,'pvp_kill', 0),
|
||||
'pvp_damage'=> getXVal($info,'pvp_damage', 0),
|
||||
'pvp_assist'=> getXVal($info,'pvp_assist', 0),
|
||||
|
Loading…
x
Reference in New Issue
Block a user