first recharge info

This commit is contained in:
yangduo 2024-12-31 16:45:44 +08:00
parent 87ca99a9e1
commit 8302a392ce

View File

@ -3,7 +3,8 @@
require 'classes/Quest.php'; require 'classes/Quest.php';
require 'classes/AddReward.php'; require 'classes/AddReward.php';
require_once 'metatable/parameter.php'; require_once 'metatable/parameter.php';
class RoleController{ class RoleController
{
protected function getMysql($account_id) protected function getMysql($account_id)
{ {
@ -184,10 +185,12 @@ class RoleController{
$this->updateSwitch($account_id, $switch_id); $this->updateSwitch($account_id, $switch_id);
$row = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;', $row = $conn->execQueryOne(
'SELECT * FROM user WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id ':accountid' => $account_id
)); )
);
//$newInfo = array(); //$newInfo = array();
if (!$row) { if (!$row) {
$season_time = 0; $season_time = 0;
@ -199,7 +202,8 @@ class RoleController{
break; break;
} }
} }
$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, first_login, daily_first_login, daily_time, free_box, update_time, season_games, season_win, sea_max_kill, sea_max_hart, sea_avg_kill, free_lot_ticket, free_dou_lot_ticket, daily_order1, daily_order2, daily_order3, first_bee, newhand, coin_times, newInfo, first_day_ad, share_video_times, share_video_sums, act_video_status, act_ad_status, biogame_times, shop_view_times, new_first_equip, newhand2,game_times2, view_times2, guildcoin_num, new_second_equip, blobdata, cpa_times, daily_diamond_times) ' . $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, first_login, daily_first_login, daily_time, free_box, update_time, season_games, season_win, sea_max_kill, sea_max_hart, sea_avg_kill, free_lot_ticket, free_dou_lot_ticket, daily_order1, daily_order2, daily_order3, first_bee, newhand, coin_times, newInfo, first_day_ad, share_video_times, share_video_sums, act_video_status, act_ad_status, biogame_times, shop_view_times, new_first_equip, newhand2,game_times2, view_times2, guildcoin_num, new_second_equip, blobdata, cpa_times, daily_diamond_times) ' .
' VALUES(:accountid, :user_name, :avatar_url, 0, 0, 0, 0, 0, 0, 10000, 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, :season_time, 0, 0, 0, 0, 0, 0, 0, 0, 0, :daily_time, 0,:update_time,0,0,0,0,0,0,0,0,0,0,0,0,0,:newInfo,0,0,0,0,0,0,0,0,0,0,0,0,2,:blobdata, 0, 0) ' . ' VALUES(:accountid, :user_name, :avatar_url, 0, 0, 0, 0, 0, 0, 10000, 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, :season_time, 0, 0, 0, 0, 0, 0, 0, 0, 0, :daily_time, 0,:update_time,0,0,0,0,0,0,0,0,0,0,0,0,0,:newInfo,0,0,0,0,0,0,0,0,0,0,0,0,2,:blobdata, 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=:season_time, free_coin=0, free_diamond=0, season_end_score=0, kill_modifytime=0, win_modifytime=0, rank_modifytime=0, vip_score=0, first_login=0, daily_first_login=0, daily_time=:daily_time, free_box=0, update_time=:update_time, season_games=0, season_win=0, sea_max_kill=0, sea_max_hart=0, sea_avg_kill=0, free_lot_ticket=0, free_dou_lot_ticket=0, daily_order1=0, daily_order2=0, daily_order3=0, first_bee=0, newhand=0, coin_times=0, newInfo=:newInfo, first_day_ad=0, share_video_times=0, share_video_sums=0, act_video_status=0, act_ad_status=0, biogame_times=0, shop_view_times=0, new_first_equip=0, newhand2=0, game_times2=0,view_times2=0, guildcoin_num=0, new_second_equip=2, blobdata=:blobdata, cpa_times=0, daily_diamond_times=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=:season_time, free_coin=0, free_diamond=0, season_end_score=0, kill_modifytime=0, win_modifytime=0, rank_modifytime=0, vip_score=0, first_login=0, daily_first_login=0, daily_time=:daily_time, free_box=0, update_time=:update_time, season_games=0, season_win=0, sea_max_kill=0, sea_max_hart=0, sea_avg_kill=0, free_lot_ticket=0, free_dou_lot_ticket=0, daily_order1=0, daily_order2=0, daily_order3=0, first_bee=0, newhand=0, coin_times=0, newInfo=:newInfo, first_day_ad=0, share_video_times=0, share_video_sums=0, act_video_status=0, act_ad_status=0, biogame_times=0, shop_view_times=0, new_first_equip=0, newhand2=0, game_times2=0,view_times2=0, guildcoin_num=0, new_second_equip=2, blobdata=:blobdata, cpa_times=0, daily_diamond_times=0;',
array( array(
@ -213,7 +217,8 @@ class RoleController{
':newInfo' => '', ':newInfo' => '',
':season_time' => $season_time, ':season_time' => $season_time,
':blobdata' => '', ':blobdata' => '',
)); )
);
if (!$ret) { if (!$ret) {
die(); die();
return; return;
@ -277,26 +282,31 @@ class RoleController{
'blobdata' => '', 'blobdata' => '',
'cpa_times' => 0, 'cpa_times' => 0,
'daily_diamond_times' => 0, 'daily_diamond_times' => 0,
'first_recharge' => '',
)); ));
} else { } else {
if ($avatar_url != '') { if ($avatar_url != '') {
if ($user_name != $row['user_name']) { if ($user_name != $row['user_name']) {
$ret = $conn->execScript('UPDATE user SET user_name=:user_name, modify_time=:modify_time ' . $ret = $conn->execScript(
'UPDATE user SET user_name=:user_name, modify_time=:modify_time ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':user_name' => $user_name, ':user_name' => $user_name,
':modify_time' => time() ':modify_time' => time()
)); )
);
} }
if ($avatar_url != $row['avatar_url']) { if ($avatar_url != $row['avatar_url']) {
$ret = $conn->execScript('UPDATE user SET avatar_url=:avatar_url, modify_time=:modify_time ' . $ret = $conn->execScript(
'UPDATE user SET avatar_url=:avatar_url, modify_time=:modify_time ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':avatar_url' => $avatar_url, ':avatar_url' => $avatar_url,
':modify_time' => time() ':modify_time' => time()
)); )
);
} }
} }
$nowTime = phpcommon\getdayseconds(time()); $nowTime = phpcommon\getdayseconds(time());
@ -315,11 +325,13 @@ class RoleController{
} }
if ($row['vip_score'] >= 5 && $act_ad_status != 2) { if ($row['vip_score'] >= 5 && $act_ad_status != 2) {
$act_ad_status = 1; $act_ad_status = 1;
$ret = $conn->execScript('UPDATE user SET act_ad_status=:act_ad_status WHERE accountid=:accountid;', $ret = $conn->execScript(
'UPDATE user SET act_ad_status=:act_ad_status WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':act_ad_status' => $act_ad_status ':act_ad_status' => $act_ad_status
)); )
);
if (!$ret) { if (!$ret) {
die(); die();
return; return;
@ -332,7 +344,8 @@ class RoleController{
$cpa_list = $this->getCpa($row['blobdata'], $cpa_times); $cpa_list = $this->getCpa($row['blobdata'], $cpa_times);
$blobdata = $cpa_list['cpastr']; $blobdata = $cpa_list['cpastr'];
$cpa_times = $cpa_list['cpa_times']; $cpa_times = $cpa_list['cpa_times'];
$ret = $conn->execScript('UPDATE user SET daily_first_login=0, kefu_status=0, coin_times=0, ' . $ret = $conn->execScript(
'UPDATE user SET daily_first_login=0, kefu_status=0, coin_times=0, ' .
'modify_time=:modify_time, first_day_ad=0, share_video_times=0, new_second_equip=:new_second_equip, cpa_times=:cpa_times, blobdata=:blobdata, daily_diamond_times=0 WHERE accountid=:accountid;', 'modify_time=:modify_time, first_day_ad=0, share_video_times=0, new_second_equip=:new_second_equip, cpa_times=:cpa_times, blobdata=:blobdata, daily_diamond_times=0 WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
@ -340,7 +353,8 @@ class RoleController{
':new_second_equip' => $new_second_equip, ':new_second_equip' => $new_second_equip,
':blobdata' => $blobdata, ':blobdata' => $blobdata,
':cpa_times' => $cpa_times, ':cpa_times' => $cpa_times,
)); )
);
if (!$ret) { if (!$ret) {
die(); die();
return; return;
@ -355,10 +369,18 @@ class RoleController{
$this->updateSeasonStatus($account_id); $this->updateSeasonStatus($account_id);
} }
} }
$row = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;', $row = $conn->execQueryOne(
'SELECT * FROM user WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id ':accountid' => $account_id
)); )
);
$rechargerow = $conn->execQueryOne(
'SELECT * FROM recharge WHERE accountid=:accountid;',
array(
':accountid' => $account_id
)
);
echo json_encode(array( echo json_encode(array(
'errcode' => 0, 'errcode' => 0,
'errmsg' => '', 'errmsg' => '',
@ -417,6 +439,7 @@ class RoleController{
'blobdata' => $blobdata, 'blobdata' => $blobdata,
'cpa_times' => $cpa_times, 'cpa_times' => $cpa_times,
'daily_diamond_times' => $daily_diamond_times, 'daily_diamond_times' => $daily_diamond_times,
'first_recharge' => $rechargerow['first_data'],
)); ));
} }
} }
@ -469,7 +492,8 @@ class RoleController{
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
die(); die();
} }
$ret1 = $conn->execScript('INSERT INTO bag(accountid, id, color_id, status, num, active_time, create_time, modify_time) ' . $ret1 = $conn->execScript(
'INSERT INTO bag(accountid, id, color_id, status, num, active_time, create_time, modify_time) ' .
' VALUES(:account_id, :id, 0, :status, 200, :active_time, :create_time, :modify_time) ' . ' VALUES(:account_id, :id, 0, :status, 200, :active_time, :create_time, :modify_time) ' .
' ON DUPLICATE KEY UPDATE accountid=:account_id, id=:id, color_id=0, status=:status, num=200, active_time=:active_time, modify_time=:modify_time;', ' ON DUPLICATE KEY UPDATE accountid=:account_id, id=:id, color_id=0, status=:status, num=200, active_time=:active_time, modify_time=:modify_time;',
array( array(
@ -479,8 +503,10 @@ class RoleController{
':status' => 0, ':status' => 0,
':create_time' => time(), ':create_time' => time(),
':modify_time' => time() ':modify_time' => time()
)); )
$ret2 = $conn->execScript('INSERT INTO bag(accountid, id, color_id, status, num, active_time, create_time, modify_time) ' . );
$ret2 = $conn->execScript(
'INSERT INTO bag(accountid, id, color_id, status, num, active_time, create_time, modify_time) ' .
' VALUES(:account_id, :id, 0, :status, 0, :active_time, :create_time, :modify_time) ' . ' VALUES(:account_id, :id, 0, :status, 0, :active_time, :create_time, :modify_time) ' .
' ON DUPLICATE KEY UPDATE accountid=:account_id, id=:id, color_id=0, status=:status, num=0, active_time=:active_time, modify_time=:modify_time;', ' ON DUPLICATE KEY UPDATE accountid=:account_id, id=:id, color_id=0, status=:status, num=0, active_time=:active_time, modify_time=:modify_time;',
array( array(
@ -490,7 +516,8 @@ class RoleController{
':status' => 0, ':status' => 0,
':create_time' => time(), ':create_time' => time(),
':modify_time' => time() ':modify_time' => time()
)); )
);
} }
protected function updateSeasonStatus($account_id) protected function updateSeasonStatus($account_id)
{ {
@ -500,11 +527,13 @@ class RoleController{
die(); die();
} }
//刷新赛季奖励状态 //刷新赛季奖励状态
$rowUser = $conn->execQueryOne('SELECT season_time, pass_status, integral ' . $rowUser = $conn->execQueryOne(
'SELECT season_time, pass_status, integral ' .
' FROM user WHERE accountid=:accountid;', ' FROM user WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
)); )
);
if (time() > $rowUser['season_time'] && $rowUser['season_time'] != 0) { if (time() > $rowUser['season_time'] && $rowUser['season_time'] != 0) {
$season_meta_table = require('../res/season@season.php'); $season_meta_table = require('../res/season@season.php');
$end_time = 0; $end_time = 0;
@ -519,13 +548,16 @@ class RoleController{
$integral = 0; $integral = 0;
for ($j = 1; $j <= count($season_point_table); $j++) { for ($j = 1; $j <= count($season_point_table); $j++) {
$seasonpoint = $this->getSeasonPoint($j); $seasonpoint = $this->getSeasonPoint($j);
if ($rowUser['integral'] <= $seasonpoint['max'] || if (
$seasonpoint['max'] == -1) { $rowUser['integral'] <= $seasonpoint['max'] ||
$seasonpoint['max'] == -1
) {
$integral = $seasonpoint['topoint']; $integral = $seasonpoint['topoint'];
break; break;
} }
} }
$user_ret = $conn->execScript('UPDATE user SET pass_status=0, score=0, season_status=0, integral=:integral, season_end_score=:season_end_score, modify_time=:modify_time, season_games=0, sea_max_kill=0, sea_max_hart=0, sea_avg_kill=0, season_win=0, season_time=:season_time ' . $user_ret = $conn->execScript(
'UPDATE user SET pass_status=0, score=0, season_status=0, integral=:integral, season_end_score=:season_end_score, modify_time=:modify_time, season_games=0, sea_max_kill=0, sea_max_hart=0, sea_avg_kill=0, season_win=0, season_time=:season_time ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
@ -533,16 +565,19 @@ class RoleController{
':modify_time' => time(), ':modify_time' => time(),
':season_time' => $end_time, ':season_time' => $end_time,
':integral' => $integral ':integral' => $integral
)); )
);
if (!$user_ret) { if (!$user_ret) {
die(); die();
} }
$pass_ret = $conn->execScript('UPDATE passinfo SET active_status=0, honor_status=0, modify_time=:modify_time ' . $pass_ret = $conn->execScript(
'UPDATE passinfo SET active_status=0, honor_status=0, modify_time=:modify_time ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':modify_time' => time() ':modify_time' => time()
)); )
);
if (!$pass_ret) { if (!$pass_ret) {
die(); die();
} }
@ -558,13 +593,15 @@ class RoleController{
if ($daily_time == 0 || ($nowTime - phpcommon\getdayseconds($daily_time) > 0)) { if ($daily_time == 0 || ($nowTime - phpcommon\getdayseconds($daily_time) > 0)) {
$daily_first_login = 0; $daily_first_login = 0;
} }
$ret = $conn->execScript('UPDATE user SET daily_first_login=:daily_first_login, ' . $ret = $conn->execScript(
'UPDATE user SET daily_first_login=:daily_first_login, ' .
'modify_time=:modify_time WHERE accountid=:accountid;', 'modify_time=:modify_time WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':modify_time' => time(), ':modify_time' => time(),
':daily_first_login' => $daily_first_login, ':daily_first_login' => $daily_first_login,
)); )
);
if (!$ret) { if (!$ret) {
die(); die();
} }
@ -590,10 +627,12 @@ class RoleController{
$coin_num = $_REQUEST['coin_num']; //金币 $coin_num = $_REQUEST['coin_num']; //金币
$integral = $_REQUEST['rank_score']; //排位积分 $integral = $_REQUEST['rank_score']; //排位积分
$team_status = $_REQUEST['team_status']; $team_status = $_REQUEST['team_status'];
$row = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;', $row = $conn->execQueryOne(
'SELECT * FROM user WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id ':accountid' => $account_id
)); )
);
if (!$row) { if (!$row) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家1'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家1');
return; return;
@ -606,8 +645,10 @@ class RoleController{
$seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php');
for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) { for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) {
$seaPoint = $this->getSeasonPoint($ii); $seaPoint = $this->getSeasonPoint($ii);
if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max'] if (
|| $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1) { $row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max']
|| $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1
) {
$is_pro = $seaPoint['is_protect']; $is_pro = $seaPoint['is_protect'];
$min_score = $seaPoint['min']; $min_score = $seaPoint['min'];
} }
@ -615,13 +656,15 @@ class RoleController{
if ($is_pro == 1 && $min_score > $update_score) { if ($is_pro == 1 && $min_score > $update_score) {
$update_score = $min_score; $update_score = $min_score;
} }
$inret = $conn->execScript('UPDATE user SET integral=:integral, rank_modifytime=:rank_modifytime ' . $inret = $conn->execScript(
'UPDATE user SET integral=:integral, rank_modifytime=:rank_modifytime ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':integral' => $update_score, ':integral' => $update_score,
':rank_modifytime' => time(), ':rank_modifytime' => time(),
)); )
);
if (!$inret) { if (!$inret) {
die(); die();
return; return;
@ -633,12 +676,14 @@ class RoleController{
$k = $row['kill_his'] / $row['game_times']; $k = $row['kill_his'] / $row['game_times'];
} }
if (($row['kill_his'] + $kills) / ($row['game_times'] + 1) != $k) { if (($row['kill_his'] + $kills) / ($row['game_times'] + 1) != $k) {
$killret = $conn->execScript('UPDATE user SET kill_modifytime=:kill_modifytime ' . $killret = $conn->execScript(
'UPDATE user SET kill_modifytime=:kill_modifytime ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':kill_modifytime' => time(), ':kill_modifytime' => time(),
)); )
);
if (!$killret) { if (!$killret) {
die(); die();
return; return;
@ -646,14 +691,16 @@ class RoleController{
} }
//更新胜场信息时间 //更新胜场信息时间
if ($rank == 1) { if ($rank == 1) {
$winret = $conn->execScript('UPDATE user SET win_times=:win_times, season_win=:season_win, win_modifytime=:win_modifytime ' . $winret = $conn->execScript(
'UPDATE user SET win_times=:win_times, season_win=:season_win, win_modifytime=:win_modifytime ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':win_times' => $row['win_times'] + 1, ':win_times' => $row['win_times'] + 1,
':season_win' => $row['season_win'] + 1, ':season_win' => $row['season_win'] + 1,
':win_modifytime' => time(), ':win_modifytime' => time(),
)); )
);
if (!$winret) { if (!$winret) {
die(); die();
return; return;
@ -706,7 +753,8 @@ class RoleController{
} }
$game_times2++; $game_times2++;
} }
$ret = $conn->execScript('UPDATE user SET game_times=:game_times, kills=:kills, harm=:harm, alive_time=:alive_time, kill_his=:kill_his, alive_time_his=:alive_time_his, harm_his=:harm_his, coin_num=:coin_num, modify_time=:modify_time, first_fight=1, daily_time=:daily_time, season_games=:season_games, sea_max_kill=:sea_max_kill, sea_max_hart=:sea_max_hart, sea_avg_kill=:sea_avg_kill, newhand=:newhand, newhand2=:newhand2, game_times2=:game_times2 ' . $ret = $conn->execScript(
'UPDATE user SET game_times=:game_times, kills=:kills, harm=:harm, alive_time=:alive_time, kill_his=:kill_his, alive_time_his=:alive_time_his, harm_his=:harm_his, coin_num=:coin_num, modify_time=:modify_time, first_fight=1, daily_time=:daily_time, season_games=:season_games, sea_max_kill=:sea_max_kill, sea_max_hart=:sea_max_hart, sea_avg_kill=:sea_avg_kill, newhand=:newhand, newhand2=:newhand2, game_times2=:game_times2 ' .
'WHERE accountid=:accountid;', 'WHERE accountid=:accountid;',
array( array(
':game_times' => $row['game_times'] + 1, ':game_times' => $row['game_times'] + 1,
@ -727,7 +775,8 @@ class RoleController{
':newhand' => $newhand, ':newhand' => $newhand,
':newhand2' => $newhand2, ':newhand2' => $newhand2,
':game_times2' => $game_times2, ':game_times2' => $game_times2,
)); )
);
if (!$ret) { if (!$ret) {
die(); die();
return; return;
@ -755,7 +804,6 @@ class RoleController{
'errcode' => 0, 'errcode' => 0,
'errmsg' => '', 'errmsg' => '',
)); ));
} }
public function battleReport() public function battleReport()
@ -778,10 +826,12 @@ class RoleController{
$rank = $_REQUEST['rank']; $rank = $_REQUEST['rank'];
$ar = $this->getRankReward($rank); $ar = $this->getRankReward($rank);
$coin_num = $ar['zbmode_param']; $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 FROM user WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id ':accountid' => $account_id
)); )
);
if (!$row) { if (!$row) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家1'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家1');
return; return;
@ -800,7 +850,8 @@ class RoleController{
if ($daily_time == 0 || ($nowTime - phpcommon\getdayseconds($daily_time) > 0)) { if ($daily_time == 0 || ($nowTime - phpcommon\getdayseconds($daily_time) > 0)) {
$daily_time = time(); $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 ' .
'WHERE accountid=:accountid;', 'WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
@ -808,7 +859,8 @@ class RoleController{
':modify_time' => time(), ':modify_time' => time(),
':daily_time' => $daily_time, ':daily_time' => $daily_time,
':biogame_times' => $row['biogame_times'] + 1, ':biogame_times' => $row['biogame_times'] + 1,
)); )
);
if (!$ret) { if (!$ret) {
die(); die();
return; return;
@ -867,10 +919,12 @@ class RoleController{
if (!$map_tpl_name) { if (!$map_tpl_name) {
$map_tpl_name = ''; $map_tpl_name = '';
} }
$row = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;', $row = $conn->execQueryOne(
'SELECT * FROM user WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id ':accountid' => $account_id
)); )
);
if (!$row) { if (!$row) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家1'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家1');
return; return;
@ -881,12 +935,14 @@ class RoleController{
$k = $row['kill_his'] / $row['game_times']; $k = $row['kill_his'] / $row['game_times'];
} }
if (($row['kill_his'] + $kills) / ($row['game_times'] + 1) != $k) { if (($row['kill_his'] + $kills) / ($row['game_times'] + 1) != $k) {
$killret = $conn->execScript('UPDATE user SET kill_modifytime=:kill_modifytime ' . $killret = $conn->execScript(
'UPDATE user SET kill_modifytime=:kill_modifytime ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':kill_modifytime' => time(), ':kill_modifytime' => time(),
)); )
);
if (!$killret) { if (!$killret) {
die(); die();
return; return;
@ -894,14 +950,16 @@ class RoleController{
} }
//更新胜场信息时间 //更新胜场信息时间
if ($rank == 1) { if ($rank == 1) {
$winret = $conn->execScript('UPDATE user SET win_times=:win_times, season_win=:season_win, win_modifytime=:win_modifytime ' . $winret = $conn->execScript(
'UPDATE user SET win_times=:win_times, season_win=:season_win, win_modifytime=:win_modifytime ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':win_times' => $row['win_times'] + 1, ':win_times' => $row['win_times'] + 1,
':season_win' => $row['season_win'] + 1, ':season_win' => $row['season_win'] + 1,
':win_modifytime' => time(), ':win_modifytime' => time(),
)); )
);
if (!$winret) { if (!$winret) {
die(); die();
return; return;
@ -915,8 +973,10 @@ class RoleController{
$seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php');
for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) { for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) {
$seaPoint = $this->getSeasonPoint($ii); $seaPoint = $this->getSeasonPoint($ii);
if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max'] if (
|| $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1) { $row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max']
|| $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1
) {
$is_pro = $seaPoint['is_protect']; $is_pro = $seaPoint['is_protect'];
$min_score = $seaPoint['min']; $min_score = $seaPoint['min'];
} }
@ -924,13 +984,15 @@ class RoleController{
if ($is_pro == 1 && $min_score > $update_score) { if ($is_pro == 1 && $min_score > $update_score) {
$update_score = $min_score; $update_score = $min_score;
} }
$inret = $conn->execScript('UPDATE user SET integral=:integral, rank_modifytime=:rank_modifytime ' . $inret = $conn->execScript(
'UPDATE user SET integral=:integral, rank_modifytime=:rank_modifytime ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':integral' => $update_score, ':integral' => $update_score,
':rank_modifytime' => time(), ':rank_modifytime' => time(),
)); )
);
if (!$inret) { if (!$inret) {
die(); die();
return; return;
@ -997,7 +1059,8 @@ class RoleController{
$game_times2++; $game_times2++;
} }
$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, daily_time=:daily_time, season_games=:season_games, sea_max_kill=:sea_max_kill, sea_max_hart=:sea_max_hart, sea_avg_kill=:sea_avg_kill, newhand=:newhand, newhand2=:newhand2, game_times2=:game_times2 ' . $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, daily_time=:daily_time, season_games=:season_games, sea_max_kill=:sea_max_kill, sea_max_hart=:sea_max_hart, sea_avg_kill=:sea_avg_kill, newhand=:newhand, newhand2=:newhand2, game_times2=:game_times2 ' .
'WHERE accountid=:accountid;', 'WHERE accountid=:accountid;',
array( array(
':game_times' => $row['game_times'] + 1, ':game_times' => $row['game_times'] + 1,
@ -1022,7 +1085,8 @@ class RoleController{
':newhand' => $newhand, ':newhand' => $newhand,
':newhand2' => $newhand2, ':newhand2' => $newhand2,
':game_times2' => $game_times2, ':game_times2' => $game_times2,
)); )
);
if (!$ret) { if (!$ret) {
die(); die();
return; return;
@ -1072,15 +1136,19 @@ class RoleController{
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return; return;
} }
$rowCount = $conn->execQueryRowCount('SELECT * FROM history_record WHERE accountid=:accountid;', $rowCount = $conn->execQueryRowCount(
'SELECT * FROM history_record WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id ':accountid' => $account_id
)); )
);
if ($rowCount != 0) { if ($rowCount != 0) {
$rows = $conn->execQuery('SELECT * FROM history_record WHERE accountid=:account_id order by game_time desc limit 0,10;', $rows = $conn->execQuery(
'SELECT * FROM history_record WHERE accountid=:account_id order by game_time desc limit 0,10;',
array( array(
':account_id' => $account_id ':account_id' => $account_id
)); )
);
foreach ($rows as $row) { foreach ($rows as $row) {
array_push($record_list, array( array_push($record_list, array(
'map_name' => $row['map_name'], 'map_name' => $row['map_name'],
@ -1137,10 +1205,12 @@ class RoleController{
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return; return;
} }
$row = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;', $row = $conn->execQueryOne(
'SELECT * FROM user WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id ':accountid' => $account_id
)); )
);
if (!$row) { if (!$row) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return; return;
@ -1171,12 +1241,14 @@ class RoleController{
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return; return;
} }
$ret = $conn->execScript('UPDATE user SET collect_status=1, modify_time=:modify_time ' . $ret = $conn->execScript(
'UPDATE user SET collect_status=1, modify_time=:modify_time ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':modify_time' => time(), ':modify_time' => time(),
':accountid' => $account_id ':accountid' => $account_id
)); )
);
if (!$ret) { if (!$ret) {
die(); die();
return; return;
@ -1325,7 +1397,6 @@ class RoleController{
$switch_uuid = 'game2004api_switch:' . $account_id; $switch_uuid = 'game2004api_switch:' . $account_id;
$r->set($switch_uuid, $switch_id); $r->set($switch_uuid, $switch_id);
$r->pexpire($switch_uuid, 1000 * 3600 * 24); $r->pexpire($switch_uuid, 1000 * 3600 * 24);
} }
protected function getSwitch($account_id) protected function getSwitch($account_id)
@ -1382,10 +1453,12 @@ class RoleController{
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return; return;
} }
$row = $conn->execQueryOne('SELECT newhand, newhand2 FROM user WHERE accountid=:account_id;', $row = $conn->execQueryOne(
'SELECT newhand, newhand2 FROM user WHERE accountid=:account_id;',
array( array(
':account_id' => $account_id ':account_id' => $account_id
)); )
);
$type = 1; $type = 1;
if (isset($_REQUEST['type'])) { if (isset($_REQUEST['type'])) {
$type = $_REQUEST['type']; $type = $_REQUEST['type'];
@ -1397,12 +1470,14 @@ class RoleController{
phpcommon\sendError(ERR_USER_BASE + 2, '未达到领取条件'); phpcommon\sendError(ERR_USER_BASE + 2, '未达到领取条件');
return; return;
} }
$ret = $conn->execScript('UPDATE user SET newhand=2, modify_time=:modify_time ' . $ret = $conn->execScript(
'UPDATE user SET newhand=2, modify_time=:modify_time ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':modify_time' => time(), ':modify_time' => time(),
':accountid' => $account_id ':accountid' => $account_id
)); )
);
if (!$ret) { if (!$ret) {
die(); die();
return; return;
@ -1413,12 +1488,14 @@ class RoleController{
phpcommon\sendError(ERR_USER_BASE + 2, '未达到领取条件'); phpcommon\sendError(ERR_USER_BASE + 2, '未达到领取条件');
return; return;
} }
$ret = $conn->execScript('UPDATE user SET newhand2=2, modify_time=:modify_time ' . $ret = $conn->execScript(
'UPDATE user SET newhand2=2, modify_time=:modify_time ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':modify_time' => time(), ':modify_time' => time(),
':accountid' => $account_id ':accountid' => $account_id
)); )
);
if (!$ret) { if (!$ret) {
die(); die();
return; return;
@ -1490,7 +1567,8 @@ class RoleController{
. '_' . '_'
. md5($accountid . 'f3a6a9a5-217a-4079-ab99-b5d69b8212be' . $registertime . $nowtime) . md5($accountid . 'f3a6a9a5-217a-4079-ab99-b5d69b8212be' . $registertime . $nowtime)
. '_' . '_'
. md5('f3a6a9a5-217a-4079-ab99-b5d69b8212be' . md5(
'f3a6a9a5-217a-4079-ab99-b5d69b8212be'
. $accountid . $accountid
. $session_key . $session_key
. time() . time()
@ -1514,10 +1592,12 @@ class RoleController{
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return; return;
} }
$rowUser = $conn->execQueryOne('SELECT coin_times, coin_num FROM user WHERE accountid=:accountid;', $rowUser = $conn->execQueryOne(
'SELECT coin_times, coin_num FROM user WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
)); )
);
if (!$rowUser) { if (!$rowUser) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
@ -1529,11 +1609,13 @@ class RoleController{
$id = $_REQUEST['id']; $id = $_REQUEST['id'];
} }
$rowEquip = $conn->execQueryOne('SELECT id, lv FROM equip WHERE accountid=:accountid AND id=:id;', $rowEquip = $conn->execQueryOne(
'SELECT id, lv FROM equip WHERE accountid=:accountid AND id=:id;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':id' => $id, ':id' => $id,
)); )
);
if (!$rowEquip) { if (!$rowEquip) {
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个装备'); phpcommon\sendError(ERR_USER_BASE + 3, '没有这个装备');
return; return;
@ -1568,14 +1650,16 @@ class RoleController{
//$coin_num = $_REQUEST['num']; //$coin_num = $_REQUEST['num'];
//$coin_num = round($num * pow($val, $coin_times)); //$coin_num = round($num * pow($val, $coin_times));
//error_log($coin_num); //error_log($coin_num);
$ret = $conn->execScript('UPDATE user SET coin_times=:coin_times, coin_num=:coin_num, modify_time=:modify_time ' . $ret = $conn->execScript(
'UPDATE user SET coin_times=:coin_times, coin_num=:coin_num, modify_time=:modify_time ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':coin_times' => $coin_times + 1, ':coin_times' => $coin_times + 1,
':coin_num' => $coin_num + $rowUser['coin_num'], ':coin_num' => $coin_num + $rowUser['coin_num'],
':modify_time' => time() ':modify_time' => time()
)); )
);
if (!$ret) { if (!$ret) {
die(); die();
return; return;
@ -1605,10 +1689,12 @@ class RoleController{
} }
//$info = array(); //$info = array();
$id = $_REQUEST['id']; $id = $_REQUEST['id'];
$rowUser = $conn->execQueryOne('SELECT newInfo FROM user WHERE accountid=:accountid;', $rowUser = $conn->execQueryOne(
'SELECT newInfo FROM user WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
)); )
);
if (!$rowUser) { if (!$rowUser) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
@ -1619,13 +1705,15 @@ class RoleController{
$info = array(); $info = array();
} }
array_push($info, (int)$id); array_push($info, (int)$id);
$ret = $conn->execScript('UPDATE user SET newInfo=:newInfo,modify_time=:modify_time ' . $ret = $conn->execScript(
'UPDATE user SET newInfo=:newInfo,modify_time=:modify_time ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':newInfo' => json_encode($info), ':newInfo' => json_encode($info),
':modify_time' => time() ':modify_time' => time()
)); )
);
if (!$ret) { if (!$ret) {
die(); die();
return; return;
@ -1652,13 +1740,15 @@ class RoleController{
return; return;
} }
$num = $_REQUEST['num']; $num = $_REQUEST['num'];
$ret = $conn->execScript('UPDATE user SET first_day_ad=:first_day_ad,modify_time=:modify_time ' . $ret = $conn->execScript(
'UPDATE user SET first_day_ad=:first_day_ad,modify_time=:modify_time ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':first_day_ad' => $num, ':first_day_ad' => $num,
':modify_time' => time() ':modify_time' => time()
)); )
);
if (!$ret) { if (!$ret) {
die(); die();
return; return;
@ -1685,10 +1775,12 @@ class RoleController{
return; return;
} }
$rowUser = $conn->execQueryOne('SELECT diamond_num, share_video_times FROM user WHERE accountid=:accountid;', $rowUser = $conn->execQueryOne(
'SELECT diamond_num, share_video_times FROM user WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
)); )
);
if (!$rowUser) { if (!$rowUser) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
@ -1697,14 +1789,16 @@ class RoleController{
$p = $this->getParameter(SHARE_VIDEO_REWARD); $p = $this->getParameter(SHARE_VIDEO_REWARD);
$num = $p['param_value']; $num = $p['param_value'];
$ret = $conn->execScript('UPDATE user SET diamond_num=:diamond_num, share_video_times=:share_video_times, modify_time=:modify_time ' . $ret = $conn->execScript(
'UPDATE user SET diamond_num=:diamond_num, share_video_times=:share_video_times, modify_time=:modify_time ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':diamond_num' => $rowUser['diamond_num'] + $num, ':diamond_num' => $rowUser['diamond_num'] + $num,
':share_video_times' => $rowUser['share_video_times'] + 1, ':share_video_times' => $rowUser['share_video_times'] + 1,
':modify_time' => time() ':modify_time' => time()
)); )
);
if (!$ret) { if (!$ret) {
die(); die();
return; return;
@ -1736,22 +1830,26 @@ class RoleController{
return; return;
} }
$rowUser = $conn->execQueryOne('SELECT first_gift FROM user WHERE accountid=:accountid;', $rowUser = $conn->execQueryOne(
'SELECT first_gift FROM user WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
)); )
);
if (!$rowUser) { if (!$rowUser) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return; return;
} }
$ret = $conn->execScript('UPDATE user SET first_gift=1, modify_time=:modify_time ' . $ret = $conn->execScript(
'UPDATE user SET first_gift=1, modify_time=:modify_time ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':modify_time' => time() ':modify_time' => time()
)); )
);
if (!$ret) { if (!$ret) {
die(); die();
return; return;
@ -1816,10 +1914,12 @@ class RoleController{
return; return;
} }
$rowUser = $conn->execQueryOne('SELECT act_video_status FROM user WHERE accountid=:accountid;', $rowUser = $conn->execQueryOne(
'SELECT act_video_status FROM user WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
)); )
);
if (!$rowUser) { if (!$rowUser) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
@ -1830,12 +1930,14 @@ class RoleController{
return; return;
} }
$ret = $conn->execScript('UPDATE user SET act_video_status=2, modify_time=:modify_time ' . $ret = $conn->execScript(
'UPDATE user SET act_video_status=2, modify_time=:modify_time ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':modify_time' => time() ':modify_time' => time()
)); )
);
if (!$ret) { if (!$ret) {
die(); die();
return; return;
@ -1897,10 +1999,12 @@ class RoleController{
return; return;
} }
$rowUser = $conn->execQueryOne('SELECT act_ad_status FROM user WHERE accountid=:accountid;', $rowUser = $conn->execQueryOne(
'SELECT act_ad_status FROM user WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
)); )
);
if (!$rowUser) { if (!$rowUser) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
@ -1911,12 +2015,14 @@ class RoleController{
return; return;
} }
$ret = $conn->execScript('UPDATE user SET act_ad_status=2, modify_time=:modify_time ' . $ret = $conn->execScript(
'UPDATE user SET act_ad_status=2, modify_time=:modify_time ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':modify_time' => time() ':modify_time' => time()
)); )
);
if (!$ret) { if (!$ret) {
die(); die();
return; return;
@ -1972,36 +2078,37 @@ class RoleController{
if (!$login) { if (!$login) {
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效'); phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
return; return;
} }
$conn = $this->getMysql($account_id); $conn = $this->getMysql($account_id);
if (!$conn) { if (!$conn) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return; return;
} }
$row = $conn->execQueryOne('SELECT share_video_sums, act_video_status FROM user WHERE accountid=:accountid;', $row = $conn->execQueryOne(
'SELECT share_video_sums, act_video_status FROM user WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
)); )
);
if (!$row) { if (!$row) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return; return;
} }
$status = $row['act_video_status']; $status = $row['act_video_status'];
if ($row['share_video_sums'] + 1 >= 3 && $row['act_video_status'] < 1) { if ($row['share_video_sums'] + 1 >= 3 && $row['act_video_status'] < 1) {
$status = 1; $status = 1;
} }
$ret = $conn->execScript('UPDATE user SET share_video_sums=:share_video_sums, modify_time=:modify_time, act_video_status=:act_video_status ' . $ret = $conn->execScript(
'UPDATE user SET share_video_sums=:share_video_sums, modify_time=:modify_time, act_video_status=:act_video_status ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':modify_time' => time(), ':modify_time' => time(),
':share_video_sums' => $row['share_video_sums'] + 1, ':share_video_sums' => $row['share_video_sums'] + 1,
':act_video_status' => $status, ':act_video_status' => $status,
)); )
);
if (!$ret) { if (!$ret) {
die(); die();
return; return;
@ -2026,7 +2133,6 @@ class RoleController{
if (!$conn) { if (!$conn) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return; return;
} }
$addreward = new classes\AddReward(); $addreward = new classes\AddReward();
$item_list = array(); $item_list = array();
@ -2041,34 +2147,40 @@ class RoleController{
$p2 = $this->getParameter(OPENING_SPEAR2); $p2 = $this->getParameter(OPENING_SPEAR2);
$equip2 = $p2['param_value']; $equip2 = $p2['param_value'];
if ($equip1 == $id) { if ($equip1 == $id) {
$ret = $conn->execScript('UPDATE user SET new_first_equip=1, modify_time=:modify_time ' . $ret = $conn->execScript(
'UPDATE user SET new_first_equip=1, modify_time=:modify_time ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':modify_time' => time(), ':modify_time' => time(),
)); )
);
if (!$ret) { if (!$ret) {
die(); die();
return; return;
} }
$ret = $conn->execScript('UPDATE equip SET using_id=:using_id, modify_time=:modify_time ' . $ret = $conn->execScript(
'UPDATE equip SET using_id=:using_id, modify_time=:modify_time ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':using_id' => $id, ':using_id' => $id,
':modify_time' => time(), ':modify_time' => time(),
)); )
);
if (!$ret) { if (!$ret) {
die(); die();
return; return;
} }
} else if ($equip2 == $id) { } else if ($equip2 == $id) {
$ret = $conn->execScript('UPDATE user SET new_second_equip=1, modify_time=:modify_time ' . $ret = $conn->execScript(
'UPDATE user SET new_second_equip=1, modify_time=:modify_time ' .
' WHERE accountid=:accountid;', ' WHERE accountid=:accountid;',
array( array(
':accountid' => $account_id, ':accountid' => $account_id,
':modify_time' => time(), ':modify_time' => time(),
)); )
);
if (!$ret) { if (!$ret) {
die(); die();
return; return;
@ -2082,4 +2194,3 @@ class RoleController{
)); ));
} }
} }
?>