|
@@ -605,22 +605,15 @@ class FightProc {
|
|
|
public static function Ranking_MainGateIndex($maxGateIndex) {
|
|
|
$memKey = MemKey_GameRun::Rank_MainGateIndex_Zone_zset(req()->zoneid);
|
|
|
$mem = gMem();
|
|
|
-
|
|
|
- $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);
|
|
|
+
|
|
|
+ $uid = req()->uid;
|
|
|
+ $score = self::GetRankUid($uid, 1);
|
|
|
+ if($maxGateIndex > $score){
|
|
|
+ $arr = array();
|
|
|
+ $arr["$uid"] = $maxGateIndex*10000000000000000 + 9999999999999 - now();
|
|
|
+ $mem->zadd($memKey, $arr);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
$length = $mem->zlen($memKey);
|
|
|
if ($length > glc()->Rank_MainGateIndex_OnListRank) {
|
|
|
$num = $length - glc()->Rank_MainGateIndex_OnListRank;
|
|
@@ -635,20 +628,15 @@ class FightProc {
|
|
|
public static function Ranking_FightPower() {
|
|
|
$memKey = MemKey_GameRun::Rank_FightPower_Zone_zset(req()->zoneid);
|
|
|
$mem = gMem();
|
|
|
-
|
|
|
- $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];
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
+ $uid = req()->uid;
|
|
|
+
|
|
|
+ $score = self::GetRankUid($uid, 2);
|
|
|
$power = self::countUserFightPower();
|
|
|
- if ($power > $lastPower) {
|
|
|
- $arr2["$uid"] = $power;
|
|
|
- $mem->zadd($memKey, $arr2);
|
|
|
+ if ($power > $score) {
|
|
|
+ $arr = array();
|
|
|
+ $arr["$uid"] = $power*10000000000000000 + 9999999999999 - now();
|
|
|
+ $mem->zadd($memKey, $arr);
|
|
|
self::IsAchievedFightPower_PassReward($power);
|
|
|
}
|
|
|
|
|
@@ -661,21 +649,16 @@ class FightProc {
|
|
|
|
|
|
public static function GetRankUid($uid_rank, $type) {
|
|
|
if ($type == 1) {
|
|
|
- $dic = gMem()->zrevrange(MemKey_GameRun::Rank_MainGateIndex_Zone_zset(req()->zoneid), 0, glc()->Rank_MainGateIndex_OnListRank, true);
|
|
|
+ $score = gMem()->zscore(MemKey_GameRun::Rank_MainGateIndex_Zone_zset(req()->zoneid), $uid_rank);
|
|
|
} else {
|
|
|
- $dic = gMem()->zrevrange(MemKey_GameRun::Rank_FightPower_Zone_zset(req()->zoneid), 0, glc()->Rank_FightPower_OnListRank, true);
|
|
|
+ $score = gMem()->zscore(MemKey_GameRun::Rank_MainGateIndex_Zone_zset(req()->zoneid), $uid_rank);
|
|
|
}
|
|
|
-
|
|
|
- $arr = array();
|
|
|
- foreach ($dic as $uid => $score) {
|
|
|
- $strUid = explode('-', $uid);
|
|
|
- if ($strUid[1] == $uid_rank) {
|
|
|
- $arr[] = $uid;
|
|
|
- $arr[] = $score;
|
|
|
- break;
|
|
|
- }
|
|
|
+
|
|
|
+ if($score == null){
|
|
|
+ $score = 0;
|
|
|
}
|
|
|
- return $arr;
|
|
|
+
|
|
|
+ return intval($score / 10000000000000000);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -718,7 +701,7 @@ class FightProc {
|
|
|
$retArr = array();
|
|
|
if (count($list) > 0) {
|
|
|
foreach ($list as $uid => $score) {
|
|
|
- $rankInfo = self::initOtherUidRankInfo($uid, $score, $type);
|
|
|
+ $rankInfo = self::initOtherUidRankInfo($uid, $score, $type,true);
|
|
|
if ($rankInfo->uid == req()->uid) {
|
|
|
$selfIsHasRank = 1;
|
|
|
$selfRank = $rankInfo;
|
|
@@ -728,10 +711,8 @@ class FightProc {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if ($selfRank == null) {
|
|
|
- $index = 9999999999 - now();
|
|
|
- $uid = $index . "-" . req()->uid;
|
|
|
- $selfRank = self::initOtherUidRankInfo($uid, $selfExtraInfo, $type);
|
|
|
+ if ($selfRank == null) {
|
|
|
+ $selfRank = self::initOtherUidRankInfo(req()->uid, $selfExtraInfo, $type);
|
|
|
}
|
|
|
|
|
|
UserProc::updateUserInfo();
|
|
@@ -750,7 +731,7 @@ class FightProc {
|
|
|
* @param type $score
|
|
|
* @return \loyalsoft\Ins_rank
|
|
|
*/
|
|
|
- static function initOtherUidRankInfo($uid, $score, $type = null) {
|
|
|
+ static function initOtherUidRankInfo($uid, $score, $type = null,$isToRank = false) {
|
|
|
$ins_rank = new Ins_rank();
|
|
|
|
|
|
if ($type == 1) {
|
|
@@ -762,15 +743,17 @@ class FightProc {
|
|
|
if ($lv == null) {
|
|
|
$lv = 0;
|
|
|
}
|
|
|
-
|
|
|
- $strUid = explode('-', $uid);
|
|
|
+
|
|
|
$ins_rank->rank = $lv + 1;
|
|
|
- $ins_rank->uid = $strUid[1];
|
|
|
- $userInfo = UserProc::getUserGame(req()->zoneid, $strUid[1]);
|
|
|
+ $ins_rank->uid = $uid;
|
|
|
+ $userInfo = UserProc::getUserGame(req()->zoneid, $uid);
|
|
|
$ins_rank->name = $userInfo->baseInfo->name;
|
|
|
- $ins_rank->headImg = $userInfo->baseInfo->headImg;
|
|
|
-
|
|
|
- $ins_rank->score = $score;
|
|
|
+ $ins_rank->headImg = $userInfo->baseInfo->headImg;
|
|
|
+ $ret = intval($score / 10000000000000000);
|
|
|
+ if(!$isToRank){
|
|
|
+ $ret = $score;
|
|
|
+ }
|
|
|
+ $ins_rank->score = $ret;
|
|
|
return $ins_rank;
|
|
|
}
|
|
|
|
|
@@ -965,9 +948,8 @@ class FightProc {
|
|
|
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) {
|
|
|
+ foreach ($dic1 as $uid => $score) {
|
|
|
+ if ($uid == $uid2) {
|
|
|
$key1 = $uid;
|
|
|
break;
|
|
|
}
|
|
@@ -975,9 +957,8 @@ class FightProc {
|
|
|
|
|
|
$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) {
|
|
|
+ foreach ($dic2 as $uid => $score) {
|
|
|
+ if ($uid == $uid2) {
|
|
|
$key2 = $uid;
|
|
|
break;
|
|
|
}
|