1
This commit is contained in:
parent
31d56723b9
commit
4fbe972560
@ -71,28 +71,28 @@ class RoleController{
|
|||||||
|
|
||||||
public function battleReport()
|
public function battleReport()
|
||||||
{
|
{
|
||||||
$account_id = $_REQUEST['account_id'];
|
$account_id = $_REQUEST['account_id']; //账号
|
||||||
$map_name = $_REQUEST['map_name'];
|
$map_name = $_REQUEST['map_name']; //地图名
|
||||||
$game_time = $_REQUEST['game_time'];
|
$game_time = $_REQUEST['game_time']; //游戏结束时间
|
||||||
$hurt = $_REQUEST['hurt'];
|
$hurt = $_REQUEST['hurt']; //承受伤害
|
||||||
$rank = $_REQUEST['rank'];
|
$rank = $_REQUEST['rank']; //排名
|
||||||
$kills = $_REQUEST['kills'];
|
$kills = $_REQUEST['kills']; //击杀数
|
||||||
$harm = $_REQUEST['harm'];
|
$harm = $_REQUEST['harm']; //伤害
|
||||||
$add_HP = $_REQUEST['add_HP'];
|
$add_HP = $_REQUEST['add_HP']; //治疗量
|
||||||
$alive_time = $_REQUEST['alive_time'];
|
$alive_time = $_REQUEST['alive_time']; //存活时间
|
||||||
$team_status = $_REQUEST['team_status'];
|
$team_status = $_REQUEST['team_status']; //是否是组队状态
|
||||||
$snipe_kill = $_REQUEST['snipe_kill'];
|
$snipe_kill = $_REQUEST['snipe_kill']; //狙击枪击杀数
|
||||||
$rifle_kill = $_REQUEST['rifle_kill'];
|
$rifle_kill = $_REQUEST['rifle_kill']; //步枪击杀数
|
||||||
$pistol_kill = $_REQUEST['pistol_kill'];
|
$pistol_kill = $_REQUEST['pistol_kill']; //手枪击杀数
|
||||||
$submachine_kill = $_REQUEST['submachine_kill'];
|
$submachine_kill = $_REQUEST['submachine_kill'];//冲锋枪击杀数
|
||||||
$rescue_member = $_REQUEST['rescue_member'];
|
$rescue_member = $_REQUEST['rescue_member']; //救起队友次数
|
||||||
$conn = $this->getMysql($account_id);
|
$conn = $this->getMysql($account_id);
|
||||||
$kill_his = $kills;
|
$kill_his = $kills;
|
||||||
$harm_his = $harm;
|
$harm_his = $harm;
|
||||||
$alive_time_his = $alive_time;
|
$alive_time_his = $alive_time;
|
||||||
$add_HP_his = $add_HP;
|
$add_HP_his = $add_HP;
|
||||||
$coin_num = $_REQUEST['coin_num'];
|
$coin_num = $_REQUEST['coin_num']; //金币
|
||||||
|
$integral = $_REQUEST['integral']; //积分
|
||||||
if (!$conn) {
|
if (!$conn) {
|
||||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||||
return;
|
return;
|
||||||
@ -120,7 +120,7 @@ class RoleController{
|
|||||||
if ($add_HP_his < $row['add_HP_his']) {
|
if ($add_HP_his < $row['add_HP_his']) {
|
||||||
$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;',
|
' WHERE accountid=:accountid;',
|
||||||
array(
|
array(
|
||||||
':game_times' => $row['game_times']++,
|
':game_times' => $row['game_times']++,
|
||||||
@ -133,14 +133,16 @@ class RoleController{
|
|||||||
':alive_time' => $row['alive_time'] + $alive_time,
|
':alive_time' => $row['alive_time'] + $alive_time,
|
||||||
':alive_time_his' => $alive_time_his,
|
':alive_time_his' => $alive_time_his,
|
||||||
':add_HP_his' => $add_HP_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) {
|
if (!$ret) {
|
||||||
die();
|
die();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$ret = $conn->execScript('INSERT INTO history_record(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);',
|
' VALUES(:accountid, :map_name, :game_time, :rank, :kills, :harm, :hurt, :alive_time, :coin_num, integral);',
|
||||||
array(
|
array(
|
||||||
':accountid' => $account_id,
|
':accountid' => $account_id,
|
||||||
':game_time' => $game_time,
|
':game_time' => $game_time,
|
||||||
@ -148,18 +150,15 @@ class RoleController{
|
|||||||
':kills' => $kills,
|
':kills' => $kills,
|
||||||
':harm' => $harm,
|
':harm' => $harm,
|
||||||
':hurt' => $hurt,
|
':hurt' => $hurt,
|
||||||
':alive_time' => $alive_time
|
':alive_time' => $alive_time,
|
||||||
|
':coin_num' => $coin_num,
|
||||||
|
':integral' => $integral
|
||||||
));
|
));
|
||||||
if (!$ret) {
|
if (!$ret) {
|
||||||
die();
|
die();
|
||||||
return;
|
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 = new classes\Quest();
|
||||||
$quest->triggerQuest(QUEST_DAY_FIGHT, 1, 1, $account_id);
|
$quest->triggerQuest(QUEST_DAY_FIGHT, 1, 1, $account_id);
|
||||||
@ -191,6 +190,14 @@ class RoleController{
|
|||||||
$quest->triggerQuest(QUEST_SUM_FRITEAMWIN, 1, 1, $account_id);
|
$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()
|
public function HistoryRecord()
|
||||||
@ -243,9 +250,32 @@ class RoleController{
|
|||||||
$quest->triggerQuest(QUEST_SUM_SHARE, 1, 1, $account_id);
|
$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']
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -79,6 +79,20 @@ class SupplyBoxController{
|
|||||||
':account_id' => $account_id
|
':account_id' => $account_id
|
||||||
));
|
));
|
||||||
foreach ($rows as $row) {
|
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(
|
array_push($box_list, array(
|
||||||
'box_id' => $row['box_id'],
|
'box_id' => $row['box_id'],
|
||||||
'box_num' => $row['box_num'],
|
'box_num' => $row['box_num'],
|
||||||
@ -243,31 +257,11 @@ class SupplyBoxController{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (phpcommon\getdayseconds(time()) - phpcommon\getdayseconds($row['last_buy_time']) > 0) {
|
if ($coin_num < $s['price'] * pow($s['parameter'], ($row['box_num'] - 1))) {
|
||||||
$ret = $conn->execScript('UPDATE supplybox SET buy_times=:buy_times, last_buy_time=:time ' .
|
phpcommon\sendError(ERR_USER_BASE + 3, '金币不足');
|
||||||
' WHERE accountid=:accountid AND box_id=:box_id;',
|
return;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
$buy_times = $row['buy_times'] + 1;
|
||||||
$box_num = $row['box_num'] + 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 ' .
|
$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;',
|
' WHERE accountid=:accountid AND box_id=:box_id;',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user