This commit is contained in:
wangwei01 2019-04-29 11:26:46 +08:00
parent 31d56723b9
commit 4fbe972560
2 changed files with 78 additions and 54 deletions

View File

@ -71,28 +71,28 @@ class RoleController{
public function battleReport()
{
$account_id = $_REQUEST['account_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'];
$account_id = $_REQUEST['account_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']; //救起队友次数
$conn = $this->getMysql($account_id);
$kill_his = $kills;
$harm_his = $harm;
$alive_time_his = $alive_time;
$add_HP_his = $add_HP;
$coin_num = $_REQUEST['coin_num'];
$coin_num = $_REQUEST['coin_num']; //金币
$integral = $_REQUEST['integral']; //积分
if (!$conn) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return;
@ -120,7 +120,7 @@ class RoleController{
if ($add_HP_his < $row['add_HP_his']) {
$add_HP_his = $row['add_HP_his'];
}
$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 ' .
$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 ' .
' WHERE accountid=:accountid;',
array(
':game_times' => $row['game_times']++,
@ -133,14 +133,16 @@ class RoleController{
':alive_time' => $row['alive_time'] + $alive_time,
':alive_time_his' => $alive_time_his,
':add_HP_his' => $add_HP_his,
':accountid' => $account_id
':accountid' => $account_id,
':coin_num' => $row['coin_num'] + $coin_num,
':integral' => $row['integral'] + $integral
));
if (!$ret) {
die();
return;
}
$ret = $conn->execScript('INSERT INTO history_record(accountid, map_name, game_time, rank, kills, harm, hurt, alive_time) ' .
' VALUES(:accountid, :map_name, :game_time, :rank, :kills, :harm, :hurt, :alive_time);',
$ret = $conn->execScript('INSERT INTO history_record(accountid, map_name, game_time, rank, kills, harm, hurt, alive_time, coin_num, integral) ' .
' VALUES(:accountid, :map_name, :game_time, :rank, :kills, :harm, :hurt, :alive_time, :coin_num, integral);',
array(
':accountid' => $account_id,
':game_time' => $game_time,
@ -148,18 +150,15 @@ class RoleController{
':kills' => $kills,
':harm' => $harm,
':hurt' => $hurt,
':alive_time' => $alive_time
':alive_time' => $alive_time,
':coin_num' => $coin_num,
':integral' => $integral
));
if (!$ret) {
die();
return;
}
$ret = $conn->execScript('UPDATE user SET coin_num=:coin_num ' .
' WHERE accountid=:accountid;',
array(
':accountid' => $account_id,
':coin_num' => $coin_num
));
//刷新任务
$quest = new classes\Quest();
$quest->triggerQuest(QUEST_DAY_FIGHT, 1, 1, $account_id);
@ -191,6 +190,14 @@ class RoleController{
$quest->triggerQuest(QUEST_SUM_FRITEAMWIN, 1, 1, $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 HistoryRecord()
@ -243,9 +250,32 @@ class RoleController{
$quest->triggerQuest(QUEST_SUM_SHARE, 1, 1, $account_id);
}
public function historyInfo()
{
$account_id = $_REQUEST['account_id'];
$conn = $this->getMysql($account_id);
if (!$conn) {
phpcommon\sendError(ERR_BASE_USER + 1, '没有这个玩家');
return;
}
$row = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;',
array(
':accountid' => $account_id
));
if (!$row) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return;
}
echo json_encode(array(
'errcode' => 0,
'errmsg' => '',
'kill_his' => $row['kill_his'],
'alive_time_his' => $row['alive_time_his'],
'harm_his' => $row['harm_his'],
'add_HP_his' => $row['add_HP_his']
));
}
}
?>

View File

@ -79,6 +79,20 @@ class SupplyBoxController{
':account_id' => $account_id
));
foreach ($rows as $row) {
if (phpcommon\getdayseconds(time()) - phpcommon\getdayseconds($row['last_buy_time']) > 0) {
$ret = $conn->execScript('UPDATE supplybox SET buy_times=:buy_times, last_buy_time=:time ' .
' WHERE accountid=:accountid AND box_id=:box_id;',
array(
':accountid' => $account_id,
':box_id' => $row['box_id'],
':buy_times' => 0,
':time' => time()
));
if (!$ret) {
die();
return;
}
}
array_push($box_list, array(
'box_id' => $row['box_id'],
'box_num' => $row['box_num'],
@ -243,31 +257,11 @@ class SupplyBoxController{
return;
}
} else {
if (phpcommon\getdayseconds(time()) - phpcommon\getdayseconds($row['last_buy_time']) > 0) {
$ret = $conn->execScript('UPDATE supplybox SET buy_times=:buy_times, last_buy_time=:time ' .
' WHERE accountid=:accountid AND box_id=:box_id;',
array(
':accountid' => $account_id,
':box_id' => $box_id,
':buy_times' => 0,
':time' => time()
));
if (!$ret) {
die();
return;
}
if ($coin_num < $s['price']) {
phpcommon\sendError(ERR_USER_BASE + 3, '金币不足');
return;
}
$buy_times = 1;
} else {
if ($coin_num < $s['price'] * pow($s['parameter'], ($row['box_num'] - 1))) {
phpcommon\sendError(ERR_USER_BASE + 3, '金币不足');
return;
}
$buy_times = $row['buy_times'] + 1;
if ($coin_num < $s['price'] * pow($s['parameter'], ($row['box_num'] - 1))) {
phpcommon\sendError(ERR_USER_BASE + 3, '金币不足');
return;
}
$buy_times = $row['buy_times'] + 1;
$box_num = $row['box_num'] + 1;
$ret = $conn->execScript('UPDATE supplybox SET box_num=:box_num, buy_times=:buy_times, last_buy_time=:time ' .
' WHERE accountid=:accountid AND box_id=:box_id;',