From 06f0355d9b8ea315c348ea68c268db3b08593c88 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 25 Nov 2021 19:52:06 +0800 Subject: [PATCH] 1 --- .../controller/BaseAuthedController.class.php | 151 +--- webapp/controller/RoleController.class.php | 735 ------------------ 2 files changed, 2 insertions(+), 884 deletions(-) delete mode 100644 webapp/controller/RoleController.class.php diff --git a/webapp/controller/BaseAuthedController.class.php b/webapp/controller/BaseAuthedController.class.php index f0cc3b2d..0360966b 100644 --- a/webapp/controller/BaseAuthedController.class.php +++ b/webapp/controller/BaseAuthedController.class.php @@ -9,10 +9,6 @@ class BaseAuthedController extends BaseController { private $accountId = ''; private $sessionId = ''; private $mysqlConn = null; - private $goldID = 10001; - private $lotteryID = 10003; - private $diamondID = 10003; - protected $itemArr = array(); public function handlePre() { @@ -52,7 +48,6 @@ class BaseAuthedController extends BaseController { public function getMysql($data) { $mysql_conf = getMysqlConfig(crc32($data)); - //error_log("Sql01=====".json_encode($mysql_conf)."==".DBNAME_PREFIX . $mysql_conf['instance_id']); $conn = new phpcommon\Mysql(array( 'host' => $mysql_conf['host'], 'port' => $mysql_conf['port'], @@ -296,6 +291,7 @@ class BaseAuthedController extends BaseController { } } } + public function deleteItem($item) { $tmpItemID = $item["item_id"]; @@ -320,6 +316,7 @@ class BaseAuthedController extends BaseController { return $code; } + public function decGold($decGold) { SqlHelper::update @@ -351,75 +348,6 @@ class BaseAuthedController extends BaseController { ) ); } - public function addLottery($addLottery) - { - SqlHelper::update - ( - $this->getSelfMysql(), - 'user', - array( - 'accountid' => $this->getAccountId() - ), - array( - 'rmb_num' => function () use($addLottery) { return "rmb_num + {$addLottery}"; } - ) - ); - } - public function checkPriceEnough($_priceID,$_priceNum) - { - //$priceStrArr = explode(":",$price); - $tmpID = $_priceID; - $priceNum = $_priceNum; - $accountID = $this->getAccountId(); - $conn = $this->getMysql($accountID); - $sqlStr = null; - $row = null; - $tmpNum = 0; - if($tmpID == $this->goldID) - { - - $sqlStr = "SELECT coin_num FROM user WHERE accountid=:accountid;"; - - } - else if($tmpID == $this->diamondID) - { - $sqlStr = "SELECT diamond_num FROM user WHERE accountid=:accountid;"; - } - - $code = 100; - if($sqlStr) - { - $row = $conn->execQuery($sqlStr,array(':accountid' => $accountID)); - if($row) - { - if($tmpID == $this->goldID) - { - - $tmpNum = $row[0]["coin_num"]; - if($tmpNum < $priceNum) - { - $code = 88;//金币不足 - } - - } - else if($tmpID == $this->diamondID) - { - $tmpNum = $row[0]["diamond_num"]; - if($tmpNum < $priceNum) - { - $code = 87;//钻石不足 - } - } - - } - else - { - $code = 86;//道具不足 - } - - } - return $code; - } public function getTalentLv($skillId, $skillTypeId) { @@ -462,81 +390,6 @@ class BaseAuthedController extends BaseController { return true; } - public function getDtoUserInfo($userInfo) - { - return array( - 'game_times' => $userInfo['game_times'], - 'win_times' => $userInfo['win_times'], - 'high_kill' => $userInfo['kill_his'], - 'kills' => $userInfo['kills'], - 'high_harm' => $userInfo['harm_his'], - 'harm' => $userInfo['harm'], - 'add_HP' => $userInfo['add_HP'], - 'alive_time' => $userInfo['alive_time'], - 'coin_num' => $userInfo['coin_num'], - 'first_fight' => $userInfo['first_fight'], - 'collect_status' => $userInfo['collect_status'], - 'keys_num' => $userInfo['keys_num'], - 'kefu_status' => $userInfo['kefu_status'], - 'box_num' => $userInfo['box_num'], - 'diamond_num' => $userInfo['diamond_num'], - 'pass_status' => $userInfo['pass_status'], - 'season_status' => $userInfo['season_status'], - 'first_gift' => $userInfo['first_gift'], - 'sum_coin' => $userInfo['sum_coin'], - 'recharge_times_total' => $userInfo['recharge_times_total'], - 'first_login' => $userInfo['first_login'], - 'daily_first_login' =>$userInfo['daily_first_login'], //目前没处理 - 'vip_score' => $userInfo['vip_score'], - 'coin_nums' => $userInfo['coin_num'], - 'diamond_nums' => $userInfo['diamond_num'], - 'free_box' => $userInfo['free_box'], - 'season_games' => $userInfo['season_games'], - 'season_win' => $userInfo['season_win'], - 'sea_max_kill' => $userInfo['sea_max_kill'], - 'sea_max_hart' => $userInfo['sea_max_hart'], - 'sea_avg_kill' => $userInfo['sea_avg_kill'], - 'free_dou_lot_ticket' => $userInfo['free_dou_lot_ticket'], - 'free_lot_ticket' => $userInfo['free_lot_ticket'], - 'time' => phpcommon\getNowTime(), - 'newhand' => $userInfo['newhand'], - 'coin_times' => $userInfo['coin_times'], - 'newInfo' => $userInfo['newInfo'], - 'first_day_ad' => $userInfo['first_day_ad'], //目前没处理 - 'integral' => $userInfo['integral'], - 'share_video_times' => $userInfo['share_video_times'], - 'share_video_sums' => $userInfo['share_video_sums'], - 'act_video_status' => $userInfo['act_video_status'], - 'act_ad_status' => $userInfo['act_ad_status'], - 'biogame_times' => $userInfo['biogame_times'], - 'shop_view_times' => $userInfo['shop_view_times'], - 'new_first_equip' => $userInfo['new_first_equip'], - 'newhand2' =>$userInfo['newhand2'], - 'game_times2' =>$userInfo['game_times2'], - 'view_times2' =>$userInfo['view_times2'], - 'guildcoin_num' => $userInfo['guildcoin_num'], - 'new_second_equip' => $userInfo['new_second_equip'], - 'rmb_num' => $userInfo['rmb_num'], - 'max_single_recharge' => $userInfo['max_single_recharge'], - 'passcard' => $userInfo['passcard'], - 'rmb_lot_ticket' => $userInfo['rmb_lot_ticket'], - 'daily_max_single' => $userInfo['daily_max_single'], - 'head_kuang_id' => $userInfo['head_kuang_id'], - 'daily_score' => $userInfo['daily_score'], - 'score' => $userInfo['score'], - 'daily_offline' => $userInfo['daily_offline'], - 'user_name' => $userInfo['user_name'], - 'avatar_url' => $userInfo['avatar_url'], - 'create_user' => $userInfo['create_user'], - 'sex' => $userInfo['sex'], - 'lv' => $userInfo['lv'], - 'lv_exp' => $userInfo['lv_exp'], - 'hiid' => $userInfo['hi_id'], - 'hero_id' => $userInfo['hero_id'], - 'max_seasonScore' => $userInfo['max_integral'] - ); - } - public function getUsingEquipId() { $row = SqlHelper::selectOne diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php deleted file mode 100644 index 957af725..00000000 --- a/webapp/controller/RoleController.class.php +++ /dev/null @@ -1,735 +0,0 @@ -updateTaskToDB(QUEST_DAY_LOGIN,1); - - $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' => $userInfo['accountid'], - ), - 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) - { - $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 - )); - } - - public function getFightReward() - { - $coin_num = $_REQUEST['coin_num']; - $reward_id = $_REQUEST['reward_id']; - $reward_num = $_REQUEST['reward_num']; - - $times = mt\Parameter::getVal('gameover_reward_times', 1) - 1; //为啥-1? - $addreward = new classes\AddReward(); - $val = $addreward->getVipVal($this->getAccountId(), 1); - $coin_num = floor($coin_num + $coin_num * $val / 100); - $addreward->addReward(V_ITEM_GOLD, $coin_num * $times, $this->getAccountId(), 0, 0); - if ($reward_id != 0) { - $addreward->addReward($reward_id, $reward_num * $times, $this->getAccountId(), 0, 0); - } - $coin_num = $addreward->getCoinNum($this->getAccountId()); - $this->rspRawData(array( - 'errcode' => 0, - 'errmsg'=> '', - 'coin_nums' => $coin_num, - )); - } - - public function getNewHandReward() - { - $userInfo = $this->getUserInfo(array( - 'newhand', - 'newhand2' - )); - if (!isset($_REQUEST['type']) || !in_array($_REQUEST['type'], array(1, 2))) { - $this->rspErr(1, '参数错误'); - return; - } - $type = $_REQUEST['type']; - $reward_id = 29001; - if ($type == 1) { - $reward_id = 29001; - if ($userInfo['newhand'] != 1) { - $this->rspErr(ERR_USER_BASE + 2, '未达到领取条件'); - return; - } - $this->updateUserInfo(array( - 'newhand' => 2, - 'modify_time' => $this->getNowTime() - )); - } else if ($type == 2) { - $reward_id = 29002; - if ($userInfo['newhand2'] != 1) { - $this->rspErr(ERR_USER_BASE + 2, '未达到领取条件'); - return; - } - $this->updateUserInfo(array( - 'newhand2' => 2, - 'modify_time' => $this->getNowTime() - )); - } - - $dropMeta = mt\Drop::get($reward_id); - if (!$dropMeta) { - $this->rspErr(ERR_USER_BASE + 3, '没有这个奖励'); - return; - } - $item_list = mt\Drop::getDropData(); - $all_item_list = array(); - $addreward = new classes\AddReward(); - foreach ($item_list as $item) { - $items = $addreward->addReward($item['item_id'], - $item['item_num'], - $this->getAccountId(), - $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'], - )); - } - } - $newUserInfo = $this->getUserInfo(array( - 'coin_num', - 'rmb_num' - )); - echo json_encode(array( - 'errcode' => 0, - 'errmsg'=> '', - 'item_list' => $item_list, - 'coin_num' => $newUserInfo['coin_num'], - 'rmb_nums' => $newUserInfo['rmb_num'], - 'all_item_list' => $all_item_list - )); - } - - public function exchangeCoin() - { - $userInfo = $this->getUserInfo(array( - 'coin_times', - 'coin_num' - )); - if ($userInfo['coin_times'] >= mt\Parameter::getVal('dailycoin_times', 0)) { - $this->rspErr(ERR_USER_BASE + 2, '今日次数达到上限'); - return; - } - $id = isset($_REQUEST['id']) ? $_REQUEST['id'] : 12141; - $rowEquip = phpcommon\SqlHelper::selectOne( - $this->getSelfMysql(), - 'equip', - array( - 'id', - 'lv' - ), - array( - 'accountid' => $this->getAccountId(), - 'id' => $id, - ) - ); - if (!$rowEquip) { - $this->rspErr(ERR_USER_BASE + 3, '没有这个装备'); - return; - } - - $val = mt\Parameter::getVal('dailycoin_decay', 0); - $num = mt\Parameter::getVal('dailycoin_num', 0); - $e = mt\EquipUpgrade::getOldEquipUp($rowEquip['id']); - $eg = mt\Equip::getOldEquip($rowEquip['id']); - if (!$e || !$eg) { - $this->rspErr(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]; - } - //$coin_num = $_REQUEST['num']; - //$coin_num = round($num * pow($val, $coin_times)); - $this->updateUserInfo(array( - 'coin_times' => $userInfo['coin_times'] + 1, - 'coin_num' => $coin_num + $userInfo['coin_num'], - 'modify_time' => $this->getNowTime() - )); - $coin = $coin_num + $userInfo['coin_num']; - echo json_encode(array( - 'errcode' => 0, - 'errmsg' => '', - 'coin_nums' => $coin, - 'coin_times' => $userInfo['coin_times'] + 1 - )); - } - - public function saveNewbie() - { - $id = $_REQUEST['id']; - $userInfo = $this->getUserInfo(array( - 'newInfo' - )); - $info = emptyReplace(json_decode($userInfo['newInfo']), array()); - array_push($info, (int)$id); - $this->updateUserInf(array( - 'newInfo' => json_encode($info), - 'modify_time' => $this->getNowTime() - )); - $this->rspOk(); - } - - public function getFightEquip() - { - $equip1 = mt\Parameter::getVal('opening_spear', 0); - $equip2 = mt\Parameter::getVal('opening_spear2', 0); - - $id = $_REQUEST['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, $this->getAccountId(), 0, 0); - if ($equip1 == $id) { - $this->updateUserInfo(array( - 'new_first_equip' => 1, - 'modify_time' => $this->getNowTime(), - )); - phpcommon\SqlHelper::update - ($this->getSelfMysql(), - 'equip', - array( - 'accountid' => $this->getAccountId(), - ), - array( - 'using_id' => $id, - 'modify_time' => $this->getNowTime(), - ) - ); - } else if ($equip2 == $id) { - $this->updateUserInfo(array( - 'new_second_equip' => 1, - 'modify_time' => $this->getNowTime(), - )); - } - echo json_encode(array( - 'errcode' => 0, - 'errmsg'=> '', - 'item_list' => $item_list, - 'all_item_list' => $all_item_list, - )); - } - - public function updateMoney() - { - $userInfo = $this->getUserInfo(array( - 'coin_num' - )); - $this->sendDataToClient(1, "ok", $userInfo); - } - - public function updateMoneyAndLottery() - { - $userInfo = $this->getUserInfo(array( - 'coin_num', - 'rmb_num' - )); - $this->sendDataToClient(3, "ok", $userInfo); - } - - 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() - { - $type = $_REQUEST['type']; - $itemID = $_REQUEST["itemID"]; - $fieldsKv = array(); - if($type == 2) { - $fieldsKv = array("hi_id" => $itemID); - } else if($type == 3) { - $fieldsKv = array("head_kuang_id" => $itemID); - } else if($type == 4) { - $fieldsKv = array('hero_id' => $itemID); - } - if(count($fieldsKv) > 0) { - $this->updateUserInfo($fieldsKv); - } - $resultArr = array("type"=>$type,"itemID"=>$itemID,"heroSkinID"=> 0); - $this->sendDataToClient(100, "changeHIFrameHero", $resultArr); - } - - public function changeName() - { - $nickName = $_REQUEST['nickName']; - $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); - $this->updateUserInfo(array( - 'user_name' => $nickName - )); - } - $this->sendDataToClient($code,"changeNickName",$nickName); - } - -}