diff --git a/webapp/controller/BattleController.class.php b/webapp/controller/BattleController.class.php index eb9103fd..16a51fd2 100644 --- a/webapp/controller/BattleController.class.php +++ b/webapp/controller/BattleController.class.php @@ -1,10 +1,12 @@ $member['account_id'], 'session_id' => $member['session_id'], 'hero_uniid' => $member['hero_uniid'], + 'weapon_uniid1' => $member['weapon_uniid1'], + 'weapon_uniid2' => $member['weapon_uniid2'], 'battle_uuid' => $member['battle_uuid'], 'hero_dto' => '', + 'weapon_dto1' => '', + 'weapon_dto2' => '', 'is_valid_battle' => 0, 'payload' => json_encode($member['cmjoin']), @@ -64,13 +70,25 @@ class BattleController extends BaseAuthedController { $info['errcode'] = 50; $info['errmsg'] = 'invalid session_id'; } else { - $heroDb = Hero::findByAccountId($member['account_id'], $member['hero_uniid']); - if ($heroDb) { - $info['is_valid_battle'] = 1; - $info['hero_dto'] = json_encode(Hero::toDto($heroDb)); - } else { - $info['errcode'] = 51; - $info['errmsg'] = 'paramater error'; + { + $heroDb = Hero::findByAccountId($member['account_id'], + $member['hero_uniid']); + if ($heroDb) { + $info['is_valid_battle'] = 1; + $info['hero_dto'] = json_encode(Hero::toDto($heroDb)); + } 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); diff --git a/webapp/models/Gun.php b/webapp/models/Gun.php index ecf254ca..e7a6f040 100644 --- a/webapp/models/Gun.php +++ b/webapp/models/Gun.php @@ -41,13 +41,23 @@ class Gun extends BaseModel { return $row; } + public static function findByAccountId($accountId, $gunUniId) + { + return self::internalFind($accountId, $gunUniId); + } + public static function findByUniId($gunUniId) + { + return self::internalFind(myself()->_getAccountId(), $gunUniId); + } + + private static function internalFind($accountId, $gunUniId) { $row = SqlHelper::ormSelectOne( - myself()->_getSelfMysql(), + myself()->_getMysql($accountId), 't_gun', array( - 'account_id' => myself()->_getAccountId(), + 'account_id' => $accountId, 'idx' => $gunUniId, ) );