Merge branch 'hjb' of git.kingsome.cn:server/game2006api into hjb

This commit is contained in:
hujiabin 2024-04-16 16:06:20 +08:00
commit d45b7f6647
2 changed files with 61 additions and 0 deletions

View File

@ -252,9 +252,66 @@ class BattleController extends BaseAuthedController {
}
}
$this->switchAccount(getReqVal('account_id', 0));
$this->updateRecentBattle($input['team_list']);
$this->_rspOk();
}
private function updateRecentBattle($teamList)
{
$realPlayerHash = array();
$realPlayerHashCopy = array();
foreach ($teamList as $team) {
foreach ($team['members'] as $member) {
if (!myself()->_isAndroidAccountId($member['account_id'])) {
$realPlayerHash[$member['account_id']] = 1;
$realPlayerHashCopy[$member['account_id']] = 1;
}
}
}
error_log(json_encode($realPlayerHash));
$accountIdPair = array();
foreach ($realPlayerHash as $accountId => $val) {
foreach ($realPlayerHashCopy as $accountIdCopy => $valCopy) {
if ($accountId != $accountIdCopy) {
$accountId1 = $accountId;
$accountId2 = $accountIdCopy;
if ($accountId > $accountIdCopy) {
$accountId1 = $accountIdCopy;
$accountId2 = $accountId;
}
$key = $accountId . '|' . $accountId2;
if (!array_key_exists($key, $accountIdPair)) {
$accountIdPair[$key] = array($accountId1, $accountId2);
}
}
}
}
error_log(json_encode($accountIdPair));
$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,
)
);
}
}
/*
http post
php://input

View File

@ -457,8 +457,10 @@ class UserController extends BaseAuthedController {
public function getMapConf()
{
$modeId = getReqVal('mode_id', 0);
$mapId = getReqVal('map_id', 0);
$mapInfo = array(
'mode_id' => $modeId,
'map_id' => 0,
'is_moba' => 0,
'is_open' => 0
@ -474,8 +476,10 @@ class UserController extends BaseAuthedController {
public function getBattleInfo()
{
$modeId = getReqVal('mode_id', 0);
$mapId = getReqVal('map_id', 0);
$mapInfo = array(
'mode_id' => $modeId,
'map_id' => 0,
'is_moba' => 0,
'is_open' => 0