This commit is contained in:
aozhiwei 2022-09-14 17:21:45 +08:00
parent 3655dd6ce9
commit 607625da33
2 changed files with 48 additions and 0 deletions

View File

@ -1,26 +1,48 @@
<?php
require_once('models/User.php');
require_once('mt/PveGemini.php');
use phpcommon\SqlHelper;
use models\User;
class TeamController extends BaseAuthedController {
const MATCH_MODE_NORMAL = 0;
const MATCH_MODE_RANK = 1;
const MATCH_MODE_PVE = 2;
public function createTeam()
{
$nodeId = getReqVal('node_id', 1);
$matchMode = getReqVal('match_mode', 0);
$pveInstanceId = getReqVal('pve_instance_id', 0);
$zid = myself()->_getZid();
$teamUuid = $nodeId . '_' .
$zid . '_' .
md5($this->_getAccountId() . $this->_getNowTime());
/*if (!in_array(array
(
self::MATCH_MODE_NORMAL,
self::MATCH_MODE_RANK,
self::MATCH_MODE_PVE,
),
$matchMode)) {
$this->_rspErr(1, 'match mode error');
return;
}*/
$userDb = $this->_getOrmUserInfo();
$userDto = User::info($userDb);
$userDto['createtime'] = $userDb['createtime'];
$teamDb = array(
'team_uuid' => $teamUuid,
'state' => 0,
'payload' => '',
'match_mode' => $matchMode,
'pve_instance_id' => $pveInstanceId,
'slot_num' => 4,
'member_list' => array($userDto));
$r = $this->_getRedis($teamUuid);

26
webapp/mt/PveGemini.php Normal file
View File

@ -0,0 +1,26 @@
<?php
namespace mt;
use phpcommon;
class PveGemini {
const FIRST_INSTANCE_ID = 10001;
public static function get($id)
{
return array_key_exists($id, self::getMetaList()) ? self::getMetaList()[$id] : null;
}
protected static function getMetaList()
{
if (!self::$metaList) {
self::$metaList = getMetaTable('pveGemini@pveGemini.php');
}
return self::$metaList;
}
protected static $metaList;
}