|
@@ -185,11 +185,11 @@ class PVPProc {
|
|
|
my_Assert(CommUtil::isPropertyExists($pvp->curShopItems, $index), ErrCode::err_innerfault); # 没有找到改商品
|
|
|
// isEditor() && $citem = new \sm_pvp_shop();
|
|
|
$citem = $pvp->curShopItems->$index; # 查询物品数据
|
|
|
- my_Assert($citem->sealed == 0, ErrCode::pvp_item_soldout); # 防御道具已售罄
|
|
|
+ my_Assert($citem->sold == 0, ErrCode::pvp_item_soldout); # 防御道具已售罄
|
|
|
// var_dump($citem);
|
|
|
my_Assert($citem->priceType == 5, ErrCode::pay_price_err); # 防御定价异常
|
|
|
my_Assert($pvp->pvpCoins > $citem->price, ErrCode::pvp_coinnotenough); # pvp币不足
|
|
|
- $citem->sealed += 1; # 设置已售罄/已购买标志
|
|
|
+ $citem->sold += 1; # 设置已售罄/已购买标志
|
|
|
$pvp->pvpCoins -= $citem->price; # 扣除竞技币
|
|
|
StoreProc::AddMultiItemInStore($req, $citem->goods); // 发放道具
|
|
|
$req->userInfo->game->pvp = $pvp; // 回写数据
|
|
@@ -206,7 +206,7 @@ class PVPProc {
|
|
|
$pvp = new UserPVPModel($req->userInfo->game->pvp);
|
|
|
$costCash = glc()->PVP_shop_refresh_cash;
|
|
|
my_Assert(UserGameModel::Consume_Cash($req->userInfo->game, $costCash), ErrCode::notenough_cash_msg);
|
|
|
- $pvp->shopRefreshTs = now() + glc()->PVP_shop_refresh_interval; # 更新刷新时间
|
|
|
+// $pvp->shopRefreshTs = now() + glc()->PVP_shop_refresh_interval; # 更新刷新时间
|
|
|
$pvp->curShopItems = GameConfig::pvp_shop(); # 重刷道具
|
|
|
$req->userInfo->game->pvp = $pvp; # 回写
|
|
|
UserProc::updateUserInfo(); # 回写玩家数据
|
|
@@ -316,7 +316,7 @@ class PVPProc {
|
|
|
$req->userInfo->game->pvp = $pvp;
|
|
|
UserProc::updateUserInfo(); # 回写数据
|
|
|
$ret = array(
|
|
|
- 'curMatches' => $pvp->curMatches # # 当前对手清单
|
|
|
+ 'curMatches' => my_null_default($pvp->curMatches, array()), # # 当前对手清单
|
|
|
);
|
|
|
return Resp::ok($ret);
|
|
|
}
|
|
@@ -351,11 +351,13 @@ class PVPProc {
|
|
|
$R_A = intval($RA + $K * ($SA - $EA )); # 我的最终积分
|
|
|
$R_B = intval($RB + $K * ($SB - $EB)); # 对手的最终积分
|
|
|
#
|
|
|
+ $myOldRank = self::_getRank_by_uid($uid, $key); # 记录下战前排名
|
|
|
self::_addScore_by_uid($zoneid, $uid, $R_A - $RA); # 更新A的积分
|
|
|
$B_Change = $result ? $R_B - $RB : 0; # 计算对方的积分变化:对方输了的情况下扣分,我输了的情况下,不加分
|
|
|
if ($B_Change != 0) { #
|
|
|
self::_addScore_by_uid($zoneid, $target_uid, $B_Change); # 更新B的积分
|
|
|
}
|
|
|
+ $myNewRank = self::_getRank_by_uid($uid, $key); # 查询战后排名
|
|
|
$req->userInfo->game->pvp = $pvp;
|
|
|
UserProc::updateUserInfo(); # 回写数据
|
|
|
// 写挑战记录
|
|
@@ -371,6 +373,7 @@ class PVPProc {
|
|
|
'RB' => $RB, # # 对手挑战之前积分
|
|
|
'R_A' => $R_A, # # 自己最新积分
|
|
|
'R_B' => $R_B, # # 对手最新积分
|
|
|
+ 'rank_diff' => $myOldRank - $myOldRank, # # 自己的排名变化
|
|
|
);
|
|
|
return Resp::ok($ret); # 返回
|
|
|
}
|
|
@@ -556,7 +559,7 @@ class PVPProc {
|
|
|
$mem = gMem();
|
|
|
$r = $mem->zrevrank($key, $uid);
|
|
|
if (!is_null($r)) {
|
|
|
- $rank = $r; # 有名次,更新
|
|
|
+ $rank = $r + 1; # 有名次,更新(zset从0开始排序)
|
|
|
}
|
|
|
return $rank; # 返回
|
|
|
}
|