safeGetOrmUserInfo(); if (!$userInfo) { $this->createNewUser($userName, $avatarUrl); $userInfo = $this->getOrmUserInfo(); } if (!$this->loginCheck($userInfo)) { $userInfo = $this->getOrmUserInfo(); } $this->rspData(array( 'info' => User::show($userInfo) )); } private function loginCheck($userInfo) { return true; } private function createNewUser($userName, $avatarUrl) { SqlHelper::upsert ($this->getSelfMysql(), 't_user', array( 'accountid' => $this->getAccountId() ), array( ), array( 'accountid' => $this->getAccountId(), 'name' => $userName, #'avatar_url' => $avatar_url, 'gold' => 10000, #'season_status' => 1, #'newInfo' => '', #'new_second_equip' => 2, 'head_frame' => 19003, 'sex' => 2, 'head_id' => 18001, 'hero_id' => 30100, #'integral' => 0, #'season_time' => mt\Season::getCurrSeasonTime(), #'team_name' => '', 'createtime' => $this->getNowTime(), 'modifytime' => $this->getNowTime(), ) ); { foreach (mt\Parameter::getListValue('creator_hero_id') as $heroId) { $heroMeta = mt\Player::get($heroId); if ($heroMeta) { $this->addHero($heroMeta); } } } { $this->addItem(array( array( 'item_id' => 16001, 'item_num' => 0, ) )); } } public function clientBattleReport() { $this->updateUserInfo(array( 'first_fight' => function () { return '1'; } )); $this->rspOk(); } public function battleReport() { $userInfo = $this->getOrmUserInfo(); if (!$userInfo) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家1'); return; } $this->oldBattleReport($userInfo); } private function oldBattleReport($userInfo) { $map_id = isset($_REQUEST['map_id']) ? $_REQUEST['map_id'] : 0; $map_tpl_name = isset($_REQUEST['map_tpl_name']) ? $_REQUEST['map_tpl_name'] : ''; $room_uuid = $_REQUEST['room_uuid']; //战斗id $map_name = $_REQUEST['map_name']; //地图名 $game_time = $_REQUEST['game_time']; //游戏结束时间 $hurt = $_REQUEST['hurt']; //承受伤害 $rank = $_REQUEST['rank']; //排名 $kills = $_REQUEST['kills']; //击杀数 $harm = $_REQUEST['harm']; //伤害 $add_HP = $_REQUEST['add_HP']; //治疗量 $alive_time = $_REQUEST['alive_time']; //存活时间 $team_status = $_REQUEST['team_status']; //是否是组队状态 $snipe_kill = $_REQUEST['snipe_kill']; //狙击枪击杀数 $rifle_kill = $_REQUEST['rifle_kill']; //步枪击杀数 $pistol_kill = $_REQUEST['pistol_kill']; //手枪击杀数 $submachine_kill = $_REQUEST['submachine_kill'];//冲锋枪击杀数 $rescue_member = $_REQUEST['rescue_member']; //救起队友次数 $kill_his = $kills; $harm_his = $harm; $alive_time_his = $alive_time; $add_HP_his = $add_HP; $coin_num = $_REQUEST['coin_num']; //金币 $integral = $_REQUEST['rank_score']; //排位积分 $score = $_REQUEST['pass_score']; //通行证积分 $nowDaySeconds = $this->getNowDaySeconds(); 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); } { $addreward = new classes\AddReward(); $val = $addreward->getVipVal($this->getAccountId(), 1); $coin_num = floor($coin_num + $coin_num * $val / 100); } //更新击杀信息时间 $k = 0; if ($userInfo['game_times'] != 0) { $k = $userInfo['kill_his'] / $userInfo['game_times']; } if (($userInfo['kill_his'] + $kills) / ($userInfo['game_times'] + 1) != $k) { $this->updateUserInfo(array( 'kill_modifytime' => $this->getNowTime(), )); } //更新胜场信息时间 if ($rank == 1) { $this->updateUserInfo(array( 'win_times' => $userInfo['win_times'] + 1, 'season_win' => $userInfo['season_win'] + 1, 'win_modifytime' => $this->getNowTime(), )); } //更新排位积分信息时间 if ($integral > 0) { $update_maxscore = $integral + $userInfo['max_integral']; $update_score = $integral + $userInfo['integral']; $isProtect = false; $minScore = 0; mt\SeasonPoint::calcScore($intergral, $isProtect, $minScore); if ($isProtect && $minScore > $updateScore) { $update_score = $minScore; } $this->updateUserInfo(array( 'integral' => $update_score, 'rank_modifytime' => $this->getNowTime(), 'max_integral' => $update_maxscore, )); } //更新历史最高信息 $kill_his = max($kill_his, $userInfo['kill_his']); $harm_his = max($harm_his, $userInfo['harm_his']); $sea_max_hart = max($harm, $userInfo['sea_max_hart']); $sea_max_kill = max($kills, $userInfo['sea_max_kill']); $alive_time_his = max($alive_time_his, $userInfo['alive_time_his']); $add_HP_his = max($add_HP_his, $userInfo['add_HP_his']); //添加空投箱 $box_num = min($userInfo['box_num'] + 1, 20); $newhand = $userInfo['newhand']; $newhand2 = $userInfo['newhand2']; $game_times2 = $userInfo['game_times2']; { $fight_times = mt\Parameter::getByName('newhand_num1')['param_value']; $view_times = mt\Parameter::getByName('newhand_num2')['param_value']; $fight_times2 = mt\Parameter::getByName('cream_task_01')['param_value']; $view_times2 = mt\Parameter::getByName('cream_task_02')['param_value']; if ($userInfo['game_times'] + 1 == $fight_times && $userInfo['vip_score'] >= $view_times) { $newhand = 1; } if ($newhand == 2) { if ($userInfo['game_times2'] + 1 == $fight_times2 && $userInfo['view_times2'] >= $view_times2) { $newhand2 = 1; } $game_times2++; } } $this->updateUserInfo(array( 'game_times' => function () { return 'game_times + 1'; }, 'kill_his' => $kill_his, 'kills' => function () use($kills) { return "kills + ${kills}"; }, 'harm_his' => $harm_his, 'harm' => function () use($harm) { return "harm + ${harm}"; }, 'add_HP' => function () use($add_HP) { return "add_HP + ${add_HP}"; }, 'alive_time' => function () use($alive_time) { return "alive_time + ${alive_time}"; }, 'alive_time_his' => $alive_time_his, 'add_HP_his' => $add_HP_his, 'coin_num' => function () use($coin_num) { return "coin_num + ${coin_num}"; }, 'modify_time' => $this->getNowTime(), 'box_num' => $box_num, 'score' => function () { return 'score'; //?? }, 'daily_time' => function () use($nowDaySeconds) { return 'GREATEST(daily_time, ${nowDaySeconds})'; }, 'season_games' => function () { return 'season_games + 1'; }, 'sea_max_kill' => $sea_max_kill, 'sea_max_hart' => $sea_max_hart, 'sea_avg_kill' => function () use($kills) { return "sea_avg_kill + ${kills}"; //?? }, 'newhand' => $newhand, 'newhand2' => $newhand2, 'game_times2' => $game_times2, 'first_fight' => 1, )); $addreward = new classes\Addreward(); $vip_level = $addreward->getVipLevel($this->getAccountId()); echo json_encode(array( 'errcode' => 0, 'errmsg' => '', 'kill_his' => $kill_his, 'alive_time_his' => $alive_time_his, 'harm_his' => $harm_his, 'add_HP_his' => $add_HP_his, )); } public function getRobotInfo() { echo json_encode(array( 'errcode' => 0, 'errmsg' => '', 'member_list' => array(mt\Robot::getRandMember()), 'sin_member' => mt\Robot::getSinMembers(), 'num' => Rand(1, 100) * 0.01 )); } }