1
This commit is contained in:
parent
66b404bc2f
commit
6a59eaf735
@ -1,10 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once('models/Hero.php');
|
require_once('models/Hero.php');
|
||||||
|
require_once('models/Gun.php');
|
||||||
require_once('services/BattleDataService.php');
|
require_once('services/BattleDataService.php');
|
||||||
|
|
||||||
use phpcommon\SqlHelper;
|
use phpcommon\SqlHelper;
|
||||||
use models\Hero;
|
use models\Hero;
|
||||||
|
use models\Gun;
|
||||||
|
|
||||||
class BattleController extends BaseAuthedController {
|
class BattleController extends BaseAuthedController {
|
||||||
|
|
||||||
@ -52,8 +54,12 @@ class BattleController extends BaseAuthedController {
|
|||||||
'account_id' => $member['account_id'],
|
'account_id' => $member['account_id'],
|
||||||
'session_id' => $member['session_id'],
|
'session_id' => $member['session_id'],
|
||||||
'hero_uniid' => $member['hero_uniid'],
|
'hero_uniid' => $member['hero_uniid'],
|
||||||
|
'weapon_uniid1' => $member['weapon_uniid1'],
|
||||||
|
'weapon_uniid2' => $member['weapon_uniid2'],
|
||||||
'battle_uuid' => $member['battle_uuid'],
|
'battle_uuid' => $member['battle_uuid'],
|
||||||
'hero_dto' => '',
|
'hero_dto' => '',
|
||||||
|
'weapon_dto1' => '',
|
||||||
|
'weapon_dto2' => '',
|
||||||
|
|
||||||
'is_valid_battle' => 0,
|
'is_valid_battle' => 0,
|
||||||
'payload' => json_encode($member['cmjoin']),
|
'payload' => json_encode($member['cmjoin']),
|
||||||
@ -64,13 +70,25 @@ class BattleController extends BaseAuthedController {
|
|||||||
$info['errcode'] = 50;
|
$info['errcode'] = 50;
|
||||||
$info['errmsg'] = 'invalid session_id';
|
$info['errmsg'] = 'invalid session_id';
|
||||||
} else {
|
} else {
|
||||||
$heroDb = Hero::findByAccountId($member['account_id'], $member['hero_uniid']);
|
{
|
||||||
if ($heroDb) {
|
$heroDb = Hero::findByAccountId($member['account_id'],
|
||||||
$info['is_valid_battle'] = 1;
|
$member['hero_uniid']);
|
||||||
$info['hero_dto'] = json_encode(Hero::toDto($heroDb));
|
if ($heroDb) {
|
||||||
} else {
|
$info['is_valid_battle'] = 1;
|
||||||
$info['errcode'] = 51;
|
$info['hero_dto'] = json_encode(Hero::toDto($heroDb));
|
||||||
$info['errmsg'] = 'paramater error';
|
} else {
|
||||||
|
$info['errcode'] = 51;
|
||||||
|
$info['errmsg'] = 'paramater error';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
for ($i = 1; $i <= 2; ++$i) {
|
||||||
|
$gunDb = Gun::findByAccountId($member['account_id'],
|
||||||
|
$member['weapon_uniid' . $i]);
|
||||||
|
if ($gunDb) {
|
||||||
|
$info['weapon_dto' . $i] = json_encode(Gun::toDto($gunDb));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
array_push($data['members'], $info);
|
array_push($data['members'], $info);
|
||||||
|
@ -41,13 +41,23 @@ class Gun extends BaseModel {
|
|||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function findByAccountId($accountId, $gunUniId)
|
||||||
|
{
|
||||||
|
return self::internalFind($accountId, $gunUniId);
|
||||||
|
}
|
||||||
|
|
||||||
public static function findByUniId($gunUniId)
|
public static function findByUniId($gunUniId)
|
||||||
|
{
|
||||||
|
return self::internalFind(myself()->_getAccountId(), $gunUniId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function internalFind($accountId, $gunUniId)
|
||||||
{
|
{
|
||||||
$row = SqlHelper::ormSelectOne(
|
$row = SqlHelper::ormSelectOne(
|
||||||
myself()->_getSelfMysql(),
|
myself()->_getMysql($accountId),
|
||||||
't_gun',
|
't_gun',
|
||||||
array(
|
array(
|
||||||
'account_id' => myself()->_getAccountId(),
|
'account_id' => $accountId,
|
||||||
'idx' => $gunUniId,
|
'idx' => $gunUniId,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user