保存战斗历史
This commit is contained in:
parent
52866a03e4
commit
0b854bbdf5
@ -641,4 +641,36 @@ CREATE TABLE `t_realtime_data` (
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Table structure for table `t_battle_history`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `t_battle_history`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `t_battle_history` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`battle_uniid` varchar(60) NOT NULL DEFAULT '' COMMENT '战斗记录唯一id',
|
||||
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '用户 account_id',
|
||||
`match_mode` int(11) NOT NULL DEFAULT '0' COMMENT '0: 匹配 pvp 1: 排位赛 2: pve',
|
||||
`team_mode` int(11) NOT NULL DEFAULT '0' COMMENT '队伍模式 0:单人 1:组队',
|
||||
`battle_rank` int(11) NOT NULL DEFAULT '0' COMMENT '战斗排名',
|
||||
`team_rank` int(11) NOT NULL DEFAULT '0' COMMENT '团队排名',
|
||||
`is_win` int(11) NOT NULL DEFAULT '0' COMMENT 'pve冒险是否胜利',
|
||||
`kills` int(11) NOT NULL DEFAULT '0' COMMENT '击杀数',
|
||||
`hero_id` int(11) NOT NULL DEFAULT '0' COMMENT '英雄 id',
|
||||
`weapon1` int(11) NOT NULL DEFAULT '0' COMMENT '枪械1 id',
|
||||
`weapon2` int(11) NOT NULL DEFAULT '0' COMMENT '枪械2 id',
|
||||
`battle_end_time` int(11) NOT NULL DEFAULT '0' COMMENT '战斗结束时间',
|
||||
`current_level_class` varchar(60) NOT NULL DEFAULT '0' COMMENT '当前用户段位',
|
||||
`current_level_class_score` int(11) NOT NULL DEFAULT '0' COMMENT '当前用户排位分',
|
||||
`level_class_score_chg` int(11) NOT NULL DEFAULT '0' COMMENT '排位分改变',
|
||||
`pve_rank_score` int(11) NOT NULL DEFAULT '0' COMMENT 'pve冒险积分',
|
||||
`pve_kill_boss` int(11) NOT NULL DEFAULT '0' COMMENT 'pve冒险是否击杀BOSS',
|
||||
`battle_foreign_key` int(11) NOT NULL DEFAULT '0' COMMENT '结算外键',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `account_id_battle_uniid` (`account_id`, `battle_uniid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
-- Dump completed on 2015-08-19 18:51:22
|
||||
|
31
webapp/models/BattleHistory.php
Normal file
31
webapp/models/BattleHistory.php
Normal file
@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace models;
|
||||
|
||||
use mt;
|
||||
use phpcommon\SqlHelper;
|
||||
class BattleHistory extends BaseModel
|
||||
{
|
||||
public static function add($data)
|
||||
{
|
||||
SqlHelper::insert
|
||||
(myself()->_getSelfMysql(),
|
||||
't_battle_history',
|
||||
$data
|
||||
);
|
||||
}
|
||||
|
||||
public static function getMyBattleHistory()
|
||||
{
|
||||
$row = SqlHelper::ormSelect(
|
||||
myself()->_getSelfMysql(),
|
||||
't_battle_history',
|
||||
array(
|
||||
'account_id' => myself()->_getAccountId(),
|
||||
)
|
||||
);
|
||||
return $row;
|
||||
}
|
||||
|
||||
}
|
@ -22,6 +22,7 @@ require_once('models/Hero.php');
|
||||
require_once('models/Gun.php');
|
||||
require_once('models/FragmentPool.php');
|
||||
require_once('models/RealtimeData.php');
|
||||
require_once('models/BattleHistory.php');
|
||||
|
||||
require_once('services/RankActivityService.php');
|
||||
require_once('services/FormulaService.php');
|
||||
@ -29,6 +30,7 @@ require_once('services/AwardService.php');
|
||||
require_once('services/PropertyChgService.php');
|
||||
require_once('services/LogService.php');
|
||||
|
||||
|
||||
use mt;
|
||||
use services;
|
||||
use phpcommon\SqlHelper;
|
||||
@ -39,6 +41,7 @@ use models\Hero;
|
||||
use models\Gun;
|
||||
use models\RealtimeData;
|
||||
use models\FragmentPool;
|
||||
use models\BattleHistory;
|
||||
use services\FormulaService;
|
||||
use services\LogService;
|
||||
|
||||
@ -133,6 +136,9 @@ class BattleDataService extends BaseService {
|
||||
$this->weapon2Dto['pve_ceg_uplimit'] : $this->weapon2Dto['pvp_ceg_uplimit'];
|
||||
}
|
||||
}
|
||||
//录入战斗记录
|
||||
$this->saveBattleHistory();
|
||||
|
||||
switch ($matchMode) {
|
||||
case self::MATCH_MODE_PVP:
|
||||
{
|
||||
@ -167,6 +173,30 @@ class BattleDataService extends BaseService {
|
||||
}
|
||||
}
|
||||
|
||||
private function saveBattleHistory(){
|
||||
$user = myself()->_getOrmUserInfo();
|
||||
$data = array(
|
||||
"battle_uniid" => getReqVal('battle_uniid', 0),
|
||||
"account_id" => myself()->_getAccountId(),
|
||||
"match_mode" => getReqVal('match_mode', 0),
|
||||
"team_mode" => getReqVal('team_mode', 0),
|
||||
"battle_rank" => getReqVal('ranked', 0),
|
||||
// "team_rank" => 0, // 队伍排名
|
||||
"is_win" => getReqVal('pve_kill_boss', 0),
|
||||
"kills" => getReqVal('kills', 0),
|
||||
"hero_id" => getReqVal('hero_uniid', 0),
|
||||
"weapon1" => getReqVal('weapon_uuid1', 0),
|
||||
"weapon2" => getReqVal('weapon_uuid2', 0),
|
||||
"battle_end_time" => myself()->_getNowTime(),
|
||||
"current_level_class" => $user['rank'],
|
||||
"current_level_class_score" => $user['score'],
|
||||
// "level_class_score_chg" => 0, // 排位分改变
|
||||
"pve_rank_score" => getReqVal('pve_rank_score', 0),
|
||||
"pve_kill_boss" => getReqVal('pve_kill_boss', 0),
|
||||
);
|
||||
BattleHistory::add($data);
|
||||
}
|
||||
|
||||
public function getReward()
|
||||
{
|
||||
return $this->reward;
|
||||
|
Loading…
x
Reference in New Issue
Block a user