|
@@ -705,12 +705,22 @@ class FightProc {
|
|
|
public static function Ranking_MainGateIndex($maxGateIndex) {
|
|
|
$memKey = MemKey_GameRun::Rank_MainGateIndex_Zone_zset(req()->zoneid);
|
|
|
$mem = gMem();
|
|
|
-
|
|
|
- $uid ="a-".req()->uid;
|
|
|
- $arr = array();
|
|
|
- $arr["$uid"] = $maxGateIndex;
|
|
|
- $mem->zadd($memKey, $arr);
|
|
|
-
|
|
|
+
|
|
|
+ $index = 9999999999- now();
|
|
|
+ $uid = $index."-".req()->uid;
|
|
|
+ $arr = self::GetRankUid(req()->uid, 1);
|
|
|
+ $gateId = 0;
|
|
|
+ if(count($arr) > 0){
|
|
|
+ $uid = $arr[0];
|
|
|
+ $gateId = $arr[1];
|
|
|
+ }
|
|
|
+
|
|
|
+ if($maxGateIndex > $gateId){
|
|
|
+ $arr2 = array();
|
|
|
+ $arr2["$uid"] = $maxGateIndex;
|
|
|
+ $mem->zadd($memKey, $arr2);
|
|
|
+ }
|
|
|
+
|
|
|
$length = $mem->zlen($memKey);
|
|
|
if ($length > glc()->Rank_MainGateIndex_OnListRank) {
|
|
|
$num = $length - glc()->Rank_MainGateIndex_OnListRank;
|
|
@@ -725,18 +735,20 @@ class FightProc {
|
|
|
public static function Ranking_FightPower() {
|
|
|
$memKey = MemKey_GameRun::Rank_FightPower_Zone_zset(req()->zoneid);
|
|
|
$mem = gMem();
|
|
|
- $uid = "a-".req()->uid;
|
|
|
- $arr = array();
|
|
|
- $power = self::countUserFightPower();
|
|
|
- $rankPower = gMem()->zscore($memKey, $uid);
|
|
|
-
|
|
|
- if ($rankPower == null) {
|
|
|
- $rankPower = 0;
|
|
|
- }
|
|
|
-
|
|
|
- if ($power > $rankPower) {
|
|
|
- $arr["$uid"] = $power;
|
|
|
- $mem->zadd($memKey, $arr);
|
|
|
+
|
|
|
+ $index = 9999999999- now();
|
|
|
+ $uid = $index."-".req()->uid;
|
|
|
+ $lastPower = 0;
|
|
|
+ $arr = self::GetRankUid(req()->uid,2);
|
|
|
+ if(count($arr) > 0){
|
|
|
+ $uid = $arr[0];
|
|
|
+ $lastPower = $arr[1];
|
|
|
+ }
|
|
|
+
|
|
|
+ $power = self::countUserFightPower();
|
|
|
+ if ($power > $lastPower) {
|
|
|
+ $arr2["$uid"] = $power;
|
|
|
+ $mem->zadd($memKey, $arr2);
|
|
|
self::IsAchievedFightPower_PassReward($power);
|
|
|
}
|
|
|
|
|
@@ -746,6 +758,26 @@ class FightProc {
|
|
|
$mem->zremrangebyrank($memKey, 0, $num - 1);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ public static function GetRankUid($uid_rank,$type) {
|
|
|
+ if($type == 1){
|
|
|
+ $dic = gMem()->zrevrangebyscore(MemKey_GameRun::Rank_MainGateIndex_Zone_zset(req()->zoneid), 0, glc()->Rank_MainGateIndex_OnListRank,true);
|
|
|
+ } else {
|
|
|
+ $dic = gMem()->zrevrangebyscore(MemKey_GameRun::Rank_FightPower_Zone_zset(req()->zoneid), 0, glc()->Rank_FightPower_OnListRank,true);
|
|
|
+ }
|
|
|
+
|
|
|
+ $arr = array();
|
|
|
+ foreach ($dic as $uid => $score) {
|
|
|
+ $strUid = explode('-', $uid);
|
|
|
+ if($strUid[1] == $uid_rank){
|
|
|
+ $arr[] = $uid;
|
|
|
+ $arr[] = $score;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return $arr;
|
|
|
+
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 6811 获取主线关卡排行榜信息
|
|
@@ -782,14 +814,12 @@ class FightProc {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- $selfRank = self::initOtherUidRankInfo(req()->uid, $selfExtraInfo, $type);
|
|
|
-
|
|
|
+
|
|
|
+ $selfRank = null;
|
|
|
$retArr = array();
|
|
|
if (count($list) > 0) {
|
|
|
- foreach ($list as $uid => $score) {
|
|
|
- $strUid = explode('-', $uid);
|
|
|
- $rankInfo = self::initOtherUidRankInfo($strUid[1], $score, $type);
|
|
|
+ foreach ($list as $uid => $score) {
|
|
|
+ $rankInfo = self::initOtherUidRankInfo($uid, $score, $type);
|
|
|
if ($rankInfo->uid == req()->uid) {
|
|
|
$selfIsHasRank = 1;
|
|
|
$selfRank = $rankInfo;
|
|
@@ -798,6 +828,12 @@ class FightProc {
|
|
|
$retArr[] = $rankInfo;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if($selfRank == null){
|
|
|
+ $index = 9999999999- now();
|
|
|
+ $uid = $index."-".req()->uid;
|
|
|
+ $selfRank = self::initOtherUidRankInfo($uid, $selfExtraInfo, $type);
|
|
|
+ }
|
|
|
|
|
|
UserProc::updateUserInfo();
|
|
|
$ret = array(
|
|
@@ -819,17 +855,19 @@ class FightProc {
|
|
|
$ins_rank = new Ins_rank();
|
|
|
|
|
|
if ($type == 1) {
|
|
|
- $lv = gMem()->zrevrank(MemKey_GameRun::Rank_MainGateIndex_Zone_zset(req()->zoneid), "a-".$uid);
|
|
|
+ $lv = gMem()->zrevrank(MemKey_GameRun::Rank_MainGateIndex_Zone_zset(req()->zoneid), $uid);
|
|
|
} else {
|
|
|
- $lv = gMem()->zrevrank(MemKey_GameRun::Rank_FightPower_Zone_zset(req()->zoneid), "a-".$uid);
|
|
|
+ $lv = gMem()->zrevrank(MemKey_GameRun::Rank_FightPower_Zone_zset(req()->zoneid),$uid);
|
|
|
}
|
|
|
|
|
|
if ($lv == null) {
|
|
|
$lv = 0;
|
|
|
}
|
|
|
+
|
|
|
+ $strUid = explode('-', $uid);
|
|
|
$ins_rank->rank = $lv + 1;
|
|
|
- $ins_rank->uid = $uid;
|
|
|
- $userInfo = UserProc::getUserGame(req()->zoneid, $uid);
|
|
|
+ $ins_rank->uid = $strUid[1];
|
|
|
+ $userInfo = UserProc::getUserGame(req()->zoneid, $strUid[1]);
|
|
|
$ins_rank->name = $userInfo->baseInfo->name;
|
|
|
$ins_rank->headImg = $userInfo->baseInfo->headImg;
|
|
|
|
|
@@ -981,9 +1019,33 @@ class FightProc {
|
|
|
* 删除排行榜内注销账号的玩家
|
|
|
*/
|
|
|
|
|
|
- public static function DeleteRankInvalidUser($uid) {
|
|
|
- gMem()->zrem(MemKey_GameRun::Rank_MainGateIndex_Zone_zset(req()->zoneid),"a-".$uid);
|
|
|
- gMem()->zrem(MemKey_GameRun::Rank_FightPower_Zone_zset(req()->zoneid), "a-".$uid);
|
|
|
+ public static function DeleteRankInvalidUser($uid2) {
|
|
|
+ $dic1 = gMem()->zrevrangebyscore(MemKey_GameRun::Rank_MainGateIndex_Zone_zset(req()->zoneid), 0, glc()->Rank_MainGateIndex_OnListRank,true);
|
|
|
+ $key1 = "";
|
|
|
+ foreach ($dic1 as $uid => $score) {
|
|
|
+ $strUid = explode('-', $uid);
|
|
|
+ if($strUid[1] == $uid2){
|
|
|
+ $key1 = $uid;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $dic2 = gMem()->zrevrangebyscore(MemKey_GameRun::Rank_FightPower_Zone_zset(req()->zoneid), 0, glc()->Rank_FightPower_OnListRank,true);
|
|
|
+ $key2 = "";
|
|
|
+ foreach ($dic2 as $uid => $score) {
|
|
|
+ $strUid = explode('-', $uid);
|
|
|
+ if($strUid[1] == $uid2){
|
|
|
+ $key2 = $uid;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if($key1 != ""){
|
|
|
+ gMem()->zrem(MemKey_GameRun::Rank_MainGateIndex_Zone_zset(req()->zoneid),$key1);
|
|
|
+ }
|
|
|
+ if($key1 != ""){
|
|
|
+ gMem()->zrem(MemKey_GameRun::Rank_FightPower_Zone_zset(req()->zoneid), $key2);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/*
|