This commit is contained in:
aozhiwei 2021-12-03 15:29:49 +08:00
parent b70939b293
commit 3c35abb402
2 changed files with 85 additions and 43 deletions

View File

@ -44,6 +44,17 @@ CREATE TABLE `t_user` (
`last_season_id` int(11) NOT NULL DEFAULT '0' COMMENT '最后一次赛季id', `last_season_id` int(11) NOT NULL DEFAULT '0' COMMENT '最后一次赛季id',
`activated` int(11) NOT NULL DEFAULT '0' COMMENT '是否已激活', `activated` int(11) NOT NULL DEFAULT '0' COMMENT '是否已激活',
`activatetime` int(11) NOT NULL DEFAULT '0' COMMENT '激活时间', `activatetime` int(11) NOT NULL DEFAULT '0' COMMENT '激活时间',
`total_battle_times` int(11) NOT NULL DEFAULT '0' COMMENT '总战斗次数',
`total_win_times` int(11) NOT NULL DEFAULT '0' COMMENT '总胜利次数',
`total_kills_times` int(11) NOT NULL DEFAULT '0' COMMENT '总击杀数',
`max_kills_times` int(11) NOT NULL DEFAULT '0' COMMENT '最高击杀数',
`total_damage_out` bigint NOT NULL DEFAULT '0' COMMENT '总伤害输出',
`max_damage_out` bigint NOT NULL DEFAULT '0' COMMENT '最高伤害输出',
`total_damage_in` bigint NOT NULL DEFAULT '0' COMMENT '总伤害输入',
`total_recover_hp` bigint NOT NULL DEFAULT '0' COMMENT '总治疗量',
`max_recover_hp` bigint NOT NULL DEFAULT '0' COMMENT '最高治疗量',
`total_alive_time` bigint NOT NULL DEFAULT '0' COMMENT '总存活时间',
`max_alive_time` bigint NOT NULL DEFAULT '0' COMMENT '最高存活时间',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`), PRIMARY KEY (`idx`),

View File

@ -25,50 +25,86 @@ class BattleController extends BaseAuthedController {
{ {
$userInfo = $this->_getOrmUserInfo(); $userInfo = $this->_getOrmUserInfo();
if (!$userInfo) { if (!$userInfo) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家1'); $this->_rspErr(1, '没有这个玩家1');
return; return;
} }
$this->oldBattleReport($userInfo); $this->updateUserBaseInfo($userInfo);
$this->updateSeason($userInfo);
$this->updateMission($userInfo);
$this->_rspOk();
} }
private function oldBattleReport($userInfo) private function updateUserBaseInfo($userInfo)
{ {
$map_id = isset($_REQUEST['map_id']) ? $_REQUEST['map_id'] : 0; $fieldsKv = array(
$map_tpl_name = isset($_REQUEST['map_tpl_name']) ? $_REQUEST['map_tpl_name'] : ''; 'total_battle_times' => function () {
$room_uuid = $_REQUEST['room_uuid']; //战斗id return 'total_battle_times + 1';
$map_name = $_REQUEST['map_name']; //地图名 },
$game_time = $_REQUEST['game_time']; //游戏结束时间 );
$hurt = $_REQUEST['hurt']; //承受伤害 if (getReqVal('rank', 0) == 1) {
$rank = $_REQUEST['rank']; //排名 $fieldsKv['total_win_times'] = function () {
$kills = $_REQUEST['kills']; //击杀数 return 'total_win_times + 1';
$harm = $_REQUEST['harm']; //伤害 };
$add_HP = $_REQUEST['add_HP']; //治疗量 }
$alive_time = $_REQUEST['alive_time']; //存活时间 $kills = getReqVal('kills', 0);
$team_status = $_REQUEST['team_status']; //是否是组队状态 if ($kills > 0) {
$snipe_kill = $_REQUEST['snipe_kill']; //狙击枪击杀数 $fieldsKv['total_kills_times'] = function () {
$rifle_kill = $_REQUEST['rifle_kill']; //步枪击杀数 return "total_kills_times + ${kills}";
$pistol_kill = $_REQUEST['pistol_kill']; //手枪击杀数 };
$submachine_kill = $_REQUEST['submachine_kill'];//冲锋枪击杀数 $fieldsKv['max_kills_times'] = function () {
$rescue_member = $_REQUEST['rescue_member']; //救起队友次数 return "GREATEST(max_kills_times, ${kills})";
$kill_his = $kills; };
$harm_his = $harm; }
$alive_time_his = $alive_time; $damageOut = getReqVal('damage_out', 0);
$add_HP_his = $add_HP; if ($damageOut > 0) {
$coin_num = $_REQUEST['coin_num']; //金币 $fieldsKv['total_damage_out'] = function () {
$integral = $_REQUEST['rank_score']; //排位积分 return "total_damage_out + ${damageOut}";
$score = $_REQUEST['pass_score']; //通行证积分 };
$fieldsKv['max_damage_out'] = function () {
return "GREATEST(max_damage_out, ${damageOut})";
};
}
$damageIn = getReqVal('damage_in', 0);
if ($damageIn > 0) {
$fieldsKv['total_damage_in'] = function () {
return "total_damage_in + ${damageIn}";
};
}
$recoverHp = getReqVal('recover_hp', 0);
if ($recoverHp > 0) {
$fieldsKv['total_recover_hp'] = function () {
return "total_recover_hp + ${recoverHp}";
};
$fieldsKv['max_recover_hp'] = function () {
return "GREATEST(max_recover_hp, ${recoverHp})";
};
}
$aliveTime = getReqVal('alive_time', 0);
if ($aliveTime > 0) {
$fieldsKv['total_alive_time'] = function () {
return "total_alive_time + ${aliveTime}";
};
$fieldsKv['max_alive_time'] = function () {
return "GREATEST(max_alive_time, ${aliveTime})";
};
}
if (count($fieldsKv) > 0) {
$this->_updateUserInfo($fieldsKv);
}
}
$nowDaySeconds = $this->_getNowDaySeconds(); private function updateSeason($userInfo)
if ($_REQUEST['items'] != '') { {
$item_list = splitStr1($_REQUEST['items']);
$addreward = new classes\AddReward(); }
$addreward->addReward((int)$item_list[0][0], (int)$item_list[0][1], $this->_getAccountId(), 0, 0);
} private function updateMission($userInfo)
{ {
$addreward = new classes\AddReward();
$val = $addreward->getVipVal($this->_getAccountId(), 1); }
$coin_num = floor($coin_num + $coin_num * $val / 100);
} private function old()
{
//更新击杀信息时间 //更新击杀信息时间
$k = 0; $k = 0;
if ($userInfo['game_times'] != 0) { if ($userInfo['game_times'] != 0) {
@ -170,14 +206,9 @@ class BattleController extends BaseAuthedController {
'sea_avg_kill' => function () use($kills) { 'sea_avg_kill' => function () use($kills) {
return "sea_avg_kill + ${kills}"; //?? return "sea_avg_kill + ${kills}"; //??
}, },
'newhand' => $newhand,
'newhand2' => $newhand2,
'game_times2' => $game_times2,
'first_fight' => 1, 'first_fight' => 1,
)); ));
$addreward = new classes\Addreward();
$vip_level = $addreward->getVipLevel($this->_getAccountId());
echo json_encode(array( echo json_encode(array(
'errcode' => 0, 'errcode' => 0,
'errmsg' => '', 'errmsg' => '',