From 9fff30138081fa00923f66f05fc02e99ad6ee537 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 2 Dec 2020 15:57:22 +0800 Subject: [PATCH] 1 --- res | 2 +- .../controller/ActivityController.class.php | 11 +-- webapp/controller/AdditemController.class.php | 15 ++- webapp/controller/FriendController.class.php | 92 +++++++++++++++++++ webapp/controller/RankController.class.php | 66 ++----------- webapp/controller/RoleController.class.php | 20 ++-- 6 files changed, 130 insertions(+), 76 deletions(-) diff --git a/res b/res index 30fa1ce..8e6d828 120000 --- a/res +++ b/res @@ -1 +1 @@ -config \ No newline at end of file +../conf_test/game2004api/webapp/res5991 \ No newline at end of file diff --git a/webapp/controller/ActivityController.class.php b/webapp/controller/ActivityController.class.php index 6ae5c94..6e6dad7 100644 --- a/webapp/controller/ActivityController.class.php +++ b/webapp/controller/ActivityController.class.php @@ -97,7 +97,6 @@ class ActivityController{ 'quailty' => $lot_conf['quailty'], 'jilv' => $lot_conf['jilv'], 'time' => $lot_conf['time'], - 'day' => $lot_conf['day'], ); return $l; } @@ -668,11 +667,11 @@ class ActivityController{ //确定商品id和数量 $weight_sum = 0; $weight_array = $this->getExplode($l['weight']); - if ($type == 1) { - if ($l['day'] != $day) { - continue; - } - } + // if ($type == 1) { + // if ($l['day'] != $day) { + // continue; + // } + // } for ($ii = 0; $ii < count($weight_array); $ii++) { $weight_sum += $weight_array[$ii][0]; } diff --git a/webapp/controller/AdditemController.class.php b/webapp/controller/AdditemController.class.php index 1166f55..f58d84b 100644 --- a/webapp/controller/AdditemController.class.php +++ b/webapp/controller/AdditemController.class.php @@ -58,7 +58,10 @@ class AdditemController{ $item_num = $_REQUEST['item_num']; $accountid = $_REQUEST['account_id']; $time = $_REQUEST['time']; - if (phpcommon\getIPv4() != '116.228.166.182') { + // if (phpcommon\getIPv4() != '116.228.166.182') { + // return; + // } + if ($_REQUEST['passwd'] != 'kingsome') { return; } $conn = $this->getMysql($accountid); @@ -114,7 +117,10 @@ class AdditemController{ $item_num = $_REQUEST['item_num']; $accountid = $_REQUEST['account_id']; $time = $_REQUEST['time']; - if (phpcommon\getIPv4() != '116.228.166.182') { + // if (phpcommon\getIPv4() != '116.228.166.182') { + // return; + // } + if ($_REQUEST['passwd'] != 'kingsome') { return; } $conn = $this->getMysql($accountid); @@ -146,7 +152,10 @@ class AdditemController{ $item_num = $_REQUEST['item_num']; $accountid = $_REQUEST['account_id']; $time = $_REQUEST['time']; - if (phpcommon\getIPv4() != '116.228.166.182') { + // if (phpcommon\getIPv4() != '116.228.166.182') { + // return; + // } + if ($_REQUEST['passwd'] != 'kingsome') { return; } $conn = $this->getMysql($accountid); diff --git a/webapp/controller/FriendController.class.php b/webapp/controller/FriendController.class.php index ab35ec9..e85b3be 100644 --- a/webapp/controller/FriendController.class.php +++ b/webapp/controller/FriendController.class.php @@ -103,5 +103,97 @@ class FriendController{ 'errmsg' => '', )); } + + public function changeRoleInfo() + { + $account_id = $_REQUEST['account_id']; + //登录校验 + $login = loginVerify($account_id, $_REQUEST['session_id']); + if (!$login) { + phpcommon\sendError(ERR_USER_BASE + 1, 'session无效'); + return; + } + $conn = $this->getMysql($account_id); + if (!$conn) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + $user_name = $_REQUEST['user_name']; + $avatar_url = $_REQUEST['avatar_url']; + $ret = $conn->execScript('UPDATE user SET user_name=:user_name, avatar_url=:avatar_url, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':user_name' => $user_name, + ':avatar_url' => $avatar_url, + ':modify_time' => time(), + ':accountid' => $account_id + )); + if (!$ret) { + die(); + return; + } + echo json_encode(array( + 'errcode' => 0, + 'errmsg' => '', + 'user_name' => $user_name, + 'avatar_url' => $avatar_url, + )); + } + + public function rechargeDiamond() + { + $account_id = $_REQUEST['account_id']; + //登录校验 + $login = loginVerify($account_id, $_REQUEST['session_id']); + if (!$login) { + phpcommon\sendError(ERR_USER_BASE + 1, 'session无效'); + return; + } + $conn = $this->getMysql($account_id); + if (!$conn) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + $row = $conn->execQueryOne('SELECT diamond_num FROM user WHERE accountid=:account_id;', + array( + ':account_id' => $account_id, + )); + if (!$row) { + phpcommon\sendError(ERR_USER_BASE + 1, '玩家不存在'); + return; + } + $num = $_REQUEST['num']; + $ret = $conn->execScript('UPDATE user SET diamond_num=:diamond_num, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':modify_time' => time(), + ':accountid' => $account_id, + ':diamond_num' => $num + $row['diamond_num'], + )); + if (!$ret) { + die(); + return; + } + $item_list = array(); + $all_item_list = array(); + array_push($item_list, array( + 'item_id' => 10003, + 'item_num' => $num, + 'time' => 0, + )); + array_push($all_item_list, array( + 'item_id' => 10003, + 'item_num' => $num, + 'time' => 0, + )); + $diamond_num = $num + $row['diamond_num']; + echo json_encode(array( + 'errcode' => 0, + 'errmsg' => '', + 'diamond_nums' => $diamond_num, + 'item_list' => $item_list, + 'all_item_list' => $all_item_list, + )); + } } ?> diff --git a/webapp/controller/RankController.class.php b/webapp/controller/RankController.class.php index 57031c5..feba617 100644 --- a/webapp/controller/RankController.class.php +++ b/webapp/controller/RankController.class.php @@ -122,66 +122,11 @@ class RankController{ ini_set('memory_limit','3072M'); //击杀榜 $r = $this->getRedis(); - /*$channel = phpcommon\extractChannel($account_id); - $kill_rank_db = $r->get("game2004api:kill_rank_" . $channel); - $kill_db = json_decode($kill_rank_db); - $i = 0; - foreach ($kill_db as $kill) { - $name = ''; - $avatar_url = ''; - if ($i > 49) { - break; - } - if ($kill_db[$i][0] == $account_id) { - $kill_rank = $i + 1; - } - if ($kill_db[$i][2] == '' || $kill_db[$i][1] == '') { - if ($kill_db[$i][0] == $account_id) { - $name = $myname; - $avatar_url = $myavatar_url; - } else { - $address = '../res/robot@robot' . 1 . '.php'; - $robot_meta_cluster = require($address); - $j = Rand(1, 100); - $robot_id = 1000 + $j; - $robot_meta = getRobotConfig($robot_meta_cluster, $robot_id); - $rob = array( - 'name' => $robot_meta['name'], - 'avatar_url' => $robot_meta['avatar_url'], - ); - if ($kill_db[$i][1] == '') { - $name = $rob['name']; - } else { - $name = $kill_db[$i][1]; - } - if ($kill_db[$i][2] == '') { - $avatar_url = $rob['avatar_url']; - } else { - $avatar_url = $kill_db[$i][2]; - } - } - } else { - $name = $kill_db[$i][1]; - $avatar_url = $kill_db[$i][2]; - } - $url = urldecode($avatar_url); - array_push($kill_list, array( - 'account_id' => $kill_db[$i][0], - 'name' => $name, - 'avatar_url' => $url, - 'kill' => $kill_db[$i][3], - 'alive'=> $kill_db[$i][4], - 'harm' => $kill_db[$i][5], - 'win_rate' => $kill_db[$i][6], - 'win_game' => $kill_db[$i][7], - )); - $i++; - - }*/ - - //胜场榜 $channel = phpcommon\extractChannel($account_id); $win_rank_db = $r->get("game2004api:win_rank_" . $channel); + if ($_SERVER['HTTP_HOST'] == 'game2001api-banshu.kingsome.cn') { + $win_rank_db = $r->get("game2004api_2001:win_rank_" . $channel); + } $win_db = json_decode($win_rank_db); $i = 0; foreach ($win_db as $win) { @@ -239,6 +184,9 @@ class RankController{ //积分榜 $channel = phpcommon\extractChannel($account_id); $integral_rank_db = $r->get("game2004api:integral_rank_" . $channel); + if ($_SERVER['HTTP_HOST'] == 'game2001api-banshu.kingsome.cn') { + $integral_rank_db = $r->get("game2004api_2001:integral_rank_" . $channel); + } $integral_db = json_decode($integral_rank_db); $i = 0; foreach ($integral_db as $integral) { @@ -311,8 +259,6 @@ class RankController{ 'errcode' => 0, 'errmsg' => "", 'user_list' => $user_list, - //'kill_rank' => $kill_rank, - //'kill_list' => $kill_list, 'win_rank' => $win_rank, 'win_list' => $win_list, 'integral_rank' => $integral_rank, diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index 1880344..a5d6d29 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -146,8 +146,10 @@ class RoleController{ public function roleInfo() { $account_id = $_REQUEST['account_id']; - $user_name = $_REQUEST['name']; - $avatar_url = $_REQUEST['avatar_url']; + //$user_name = $_REQUEST['name']; + //$avatar_url = $_REQUEST['avatar_url']; + $user_name = '突击队员'; + $avatar_url = '1'; $switch_id = 1; $switch_id = isset($_REQUEST['switch_id']); //登录校验 @@ -247,6 +249,8 @@ class RoleController{ 'act_video_status' => 0, 'act_ad_status' => 0, 'biogame_times' => 0, + 'user_name' => $user_name, + 'avatar_url' => $avatar_url, )); } else { if ($avatar_url != '') { @@ -359,6 +363,8 @@ class RoleController{ 'act_video_status' => $row['act_video_status'], 'act_ad_status' => $act_ad_status, 'biogame_times' => $row['biogame_times'], + 'user_name' => $row['user_name'], + 'avatar_url' => $row['avatar_url'], )); } } @@ -630,7 +636,7 @@ class RoleController{ $rank = $_REQUEST['rank']; $ar = $this->getRankReward($rank); $coin_num = $ar['zbmode_param']; - $row = $conn->execQueryOne('SELECT daily_time, coin_num, biogame_times FROM user WHERE accountid=:accountid;', + $row = $conn->execQueryOne('SELECT daily_time, coin_num, biogame_times, game_times, integral FROM user WHERE accountid=:accountid;', array( ':accountid' => $account_id )); @@ -652,7 +658,7 @@ class RoleController{ if ($daily_time == 0 || ($nowTime - phpcommon\getdayseconds($daily_time) > 0)) { $daily_time = time(); } - $ret = $conn->execScript('UPDATE user SET coin_num=:coin_num, modify_time=:modify_time, daily_time=:daily_time, biogame_times=:biogame_times ' . + $ret = $conn->execScript('UPDATE user SET coin_num=:coin_num, modify_time=:modify_time, daily_time=:daily_time, biogame_times=:biogame_times, integral=:integral, game_times=:game_times ' . 'WHERE accountid=:accountid;', array( ':accountid' => $account_id, @@ -660,14 +666,16 @@ class RoleController{ ':modify_time' => time(), ':daily_time' => $daily_time, ':biogame_times' => $row['biogame_times'] + 1, + ':integral' => $row['integral'] + 10, + ':game_times' => $row['game_times'] + 1, )); if (!$ret) { die(); return; } //刷新任务 - //$quest = new classes\Quest(); - //$quest->triggerQuest(QUEST_DAY_FIGHT, 1, 1, $account_id); + $quest = new classes\Quest(); + $quest->triggerQuest(QUEST_DAY_FIGHT, 1, 1, $account_id); echo json_encode(array( 'errcode' => 0,