This commit is contained in:
aozhiwei 2019-09-11 20:29:10 +08:00
parent 84eb81bd15
commit 961d6fadec
8 changed files with 303 additions and 24 deletions

View File

@ -77,6 +77,10 @@ CREATE TABLE `user` (
`free_coin` int(11) NOT NULL DEFAULT '0' COMMENT '每日免费金币',
`free_diamond` int(11) NOT NULL DEFAULT '0' COMMENT '每日免费钻石',
`season_end_score` int(11) NOT NULL DEFAULT '0' COMMENT '赛季结算积分',
`kill_modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '击杀更新时间',
`win_modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '胜场更新时间',
`rank_modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '排位积分更新时间',
`vip_score` int(11) NOT NULL DEFAULT '0' COMMENT 'vip积分',
PRIMARY KEY (`idx`),
UNIQUE KEY `accountid` (`accountid`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;

View File

@ -0,0 +1,10 @@
begin
alter table user add column `kill_modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '击杀更新时间';
alter table user add column `win_modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '胜场更新时间';
alter table user add column `rank_modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '排位积分更新时间';
alter table user add column `vip_score` int(11) NOT NULL DEFAULT '0' COMMENT 'vip积分';
insert into version (version) values(2019091101);
commit;

View File

@ -894,6 +894,7 @@ class ActivityController{
':red_type' => $type,
':red_date' => phpcommon\getdayseconds(time())
));
if (!$row) {
$ret = $red_conn->execScript('INSERT INTO redpack(red_type, red_sum, red_date, create_time, modify_time) ' .
' VALUES(:red_type, :red_sum, :red_date, :create_time, :modify_time) ' .
@ -923,5 +924,42 @@ class ActivityController{
}
}
}
public function airDropBoxInfo()
{
$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 + 2, '没有这个玩家');
return;
}
$d = $this->getDrop(24106);
if (!$d) {
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励');
die();
}
$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,
));
}
echo json_encode(array(
'errcode' => 0,
'errmsg' => '',
'item_list' => $item_list
));
}
}
?>

View File

@ -167,7 +167,6 @@ class PassController{
$status = 0;
$seaReward = $this->getSeasonReward($id - 1);
$sum_point = $sum_point + $seaReward['point'];
error_log($seaReward['point']);
if ($row['score'] <= $sum_point) {
$level = $seaReward['level'];
$pass_score = $row['score'] - $sum_point + $seaReward['point'];

View File

@ -29,6 +29,7 @@ class PayController{
'icon' => $item_meta['icon'],
'fuction' => $item_meta['fuction'],
'fuctionindex' => $item_meta['fuctionindex'],
'dprice' => $item_meta['dprice'],
);
return $item;
}
@ -251,7 +252,7 @@ class PayController{
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return;
}
$row = $conn->execQueryOne('SELECT sum_coin FROM user WHERE accountid=:accountid;',
$row = $conn->execQueryOne('SELECT vip_score FROM user WHERE accountid=:accountid;',
array(
':accountid' => $account_id,
));
@ -269,7 +270,7 @@ class PayController{
$vip_status = 0;
$vip_today_status = 0;
$vip = $this->getVip($i);
if ($row['sum_coin'] >= $vip['require']) {
if ($row['vip_score'] >= $vip['require']) {
$vip_level = $vip['level'];
$vip_icon = $vip['vipicon'];
}
@ -296,7 +297,7 @@ class PayController{
}
$v = $this->getVip($vip_level + 1);
$sum = $v['require'];
$coin_num = $sum - $row['sum_coin'];
$coin_num = $sum - $row['vip_score'];
echo json_encode(array(
'errcode' => 0,
'errmsg'=> '',
@ -380,7 +381,7 @@ class PayController{
return;
}
}
$row = $conn->execQueryOne('SELECT sum_coin FROM user WHERE accountid=:accountid;',
$row = $conn->execQueryOne('SELECT vip_score FROM user WHERE accountid=:accountid;',
array(
':accountid' => $account_id,
));
@ -389,7 +390,7 @@ class PayController{
return;
}
if ($vip['require'] > $row['sum_coin']) {
if ($vip['require'] > $row['vip_score']) {
phpcommon\sendError(ERR_USER_BASE + 4, '没有达到vip要求');
return;
}
@ -696,5 +697,97 @@ class PayController{
'errmsg'=> '',
));
}
public function getVipExp()
{
$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 vip_score FROM user WHERE accountid=:accountid;',
array(
':accountid' => $account_id,
));
if (!$row) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return;
}
$ret = $conn->execScript('UPDATE user SET vip_score=:vip_score, modify_time=:modify_time ' .
' WHERE accountid=:accountid;',
array(
':accountid' => $account_id,
':modify_time' => time(),
':vip_score' => $row['vip_score'] + 1
));
if (!$ret) {
die();
return;
}
echo json_encode(array(
'errcode' => 0,
'errmsg'=> '',
));
}
public function buyPassBook()
{
$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=:accountid;',
array(
':accountid' => $account_id,
));
if (!$row) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return;
}
$item = $this->getItem(10005);
if (!$item) {
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个道具');
return;
}
//扣除钻石
if ($row['diamond_num'] < $item['dprice']) {
phpcommon\sendError(ERR_USER_BASE + 3, '钻石不足');
return;
}
$ret = $conn->execScript('UPDATE user SET diamond_num=:diamond_num, modify_time=:modify_time ' .
' WHERE accountid=:accountid;',
array(
':accountid' => $account_id,
':diamond_num' => $row['diamond_num'] - $item['dprice'],
':modify_time' => time()
));
if (!$ret) {
die();
return;
}
//添加通行证
$addreward = new classes\AddReward();
$addreward->addReward(10005, 1, $account_id);
echo json_encode(array(
'errcode' => 0,
'errmsg'=> '',
'status' => 1,
));
}
}
?>

View File

@ -63,6 +63,8 @@ class RankController{
$integral_rank = 0;
$integral_list = array();
$score = 0;
$myname = '';
$myavatar_url = '';
//个人信息
$row = $conn->execQueryOne('SELECT user_name, avatar_url, kills, alive_time, harm, win_times, game_times, integral FROM user ' .
' WHERE accountid=:accountid;',
@ -79,10 +81,27 @@ class RankController{
break;
}
}
if ($row['avatar_url'] == '') {
$address = '../res/robot@robot' . 1 . '.php';
$robot_meta_cluster = require($address);
$i = Rand(1, 100);
$robot_id = 1000 + $i;
$robot_meta = getRobotConfig($robot_meta_cluster, $robot_id);
$rob = array(
'name' => $robot_meta['name'],
'avatar_url' => $robot_meta['avatar_url'],
);
$myname = $rob['name'];
$myavatar_url = $rob['avatar_url'];
} else {
$myname = $row['user_name'];
$myavatar_url = $row['avatar_url'];
}
array_push($user_list, array(
'account_id' => $account_id,
'name' => $row['user_name'],
'avatar_url' => $row['avatar_url'],
'name' => $myname,
'avatar_url' => $myavatar_url,
'kill' => phpcommon\safediv($row['kills'], $row['game_times']),
'alive'=> phpcommon\safediv($row['alive_time'], $row['game_times']),
'harm' => phpcommon\safediv($row['harm'], $row['game_times']),
@ -99,16 +118,39 @@ class RankController{
$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] == '') {
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'],
);
$name = $rob['name'];
$avatar_url = $rob['avatar_url'];
}
} else {
$name = $kill_db[$i][1];
$avatar_url = $kill_db[$i][2];
}
array_push($kill_list, array(
'account_id' => $kill_db[$i][0],
'name' => $kill_db[$i][1],
'avatar_url' => $kill_db[$i][2],
'name' => $name,
'avatar_url' => $avatar_url,
'kill' => $kill_db[$i][3],
'alive'=> $kill_db[$i][4],
'harm' => $kill_db[$i][5],
@ -124,16 +166,39 @@ class RankController{
$win_db = json_decode($win_rank_db);
$i = 0;
foreach ($win_db as $win) {
$name = '';
$avatar_url = '';
if ($i > 49) {
break;
}
if ($win_db[$i][0] == $account_id) {
$win_rank = $i + 1;
}
if ($win_db[$i][2] == '') {
if ($win_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'],
);
$name = $rob['name'];
$avatar_url = $rob['avatar_url'];
}
} else {
$name = $win_db[$i][1];
$avatar_url = $win_db[$i][2];
}
array_push($win_list, array(
'account_id' => $win_db[$i][0],
'name' => $win_db[$i][1],
'avatar_url' => $win_db[$i][2],
'name' => $name,
'avatar_url' => $avatar_url,
'kill' => $win_db[$i][3],
'alive'=> $win_db[$i][4],
'harm' => $win_db[$i][5],
@ -148,6 +213,8 @@ class RankController{
$integral_db = json_decode($integral_rank_db);
$i = 0;
foreach ($integral_db as $integral) {
$name = '';
$avatar_url = '';
if ($i > 49) {
break;
}
@ -166,10 +233,31 @@ class RankController{
if ($integral_db[$i][0] == $account_id) {
$integral_rank = $i + 1;
}
if ($integral_db[$i][2] == '') {
if ($integral_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'],
);
$name = $rob['name'];
$avatar_url = $rob['avatar_url'];
}
} else {
$name = $integral_db[$i][1];
$avatar_url = $integral_db[$i][2];
}
array_push($integral_list, array(
'account_id' => $integral_db[$i][0],
'name' => $integral_db[$i][1],
'avatar_url' => $integral_db[$i][2],
'name' => $name,
'avatar_url' => $avatar_url,
'kill' => $integral_db[$i][3],
'alive'=> $integral_db[$i][4],
'harm' => $integral_db[$i][5],

View File

@ -100,9 +100,9 @@ class RoleController{
':accountid' => $account_id
));
if (!$row) {
$ret = $conn->execScript('INSERT INTO user(accountid, user_name, avatar_url, game_times, win_times, kills, harm, add_HP, alive_time, coin_num, integral, kill_his, alive_time_his, harm_his, add_HP_his, act_share_time, act_share_status, create_time, modify_time, first_fight, collect_status, keys_num, battle_re_times, shop_flush_times, kefu_status, sign_sum, box_num, diamond_num, sum_coin, pass_status, score, season_status, recharge_times_total, first_gift, season_time, free_coin, free_diamond, season_end_score) ' .
' VALUES(:accountid, :user_name, :avatar_url, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, :create_time, :modify_time, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0) ' .
' ON DUPLICATE KEY UPDATE accountid=:accountid, user_name=:user_name, avatar_url=:avatar_url, game_times=0, win_times=0, kills=0, harm=0, add_HP=0, alive_time=0, coin_num=0, integral=0, kill_his=0, alive_time_his=0, harm_his=0, add_HP_his=0, act_share_time=0, act_share_status=0, modify_time=:modify_time, first_fight=0, collect_status=0, keys_num=0, battle_re_times=0, shop_flush_times=0, kefu_status=0, sign_sum=0, box_num=0, diamond_num=0, sum_coin=0, pass_status=0, score=0, season_status=1, recharge_times_total=0, first_gift=0, season_time=0, free_coin=0, free_diamond=0, season_end_score=0;',
$ret = $conn->execScript('INSERT INTO user(accountid, user_name, avatar_url, game_times, win_times, kills, harm, add_HP, alive_time, coin_num, integral, kill_his, alive_time_his, harm_his, add_HP_his, act_share_time, act_share_status, create_time, modify_time, first_fight, collect_status, keys_num, battle_re_times, shop_flush_times, kefu_status, sign_sum, box_num, diamond_num, sum_coin, pass_status, score, season_status, recharge_times_total, first_gift, season_time, free_coin, free_diamond, season_end_score, kill_modifytime, win_modifytime, rank_modifytime, vip_score) ' .
' VALUES(:accountid, :user_name, :avatar_url, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, :create_time, :modify_time, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) ' .
' ON DUPLICATE KEY UPDATE accountid=:accountid, user_name=:user_name, avatar_url=:avatar_url, game_times=0, win_times=0, kills=0, harm=0, add_HP=0, alive_time=0, coin_num=0, integral=0, kill_his=0, alive_time_his=0, harm_his=0, add_HP_his=0, act_share_time=0, act_share_status=0, modify_time=:modify_time, first_fight=0, collect_status=0, keys_num=0, battle_re_times=0, shop_flush_times=0, kefu_status=0, sign_sum=0, box_num=0, diamond_num=0, sum_coin=0, pass_status=0, score=0, season_status=1, recharge_times_total=0, first_gift=0, season_time=0, free_coin=0, free_diamond=0, season_end_score=0, kill_modifytime=0, win_modifytime=0, rank_modifytime=0, vip_score=0;',
array(
':accountid' => $account_id,
':user_name' => $user_name,
@ -212,15 +212,58 @@ class RoleController{
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家1');
return;
}
//更新击杀信息时间
$k = 0;
if ($row['game_times'] != 0) {
$k = $row['kill_his'] / $row['game_times'];
}
if (($row['kill_his'] + $kills) / ($row['game_times'] + 1) != $k) {
$killret = $conn->execScript('UPDATE user SET kill_modifytime=:kill_modifytime ' .
' WHERE accountid=:accountid;',
array(
':accountid' => $account_id,
':kill_modifytime' => time(),
));
if (!$killret) {
die();
return;
}
}
//更新胜场信息时间
if ($rank == 1) {
$winret = $conn->execScript('UPDATE user SET win_times=:win_times, win_modifytime=:win_modifytime ' .
' WHERE accountid=:accountid;',
array(
':accountid' => $account_id,
':win_times' => $row['win_times'] + 1,
':win_modifytime' => time(),
));
if (!$winret) {
die();
return;
}
}
//更新排位积分信息时间
if ($integral != 0) {
$inret = $conn->execScript('UPDATE user SET integral=:integral, rank_modifytime=:rank_modifytime ' .
' WHERE accountid=:accountid;',
array(
':accountid' => $account_id,
':integral' => $row['integral'] + $integral,
':rank_modifytime' => time(),
));
if (!$inret) {
die();
return;
}
}
//更新历史最高信息
if ($kill_his < $row['kill_his']) {
$kill_his = $row['kill_his'];
}
if ($harm_his < $row['harm_his']) {
$harm_his = $row['harm_his'];
}
if ($rank == 1) {
$row['win_times']++;
}
if ($alive_time_his < $row['alive_time_his']) {
$alive_time_his = $row['alive_time_his'];
}
@ -232,11 +275,10 @@ class RoleController{
if ($row['box_num'] + 1 <= 20) {
$box_num = $row['box_num'] + 1;
}
$ret = $conn->execScript('UPDATE user SET game_times=:game_times, win_times=:win_times, kills=:kills, harm=:harm, add_HP=:add_HP, alive_time=:alive_time, kill_his=:kill_his, alive_time_his=:alive_time_his, harm_his=:harm_his, add_HP_his=:add_HP_his, coin_num=:coin_num, integral=:integral, modify_time=:modify_time, first_fight=1, box_num=:box_num, score=:score ' .
$ret = $conn->execScript('UPDATE user SET game_times=:game_times, kills=:kills, harm=:harm, add_HP=:add_HP, alive_time=:alive_time, kill_his=:kill_his, alive_time_his=:alive_time_his, harm_his=:harm_his, add_HP_his=:add_HP_his, coin_num=:coin_num, modify_time=:modify_time, first_fight=1, box_num=:box_num, score=:score ' .
' WHERE accountid=:accountid;',
array(
':game_times' => $row['game_times'] + 1,
':win_times' => $row['win_times'],
':kill_his' => $kill_his,
':kills' => $row['kills'] + $kills,
':harm_his' => $harm_his,
@ -247,7 +289,6 @@ class RoleController{
':add_HP_his' => $add_HP_his,
':accountid' => $account_id,
':coin_num' => $row['coin_num'] + $coin_num,
':integral' => $row['integral'] + $integral,
':modify_time' => time(),
':box_num' => $box_num,
':score' => $row['score'] + $score,

View File

@ -34,10 +34,16 @@ class VoiceController{
$r = $this->getRedis($md5);
$r->set('game2001:voice:' . $md5, $data);
$r -> pexpire('game2001:voice:' . $md5, 1000 * 600);
$url = '';
if (SERVER_ENV == _ONLINE) {
$url = "https://game2001api.kingsome.cn/webapp/index.php?c=Voice&a=download&res_id=" . $md5;
} else {
$url = "https://game2001api-test.kingsome.cn/webapp/index.php?c=Voice&a=download&res_id=" . $md5;
}
echo json_encode(array(
'errcode' => 0,
'errmsg' => '',
'download_url' => "https://game2001api.kingsome.cn/webapp/index.php?c=Voice&a=download&res_id=" . $md5
'download_url' => $url
));
}