This commit is contained in:
aozhiwei 2020-12-02 15:57:22 +08:00
parent b139249b53
commit 9fff301380
6 changed files with 130 additions and 76 deletions

2
res
View File

@ -1 +1 @@
config
../conf_test/game2004api/webapp/res5991

View File

@ -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];
}

View File

@ -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);

View File

@ -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,
));
}
}
?>

View File

@ -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,

View File

@ -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,