查看战绩及详情
This commit is contained in:
parent
14885e8260
commit
536f0a4456
@ -27,7 +27,8 @@ class Battle(object):
|
||||
'url': 'webapp/index.php?c=Battle&a=getBattleHistory',
|
||||
'params': [
|
||||
_common.ReqHead(),
|
||||
['mode', '', ' 1:pvp 2:pve']
|
||||
['room_mode', '', ' 0:pvp 1:pve'],
|
||||
['pvp_mode', '', ' 0:匹配 1:排位']
|
||||
],
|
||||
'response': [
|
||||
_common.RspHead(),
|
||||
@ -41,7 +42,8 @@ class Battle(object):
|
||||
'url': 'webapp/index.php?c=Battle&a=showBattleHistory',
|
||||
'params': [
|
||||
_common.ReqHead(),
|
||||
['battle_uniid', '', ' 战斗唯一id']
|
||||
['battle_uuid', '', ' 战斗唯一id'],
|
||||
['room_uuid', '', ' 房间唯一id']
|
||||
],
|
||||
'response': [
|
||||
_common.RspHead(),
|
||||
|
@ -373,8 +373,12 @@ class BattleController extends BaseAuthedController {
|
||||
}
|
||||
|
||||
public function getBattleHistory(){
|
||||
$mode = getReqVal('mode', 0);
|
||||
$historyList = BattleHistory::orderBy(BattleHistory::getMyBattleHistoryByMode($mode),'desc');
|
||||
$room_mode = getReqVal('room_mode', 0);
|
||||
$pvp_mode = getReqVal('pvp_mode', 0);
|
||||
$singleList = BattleSettlement::getSingleList($room_mode,$pvp_mode);
|
||||
$historyList = BattleHistory::orderBy($singleList,'desc');
|
||||
// print_r($data);die;
|
||||
// $historyList = BattleHistory::orderBy(BattleHistory::getMyBattleHistoryByMode($mode),'desc');
|
||||
$data = array();
|
||||
foreach ($historyList as $k=>$history){
|
||||
if ($k < 20){
|
||||
@ -386,13 +390,19 @@ class BattleController extends BaseAuthedController {
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
public function showBattleHistory(){
|
||||
$battleUnid = getReqVal('battle_uniid', 0);
|
||||
if ( !$battleUnid){
|
||||
$battleUuid = getReqVal('battle_uuid', 0);
|
||||
$roomUuid = getReqVal('room_uuid', 0);
|
||||
if ( !$battleUuid){
|
||||
$this->_rspErr(1,'param error');
|
||||
return;
|
||||
}
|
||||
$row = BattleSettlement::find($battleUnid);
|
||||
if ( !$roomUuid){
|
||||
$this->_rspErr(1,'param error');
|
||||
return;
|
||||
}
|
||||
$row = BattleSettlement::findTeam($battleUuid,$roomUuid);
|
||||
if (!$row){
|
||||
$this->_rspErr(1,'param error');
|
||||
return;
|
||||
|
@ -141,12 +141,12 @@ class MissionController extends BaseAuthedController {
|
||||
$this->_rspErr(3, 'Mission objectives not achieved');
|
||||
return;
|
||||
}
|
||||
if ($missionMeta['condition'] == mt\Task::FINISHED_ALL_DAILY_MISSION_COND) {
|
||||
if (!$this->specMissionIsFinished($missionDto, $missionMeta)) {
|
||||
$this->_rspErr(3, 'Mission objectives not achieved');
|
||||
return;
|
||||
}
|
||||
}
|
||||
// if ($missionMeta['condition'] == mt\Task::FINISHED_ALL_DAILY_MISSION_COND) {
|
||||
// if (!$this->specMissionIsFinished($missionDto, $missionMeta)) {
|
||||
// $this->_rspErr(3, 'Mission objectives not achieved');
|
||||
// return;
|
||||
// }
|
||||
// }print_r($missionMeta);die;
|
||||
if ($missionDto['state'] != Mission::RECEIVEABLE_STATE) {
|
||||
$this->_rspErr(3, 'Unknown mission status');
|
||||
return;
|
||||
|
@ -7,41 +7,47 @@ use phpcommon\SqlHelper;
|
||||
|
||||
class BattleSettlement extends BaseModel
|
||||
{
|
||||
const ROOM_MODE_PVP = 0;
|
||||
// const MATCH_MODE_MATCH = 1;
|
||||
const ROOM_MODE_PVE = 1;
|
||||
|
||||
const MATCH_MODE_PVP = 0;
|
||||
const MATCH_MODE_RANK = 1;
|
||||
|
||||
public static function add($battleUuid, $data)
|
||||
{
|
||||
SqlHelper::upsert
|
||||
(myself()->_getSelfMysql(),
|
||||
't_battle_settlement',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'battle_uniid' => $battleUuid,
|
||||
),
|
||||
array(
|
||||
),
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'battle_uniid' => $battleUuid,
|
||||
'data' => $data,
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
)
|
||||
);
|
||||
(myself()->_getSelfMysql(),
|
||||
't_battle_settlement',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'battle_uniid' => $battleUuid,
|
||||
),
|
||||
array(),
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'battle_uniid' => $battleUuid,
|
||||
'data' => $data,
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public static function find($battleUuid)
|
||||
{
|
||||
$row = SqlHelper::ormSelectOne
|
||||
(myself()->_getSelfMysql(),
|
||||
't_battle_settlement',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'battle_uniid' => $battleUuid,
|
||||
)
|
||||
);
|
||||
(myself()->_getSelfMysql(),
|
||||
't_battle_settlement',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'battle_uniid' => $battleUuid,
|
||||
)
|
||||
);
|
||||
return $row;
|
||||
}
|
||||
|
||||
public static function addSingle($battleUuid,$roomUuid, $data)
|
||||
public static function addSingle($battleUuid, $roomUuid, $data)
|
||||
{
|
||||
SqlHelper::upsert
|
||||
(myself()->_getSelfMysql(),
|
||||
@ -50,8 +56,7 @@ class BattleSettlement extends BaseModel
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'battle_uuid' => $battleUuid,
|
||||
),
|
||||
array(
|
||||
),
|
||||
array(),
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
'battle_uuid' => $battleUuid,
|
||||
@ -63,7 +68,57 @@ class BattleSettlement extends BaseModel
|
||||
);
|
||||
}
|
||||
|
||||
public static function addTeam($battleUuid,$roomUuid, $data)
|
||||
public static function getSingleList($roomMode, $matchMode)
|
||||
{
|
||||
$rows = SqlHelper::ormSelect
|
||||
(myself()->_getSelfMysql(),
|
||||
't_battle_settlement_single',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
)
|
||||
);
|
||||
$pvpMatchList = array();
|
||||
$pvpRankList = array();
|
||||
$pveMatchList = array();
|
||||
foreach ($rows as $row) {
|
||||
$data = emptyReplace(json_decode($row['data'], true), array());
|
||||
if ($data['room_mode'] == self::ROOM_MODE_PVP && $data['pvp_mode'] == self::MATCH_MODE_PVP) {
|
||||
array_push($pvpMatchList, self::singleDto($row));
|
||||
} else if ($data['room_mode'] == self::ROOM_MODE_PVP && $data['pvp_mode'] == self::MATCH_MODE_RANK) {
|
||||
array_push($pvpRankList, self::singleDto($row));
|
||||
} else if ($data['room_mode'] == self::ROOM_MODE_PVE) {
|
||||
array_push($pveMatchList, self::singleDto($row));
|
||||
}
|
||||
}
|
||||
switch ($roomMode) {
|
||||
case self::ROOM_MODE_PVP :
|
||||
{
|
||||
switch ($matchMode) {
|
||||
case self::MATCH_MODE_PVP :
|
||||
{
|
||||
return $pvpMatchList;
|
||||
}
|
||||
case self::MATCH_MODE_RANK :
|
||||
{
|
||||
return $pvpRankList;
|
||||
}
|
||||
}
|
||||
}
|
||||
case self::ROOM_MODE_PVE :
|
||||
{
|
||||
return $pveMatchList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function singleDto($row){
|
||||
$data = emptyReplace(json_decode($row['data'], true), array());
|
||||
$data['room_uuid'] = $row['room_uuid'];
|
||||
$data['idx'] = $row['idx'];
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function addTeam($battleUuid, $roomUuid, $data)
|
||||
{
|
||||
SqlHelper::upsert
|
||||
(myself()->_getSelfMysql(),
|
||||
@ -72,8 +127,7 @@ class BattleSettlement extends BaseModel
|
||||
'battle_uuid' => $battleUuid,
|
||||
'room_uuid' => $roomUuid,
|
||||
),
|
||||
array(
|
||||
),
|
||||
array(),
|
||||
array(
|
||||
'battle_uuid' => $battleUuid,
|
||||
'room_uuid' => $roomUuid,
|
||||
@ -84,7 +138,8 @@ class BattleSettlement extends BaseModel
|
||||
);
|
||||
}
|
||||
|
||||
public static function findTeam($battleUuid,$roomUuid){
|
||||
public static function findTeam($battleUuid, $roomUuid)
|
||||
{
|
||||
$row = SqlHelper::ormSelectOne
|
||||
(myself()->_getSelfMysql(),
|
||||
't_battle_settlement_team',
|
||||
@ -96,4 +151,5 @@ class BattleSettlement extends BaseModel
|
||||
return $row;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user