diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index 222a4c3f..18beea33 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -268,6 +268,7 @@ class BattleController extends BaseAuthedController { } } } + $accountIdPair = array(); foreach ($realPlayerHash as $accountId) { foreach ($realPlayerHashCopy as $accountIdCopy) { if ($accountId != $accountIdCopy) { @@ -277,9 +278,36 @@ class BattleController extends BaseAuthedController { $accountId1 = $accountIdCopy; $accountId2 = $accountId; } + $key = $accountId . '|' . $accountId2; + if (!array_key_exists($key, $accountIdPair)) { + $accountIdPair[$key] = array($accountId1, $accountId2); + } } } } + $nowTime = myself()->_getNowTime(); + foreach ($accountIdPair as $pair) { + $accountId1 = $pair[0]; + $accountId2 = $pair[1]; + SqlHelper::Upsert( + myself()->__getRelationDbMysql(), + 't_recent_battle', + array( + 'account_id1' => $accountId1, + 'account_id2' => $accountId2, + ), + array( + 'last_battle_time' => $nowTime, + ), + array( + 'account_id1' => $accountId1, + 'account_id2' => $accountId2, + 'last_battle_time' => $nowTime, + 'createtime' => $nowTime, + 'modifytime' => $nowTime, + ) + ); + } } /*