updateTaskToDB(QUEST_DAY_LOGIN,1); $this->updateSwitch($account_id, $switch_id); $userInfo = $this->safeGetOrmUserInfo(); if (!$userInfo) { $this->createNewUser(); $userInfo = $this->getOrmUserInfo(); } if ($this->loginCheck($userInfo)) { $userInfo = $this->getOrmUserInfo(); } $dtoUser = $this->getDtoUserInfo($userInfo); $dtoUser['errcode'] = 0; $dtoUser['errmsg'] = ''; $this->rspRawData($dtoUser); } private function loginCheck($userInfo) { $fieldsKv = array(); if ($userInfo['vip_score'] >= 5 && $userInfo['act_ad_status'] != 2) { $fieldsKv['act_ad_status'] = 1; } if (($this->getNowDaySeconds() - phpcommon\getDaySeconds($userInfo['update_time']) > 0)) { if ($userInfo['new_second_equip'] == 2 && $userInfo['new_first_equip'] == 1) { $fieldsKv['new_second_equip'] = 1; } $fieldsKv['daily_first_login'] = 0; $fieldsKv['free_box'] = 0; $fieldsKv['kefu_status'] = 0; $fieldsKv['coin_times'] = 0; $fieldsKv['first_day_ad'] = 0; $fieldsKv['share_video_times'] = 0; $fieldsKv['daily_max_single'] = 0; $fieldsKv['daily_score'] = 0; $fieldsKv['daily_offline'] = 0; $this->checkSeasonStatus($userInfo, $fieldsKv); } if (count($fieldsKv) > 0) { $fieldsKv['modify_time'] = $this->getNowTime(); $this->updateUserInfo($fieldsKv); } return count($fieldsKv) > 0; } private function createNewUser() { phpcommon\SqlHelper::upsert ($this->getSelfMysql(), 'user', array( 'accountid' => $this->getAccountId() ), array( ), array( 'accountid' => $this->getAccountId(), 'user_name' => $user_name, 'avatar_url' => $avatar_url, 'coin_num' => 10000, 'season_status' => 1, 'newInfo' => '', 'new_second_equip' => 2, 'head_kuang_id' => 19003, 'sex' => 2, 'hi_id' => 18001, 'hero_id' => 30100, 'integral' => 0, 'season_time' => mt\Season::getCurrSeasonTime(), 'team_name' => '', 'create_time' => phpcommon\getNowTime(), 'modify_time' => phpcommon\getNowTime(), 'update_time' => phpcommon\getNowTime(), ) ); { $paramMeta = mt\Parameter::getByName('creator_hero_id'); if ($paramMeta) { $heros = mt\Parameter::getListValue($paramMeta); foreach ($heros as $heroId) { $heroMeta = mt\Player::get($heroId); if ($heroMeta) { $this->addHero($heroMeta); } } } } { $this->addItem(array( 'item_id' => 16001, 'item_num' => 0, )); } } protected function checkSeasonStatus($userInfo, &$fieldsKv) { if ($this->getNowTime() > $userInfo['season_time'] && $userInfo['season_time'] != 0) { $fieldsKv['pass_status'] = 0; $fieldsKv['score'] = 0; $fieldsKv['season_status'] = 0; $fieldsKv['integral'] = mt\SeasonPoint::calcTopoint($userInfo);; $fieldsKv['season_end_score'] = $userInfo['integral']; $fieldsKv['season_games'] = 0; $fieldsKv['sea_max_kill'] = 0; $fieldsKv['sea_max_hart'] = 0; $fieldsKv['sea_avg_kill'] = 0; $fieldsKv['season_win'] = 0; $fieldsKv['season_time'] = mt\Season::getCurrSeasonTime(); $fieldsKv['passcard'] = 0; phpcommon\SqlHelper::update ($this->getSelfMysql(), 'passinfo', array( 'accountid' => $account_id, ), array( 'active_status' => 0, 'honor_status' => 0, 'modify_time' => $this->getNowTime() ) ); } } 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; } $taskObj = new NTaskController(); $taskObj->updateTaskToDB(PLAY_GAME, 1); $alive_time = $_REQUEST["alive_time"]; $tmpAlive_time = floor($alive_time/1000); $taskObj->updateTaskToDB(ALIVE_TIME, $tmpAlive_time); $killNum = $_REQUEST['kills']; $taskObj->updateTaskToDB(KILL_NUM, $killNum); $damageNum = $_REQUEST['harm']; $taskObj->updateTaskToDB(DAMAGE_NUM70006, $damageNum); $helpOtherPlayer = $_REQUEST['rescue_member']; $taskObj->updateTaskToDB(HELP_OP70008, $helpOtherPlayer); $this->oldBattleReport($userInfo); } private function oldBattleReport($userInfo) { $account_id = $_REQUEST['account_id']; //账号 $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 = $this->getExplode($_REQUEST['items']); $addreward = new classes\AddReward(); $addreward->addReward((int)$item_list[0][0], (int)$item_list[0][1], $account_id, 0, 0); } { $addreward = new classes\AddReward(); $val = $addreward->getVipVal($account_id, 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($account_id); 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() { $account_id = $_REQUEST['account_id']; $member = array(); $i = Rand(1, 100); $coin = Rand(1, 100) * 0.01; $num = 1; $robot_id = 1000 + $i; $address = '../res/robot@robot' . $num . '.php'; $robot_meta_cluster = require($address); $robot_meta = getRobotConfig($robot_meta_cluster, $robot_id); $rob = array( 'id' => $robot_meta['id'], 'name' => $robot_meta['name'], 'avatar_url' => $robot_meta['avatar_url'], 'sex' => $robot_meta['sex'] ); array_push ($member, array( 'account_id' => $rob['id'], 'name' => $rob['name'], 'avatar_url' => $rob['avatar_url'], )); echo json_encode(array( 'errcode' => 0, 'errmsg' => '', 'member_list' => $member, 'sin_member' => $robot_meta_cluster, 'num' => $coin, )); } protected function updateSwitch($account_id, $switch_id) { $r = $this->getRedis($account_id); if (!$r) { die(); return; } $switch_uuid = 'game2005api_switch:' . $account_id; $r -> set($switch_uuid, $switch_id); $r -> pexpire($switch_uuid, 1000 * 3600 * 24); } protected function getSwitch($account_id) { $r = $this->getRedis($account_id); if (!$r) { die(); return; } $switch_uuid = 'game2005api_switch:' . $account_id; $user_db_str = $r->get($switch_uuid); $switch = json_decode($user_db_str, true); return $switch; } public function getFightReward() { $account_id = $_REQUEST['account_id']; $coin_num = $_REQUEST['coin_num']; $reward_id = $_REQUEST['reward_id']; $reward_num = $_REQUEST['reward_num']; $addreward = new classes\AddReward(); $p = mt\Parameter::getOldParam(GAMEOVER_REWARD_TIMES); $times = $p['param_value'] - 1; $addreward = new classes\AddReward(); $val = $addreward->getVipVal($account_id, 1); $coin_num = floor($coin_num + $coin_num * $val / 100); $addreward->addReward(10001, $coin_num * $times, $account_id, 0, 0); if ($reward_id != 0) { $addreward->addReward($reward_id, $reward_num * $times, $account_id, 0, 0); } $coin_num = $addreward->getCoinNum($account_id); echo json_encode(array( 'errcode' => 0, 'errmsg'=> '', 'coin_nums' => $coin_num, )); } public function getNewHandReward() { $account_id = $_REQUEST['account_id']; $conn = $this->getMysql($account_id); $row = $conn->execQueryOne('SELECT newhand, newhand2 FROM user WHERE accountid=:account_id;', array( ':account_id' => $account_id )); $type = 1; if (isset($_REQUEST['type'])) { $type = $_REQUEST['type']; } $reward_id = 29001; if ($type == 1) { $reward_id = 29001; if (!$row || $row['newhand'] != 1) { phpcommon\sendError(ERR_USER_BASE + 2, '未达到领取条件'); return; } $ret = $conn->execScript('UPDATE user SET newhand=2, modify_time=:modify_time ' . ' WHERE accountid=:accountid;', array( ':modify_time' => phpcommon\getNowTime(), ':accountid' => $account_id )); if (!$ret) { die(); return; } } else if ($type == 2) { $reward_id = 29002; if (!$row || $row['newhand2'] != 1) { phpcommon\sendError(ERR_USER_BASE + 2, '未达到领取条件'); return; } $ret = $conn->execScript('UPDATE user SET newhand2=2, modify_time=:modify_time ' . ' WHERE accountid=:accountid;', array( ':modify_time' => phpcommon\getNowTime(), ':accountid' => $account_id )); if (!$ret) { die(); return; } } $d = mt\Drop::getOldDrop($reward_id); if (!$d) { phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励'); return; } $item_list = array(); $all_item_list = array(); $item_id_array = $this->getExplode($d['item_id']); $item_num_array = $this->getExplode($d['num']); for ($i = 0; $i < count($item_id_array); $i++) { $item_id = $item_id_array[$i][0]; $item_num = $item_num_array[$i][0]; array_push($item_list, array( 'item_id' => $item_id, 'item_num' => $item_num, 'time' => 0 )); } $addreward = new classes\AddReward(); foreach ($item_list as $item) { $items = $addreward->addReward($item['item_id'], $item['item_num'], $account_id, $item['time'], 0); foreach($items as $i) { array_push($all_item_list, array( 'item_id' => $i['item_id'], 'item_num' => $i['item_num'], 'time' => $i['time'], )); } } $coin_num = $addreward->getCoinNum($account_id); $num = $addreward->getRmbNum($account_id); echo json_encode(array( 'errcode' => 0, 'errmsg'=> '', 'item_list' => $item_list, 'coin_num' => $coin_num, 'rmb_nums' => $num, 'all_item_list' => $all_item_list )); } public function exchangeCoin() { $account_id = $_REQUEST['account_id']; $conn = $this->getMysql($account_id); $rowUser = $conn->execQueryOne('SELECT coin_times, coin_num FROM user WHERE accountid=:accountid;', array( ':accountid' => $account_id, )); if (!$rowUser) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } $id = 12141; if (isset($_REQUEST['id'])) { $id = $_REQUEST['id']; } $rowEquip = $conn->execQueryOne('SELECT id, lv FROM equip WHERE accountid=:accountid AND id=:id;', array( ':accountid' => $account_id, ':id' => $id, )); if (!$rowEquip) { phpcommon\sendError(ERR_USER_BASE + 3, '没有这个装备'); return; } $coin_times = $rowUser['coin_times']; $p1 = mt\Parameter::getOldParam(DAILYCOIN_TIMES); $max_times = $p1['param_value']; $p2 = mt\Parameter::getOldParam(DAILYCOIN_DECAY); $val = $p2['param_value']; $p3 = mt\Parameter::getOldParam(DAILYCOIN_NUM); $num = $p3['param_value']; $e = mt\EquipUpgrade::getOldEquipUp($rowEquip['id']); $eg = mt\Equip::getOldEquip($rowEquip['id']); if (!$e || !$eg) { phpcommon\sendError(ERR_USER_BASE + 3, '没有这个装备'); return; } if (isset($_REQUEST['num'])) { $coin_num = $_REQUEST['num']; } else { $coin_list = $this->getExplode($e['coin_num']); $coin_arr = $this->getExplode($eg['promote_gold']); $coin_num = $coin_list[$rowEquip['lv']][0] * $coin_arr[$rowEquip['lv']][0]; } if ($coin_times >= $max_times) { phpcommon\sendError(ERR_USER_BASE + 2, '今日次数达到上限'); return; } //$coin_num = $_REQUEST['num']; //$coin_num = round($num * pow($val, $coin_times)); $ret = $conn->execScript('UPDATE user SET coin_times=:coin_times, coin_num=:coin_num, modify_time=:modify_time ' . ' WHERE accountid=:accountid;', array( ':accountid' => $account_id, ':coin_times' => $coin_times + 1, ':coin_num' => $coin_num + $rowUser['coin_num'], ':modify_time' => phpcommon\getNowTime() )); if (!$ret) { die(); return; } $coin = $coin_num + $rowUser['coin_num']; echo json_encode(array( 'errcode' => 0, 'errmsg' => '', 'coin_nums' => $coin, 'coin_times' => $coin_times + 1 )); } public function saveNewbie() { $account_id = $_REQUEST['account_id']; $conn = $this->getMysql($account_id); //$info = array(); $id = $_REQUEST['id']; $rowUser = $conn->execQueryOne('SELECT newInfo FROM user WHERE accountid=:accountid;', array( ':accountid' => $account_id, )); if (!$rowUser) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } $info = json_decode($rowUser['newInfo']); if (empty($info)) { $info = array(); } array_push($info, (int)$id); $ret = $conn->execScript('UPDATE user SET newInfo=:newInfo,modify_time=:modify_time ' . ' WHERE accountid=:accountid;', array( ':accountid' => $account_id, ':newInfo' => json_encode($info), ':modify_time' => phpcommon\getNowTime() )); if (!$ret) { die(); return; } echo json_encode(array( 'errcode' => 0, 'errmsg' => '', )); } public function getFightEquip() { $account_id = $_REQUEST['account_id']; $id = $_REQUEST['id']; $conn = $this->getMysql($account_id); $addreward = new classes\AddReward(); $item_list = array(); array_push($item_list, array( 'item_id' => $id, 'item_num' => 1, 'time' => 0 )); $all_item_list = $addreward->addReward($id, 1, $account_id, 0, 0); $p1 = mt\Parameter::getOldParam(OPENING_SPEAR); $equip1 = $p1['param_value']; $p2 = mt\Parameter::getOldParam(OPENING_SPEAR2); $equip2 = $p2['param_value']; if ($equip1 == $id) { $ret = $conn->execScript('UPDATE user SET new_first_equip=1, modify_time=:modify_time ' . ' WHERE accountid=:accountid;', array( ':accountid' => $account_id, ':modify_time' => phpcommon\getNowTime(), )); if (!$ret) { die(); return; } $ret = $conn->execScript('UPDATE equip SET using_id=:using_id, modify_time=:modify_time ' . ' WHERE accountid=:accountid;', array( ':accountid' => $account_id, ':using_id' => $id, ':modify_time' => phpcommon\getNowTime(), )); if (!$ret) { die(); return; } } else if ($equip2 == $id) { $ret = $conn->execScript('UPDATE user SET new_second_equip=1, modify_time=:modify_time ' . ' WHERE accountid=:accountid;', array( ':accountid' => $account_id, ':modify_time' => phpcommon\getNowTime(), )); if (!$ret) { die(); return; } } echo json_encode(array( 'errcode' => 0, 'errmsg'=> '', 'item_list' => $item_list, 'all_item_list' => $all_item_list, )); } public function updateMoney() { $account_id = $_REQUEST['account_id']; $conn = $this->getMysql($account_id); $sqlStr = "SELECT coin_num FROM user WHERE accountid=:accountid; "; $row = $conn->execQuery($sqlStr,array(':accountid' => $account_id)); if($row) { error_log("UpdateMoney======".json_encode($row)); } else{ error_log("Test06======="); } $this->sendDataToClient(1,"ok",$row[0]); } public function updateMoneyAndLottery() { $account_id = $_REQUEST['account_id']; $conn = $this->getMysql($account_id); $sqlStr = "SELECT coin_num,rmb_num FROM user WHERE accountid=:accountid; "; $row = $conn->execQuery($sqlStr,array(':accountid' => $account_id)); if($row) { error_log("UpdateMoneyAndLottery======".json_encode($row)); } else{ } $this->sendDataToClient(3,"ok",$row[0]); } private function getGiveMeFive()//获得玩家被点赞的次数 { $account_id = $_REQUEST['account_id']; $conn = $this->getMysql($account_id); $giveMeFiveCnt = 0; $sqlStr = "SELECT give_me_five FROM player_info WHERE accountid=:accountid; "; $row = $conn->execQuery($sqlStr,array(':accountid' => $account_id)); if($row) { $giveMeFiveCnt = $row["give_me_five"]; } //error_log("当前GiveMeFiveCnt===".$giveMeFiveCnt); return $giveMeFiveCnt; } public function addGiveMeFive()//玩家被点赞一次 { //error_log("玩家被点赞===".$this->getAccountId()); $tmpCnt = $this->getGiveMeFive(); $tmpCnt ++; phpcommon\SqlHelper::insertOrUpdate ($this->getSelfMysql(), 'player_info', array( 'accountid' => $this->getAccountId() ), array( 'accountid' => $this->getAccountId(), 'give_me_five' => $tmpCnt, 'createtime' => $this->getNowTime(), 'modifytime' => $this->getNowTime() ), array( 'give_me_five' => $tmpCnt, 'modifytime' => $this->getNowTime() ) ); $this->sendDataToClient(100,"getGiveMeFiveTest",null); } public function getPlayerInfo()//获得玩家个人信息 { $account_id = $_REQUEST['acctID']; $conn = $this->getMysql($account_id); $from = $_REQUEST['from']; $sqlStr = "SELECT * FROM user WHERE accountid=:accountid; "; $row = $conn->execQuery($sqlStr,array(':accountid' => $account_id)); $resultArr = null; $code = 100; if($row) { //$resultData = $row[0]; $userName = $row[0]["user_name"];//玩家昵称 $teamName =$row[0]["team_name"];//战队昵称 $sex = $row[0]["sex"]; $lv = $row[0]["lv"];//玩家等级 $lv_exp = $row[0]["lv_exp"];//玩家当前等级已经获得的经验 $hiID = $row[0]["hi_id"];//玩家头像ID $hiFrameID = $row[0]["head_kuang_id"];//玩家头像框ID $heroID = $row[0]["hero_id"];//当前使用的英雄ID $killRank = 2;//击杀排名 $gameTimes = $row[0]["game_times"];//游戏场次 $winTimes = $row[0]["win_times"];//游戏胜利场次 $maxKill = $row[0]["kill_his"];//最高击杀 $totalKill = $row[0]["kills"];//总击杀次数 $maxDamage = $row[0]["harm_his"];//最高伤害 $totalDamage = $row[0]["harm"];//总伤害 $cureN = $row[0]['add_HP'];//治疗 $aliveTimes = $row[0]['alive_time'];//生存总时间 //$rankScore = $row[0][""];//当前段位分数 if($hiID == 0) { $hiID = 18001; } if($hiFrameID == 0) { $hiFrameID = 19001; } if($heroID == 0) { $heroID = 30100; } $resultArr = array( "acctID"=>$account_id, "userName"=>$userName, "teamName"=>$teamName, "sex"=>$sex, "lv"=>$lv, "lv_exp"=>$lv_exp, "hiID"=>$hiID, "hiFrameID"=>$hiFrameID, "heroID"=>$heroID, "killRank"=>$killRank, "gameTimes"=>$gameTimes, "winTimes"=>$winTimes, "maxKill"=>$maxKill, "totalKill"=>$totalKill, "maxDamage"=>$maxDamage, "totalDamage"=>$totalDamage, "from"=>$from, 'cureN' =>$cureN, 'aliveTime' =>$aliveTimes ); } else { $code = 99; } //获得所有英雄开始- if($code == 100) { $conn = $this->getMysql($account_id); $tmpHeroArr = array(); $sqlStr = "SELECT id FROM hero WHERE accountid=:accountid;"; $row = $conn->execQuery($sqlStr,array(':accountid' => $account_id)); if($row) { for($i = 0 ;$i < count($row);$i++) { $tmpHeroID = $row[$i]["id"]; array_push($tmpHeroArr,$tmpHeroID); } } else { $code = 99; } $resultArr["heroArr"] = $tmpHeroArr; } //获得所有英雄结束- //获得改名卡道具数量开始-- if($code == 100) { $conn = $this->getMysql($account_id); $tmpHeroArr = array(); $itemID = 10106; $sqlStr = "SELECT * FROM bag WHERE accountid=:accountid AND id=:id;"; $row = $conn->execQuery($sqlStr,array(':accountid' => $account_id,':id'=>$itemID)); if($row) { $itemNum = $row[0]["num"]; } else { $itemNum = 0; } $resultArr["bagItem"] = $itemNum; } //获得改名卡道具数量结束-- $this->sendDataToClient($code,"getPlayerInfo",$resultArr); } public function changeHIFrameHero()//修改头像 头像框 英雄 { $account_id = $_REQUEST['account_id']; $type = $_REQUEST['type']; $itemID = $_REQUEST["itemID"]; $conn = $this->getMysql($account_id); $code = 100; $updateInfo = null; $heroSkinID = 0; if($type == 2)//修改头像 { $updateInfo = array("hi_id" => $itemID); } else if($type == 3)//修改头像框 { $updateInfo = array("head_kuang_id" => $itemID); } else if($type == 4)//修改英雄 { $updateInfo = array('hero_id' => $itemID); } if($code == 100) { phpcommon\SqlHelper::update ($this->getSelfMysql(), 'user', array( 'accountid' => $this->getAccountId() ), $updateInfo ); } $resultArr = array("type"=>$type,"itemID"=>$itemID,"heroSkinID"=>$heroSkinID); $this->sendDataToClient($code,"changeHIFrameHero",$resultArr); } public function changeName()//修改昵称 { $account_id = $_REQUEST['account_id']; $nickName = $_REQUEST['nickName']; $conn = $this->getMysql($account_id); $code = 100; $itemID = 10106; $itemNum = 1; $itemArr = array(); $deleteItem = array("item_id"=>$itemID,"item_num"=>$itemNum); array_push($itemArr,$deleteItem); $code = $this->deleteItem($deleteItem); if($code == 100) { $this->decItem($itemArr); //error_log("改名测试======".$code); phpcommon\SqlHelper::update ($this->getSelfMysql(), 'user', array( 'accountid' => $this->getAccountId() ), array( 'user_name' => $nickName ) ); } $this->sendDataToClient($code,"changeNickName",$nickName); // $sqlStr = "SELECT * FROM user WHERE accountid=:accountid; "; // $row = $conn->execQuery($sqlStr,array(':accountid' => $account_id)); } }