diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index 53ea7a6..68f2dee 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -3,7 +3,8 @@ require 'classes/Quest.php'; require 'classes/AddReward.php'; require_once 'metatable/parameter.php'; -class RoleController{ +class RoleController +{ protected function getMysql($account_id) { @@ -184,10 +185,12 @@ class RoleController{ $this->updateSwitch($account_id, $switch_id); - $row = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;', - array( - ':accountid' => $account_id - )); + $row = $conn->execQueryOne( + 'SELECT * FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id + ) + ); //$newInfo = array(); if (!$row) { $season_time = 0; @@ -199,21 +202,23 @@ class RoleController{ 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) ' . - ' 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;', - array( - ':accountid' => $account_id, - ':user_name' => $user_name, - ':avatar_url' => $avatar_url, - ':create_time' => time(), - ':modify_time' => time(), - ':daily_time' => 0, - ':update_time' => time(), - ':newInfo' => '', - ':season_time' => $season_time, - ':blobdata' => '', - )); + $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) ' . + ' 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( + ':accountid' => $account_id, + ':user_name' => $user_name, + ':avatar_url' => $avatar_url, + ':create_time' => time(), + ':modify_time' => time(), + ':daily_time' => 0, + ':update_time' => time(), + ':newInfo' => '', + ':season_time' => $season_time, + ':blobdata' => '', + ) + ); if (!$ret) { die(); return; @@ -269,34 +274,39 @@ class RoleController{ 'diamond_times' => 0, 'shop_view_times' => 0, 'new_first_equip' => 0, - 'newhand2' =>0, - 'game_times2'=>0, - 'view_times2'=>0, + 'newhand2' => 0, + 'game_times2' => 0, + 'view_times2' => 0, 'guildcoin_num' => 0, 'new_second_equip' => 2, 'blobdata' => '', 'cpa_times' => 0, 'daily_diamond_times' => 0, + 'first_recharge' => '', )); } else { if ($avatar_url != '') { if ($user_name != $row['user_name']) { - $ret = $conn->execScript('UPDATE user SET user_name=:user_name, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':user_name' => $user_name, - ':modify_time' => time() - )); + $ret = $conn->execScript( + 'UPDATE user SET user_name=:user_name, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':user_name' => $user_name, + ':modify_time' => time() + ) + ); } if ($avatar_url != $row['avatar_url']) { - $ret = $conn->execScript('UPDATE user SET avatar_url=:avatar_url, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':avatar_url' => $avatar_url, - ':modify_time' => time() - )); + $ret = $conn->execScript( + 'UPDATE user SET avatar_url=:avatar_url, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':avatar_url' => $avatar_url, + ':modify_time' => time() + ) + ); } } $nowTime = phpcommon\getdayseconds(time()); @@ -315,11 +325,13 @@ class RoleController{ } if ($row['vip_score'] >= 5 && $act_ad_status != 2) { $act_ad_status = 1; - $ret = $conn->execScript('UPDATE user SET act_ad_status=:act_ad_status WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':act_ad_status' => $act_ad_status - )); + $ret = $conn->execScript( + 'UPDATE user SET act_ad_status=:act_ad_status WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':act_ad_status' => $act_ad_status + ) + ); if (!$ret) { die(); return; @@ -332,15 +344,17 @@ class RoleController{ $cpa_list = $this->getCpa($row['blobdata'], $cpa_times); $blobdata = $cpa_list['cpastr']; $cpa_times = $cpa_list['cpa_times']; - $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;', - array( - ':accountid' => $account_id, - ':modify_time' => time(), - ':new_second_equip' => $new_second_equip, - ':blobdata' => $blobdata, - ':cpa_times' => $cpa_times, - )); + $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;', + array( + ':accountid' => $account_id, + ':modify_time' => time(), + ':new_second_equip' => $new_second_equip, + ':blobdata' => $blobdata, + ':cpa_times' => $cpa_times, + ) + ); if (!$ret) { die(); return; @@ -355,10 +369,18 @@ class RoleController{ $this->updateSeasonStatus($account_id); } } - $row = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;', - array( - ':accountid' => $account_id - )); + $row = $conn->execQueryOne( + 'SELECT * FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id + ) + ); + $rechargerow = $conn->execQueryOne( + 'SELECT * FROM recharge WHERE accountid=:accountid;', + array( + ':accountid' => $account_id + ) + ); echo json_encode(array( 'errcode' => 0, 'errmsg' => '', @@ -383,7 +405,7 @@ class RoleController{ 'sum_coin' => $row['sum_coin'], 'recharge_times_total' => $row['recharge_times_total'], 'first_login' => $row['first_login'], - 'daily_first_login' =>$daily_first_login, + 'daily_first_login' => $daily_first_login, 'vip_score' => $row['vip_score'], 'coin_nums' => $row['coin_num'], 'diamond_nums' => $row['diamond_num'], @@ -408,15 +430,16 @@ class RoleController{ 'biogame_times' => $row['biogame_times'], 'shop_view_times' => $row['shop_view_times'], 'new_first_equip' => $row['new_first_equip'], - 'newhand2' =>$row['newhand2'], - 'game_times2'=>$row['game_times2'], - 'view_times2'=>$row['view_times2'], - 'guildcoin_num'=> $row['guildcoin_num'], + 'newhand2' => $row['newhand2'], + 'game_times2' => $row['game_times2'], + 'view_times2' => $row['view_times2'], + 'guildcoin_num' => $row['guildcoin_num'], 'new_second_equip' => $new_second_equip, 'login_day' => floor(($nowTime - phpcommon\getdayseconds($row['create_time'])) / 3600 / 24), 'blobdata' => $blobdata, 'cpa_times' => $cpa_times, 'daily_diamond_times' => $daily_diamond_times, + 'first_recharge' => $rechargerow['first_data'], )); } } @@ -469,28 +492,32 @@ class RoleController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); die(); } - $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) ' . - ' 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( - ':account_id' => $account_id, - ':id' => 18006, - ':active_time' => 0, - ':status' => 0, - ':create_time' => time(), - ':modify_time' => 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) ' . - ' 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( - ':account_id' => $account_id, - ':id' => 16001, - ':active_time' => 0, - ':status' => 0, - ':create_time' => time(), - ':modify_time' => 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) ' . + ' 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( + ':account_id' => $account_id, + ':id' => 18006, + ':active_time' => 0, + ':status' => 0, + ':create_time' => time(), + ':modify_time' => 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) ' . + ' 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( + ':account_id' => $account_id, + ':id' => 16001, + ':active_time' => 0, + ':status' => 0, + ':create_time' => time(), + ':modify_time' => time() + ) + ); } protected function updateSeasonStatus($account_id) { @@ -500,11 +527,13 @@ class RoleController{ die(); } //刷新赛季奖励状态 - $rowUser = $conn->execQueryOne('SELECT season_time, pass_status, integral ' . - ' FROM user WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - )); + $rowUser = $conn->execQueryOne( + 'SELECT season_time, pass_status, integral ' . + ' FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ) + ); if (time() > $rowUser['season_time'] && $rowUser['season_time'] != 0) { $season_meta_table = require('../res/season@season.php'); $end_time = 0; @@ -519,30 +548,36 @@ class RoleController{ $integral = 0; for ($j = 1; $j <= count($season_point_table); $j++) { $seasonpoint = $this->getSeasonPoint($j); - if ($rowUser['integral'] <= $seasonpoint['max'] || - $seasonpoint['max'] == -1) { + if ( + $rowUser['integral'] <= $seasonpoint['max'] || + $seasonpoint['max'] == -1 + ) { $integral = $seasonpoint['topoint']; 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 ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':season_end_score' => $rowUser['integral'], - ':modify_time' => time(), - ':season_time' => $end_time, - ':integral' => $integral - )); + $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;', + array( + ':accountid' => $account_id, + ':season_end_score' => $rowUser['integral'], + ':modify_time' => time(), + ':season_time' => $end_time, + ':integral' => $integral + ) + ); if (!$user_ret) { die(); } - $pass_ret = $conn->execScript('UPDATE passinfo SET active_status=0, honor_status=0, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':modify_time' => time() - )); + $pass_ret = $conn->execScript( + 'UPDATE passinfo SET active_status=0, honor_status=0, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':modify_time' => time() + ) + ); if (!$pass_ret) { die(); } @@ -558,13 +593,15 @@ class RoleController{ if ($daily_time == 0 || ($nowTime - phpcommon\getdayseconds($daily_time) > 0)) { $daily_first_login = 0; } - $ret = $conn->execScript('UPDATE user SET daily_first_login=:daily_first_login, ' . - 'modify_time=:modify_time WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':modify_time' => time(), - ':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;', + array( + ':accountid' => $account_id, + ':modify_time' => time(), + ':daily_first_login' => $daily_first_login, + ) + ); if (!$ret) { die(); } @@ -590,10 +627,12 @@ class RoleController{ $coin_num = $_REQUEST['coin_num']; //金币 $integral = $_REQUEST['rank_score']; //排位积分 $team_status = $_REQUEST['team_status']; - $row = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;', - array( - ':accountid' => $account_id - )); + $row = $conn->execQueryOne( + 'SELECT * FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id + ) + ); if (!$row) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家1'); return; @@ -606,8 +645,10 @@ class RoleController{ $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) { $seaPoint = $this->getSeasonPoint($ii); - if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max'] - || $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1) { + if ( + $row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max'] + || $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1 + ) { $is_pro = $seaPoint['is_protect']; $min_score = $seaPoint['min']; } @@ -615,13 +656,15 @@ class RoleController{ if ($is_pro == 1 && $min_score > $update_score) { $update_score = $min_score; } - $inret = $conn->execScript('UPDATE user SET integral=:integral, rank_modifytime=:rank_modifytime ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':integral' => $update_score, - ':rank_modifytime' => time(), - )); + $inret = $conn->execScript( + 'UPDATE user SET integral=:integral, rank_modifytime=:rank_modifytime ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':integral' => $update_score, + ':rank_modifytime' => time(), + ) + ); if (!$inret) { die(); return; @@ -633,12 +676,14 @@ class RoleController{ $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(), - )); + $killret = $conn->execScript( + 'UPDATE user SET kill_modifytime=:kill_modifytime ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':kill_modifytime' => time(), + ) + ); if (!$killret) { die(); return; @@ -646,14 +691,16 @@ class RoleController{ } //更新胜场信息时间 if ($rank == 1) { - $winret = $conn->execScript('UPDATE user SET win_times=:win_times, season_win=:season_win, win_modifytime=:win_modifytime ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':win_times' => $row['win_times'] + 1, - ':season_win' => $row['season_win'] + 1, - ':win_modifytime' => time(), - )); + $winret = $conn->execScript( + 'UPDATE user SET win_times=:win_times, season_win=:season_win, win_modifytime=:win_modifytime ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':win_times' => $row['win_times'] + 1, + ':season_win' => $row['season_win'] + 1, + ':win_modifytime' => time(), + ) + ); if (!$winret) { die(); return; @@ -706,28 +753,30 @@ class RoleController{ } $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;', - array( - ':game_times' => $row['game_times'] + 1, - ':kill_his' => $kill_his, - ':kills' => $row['kills'] + $kills, - ':harm_his' => $harm_his, - ':harm' => $row['harm'] + $harm, - ':alive_time' => $row['alive_time'] + $alive_time, - ':alive_time_his' => $alive_time_his, - ':accountid' => $account_id, - ':coin_num' => $row['coin_num'] + $coin_num, - ':modify_time' => time(), - ':daily_time' => $daily_time, - ':season_games' => $row['season_games'] + 1, - ':sea_max_kill' => $sea_max_kill, - ':sea_max_hart' => $sea_max_hart, - ':sea_avg_kill' => $row['sea_avg_kill'] + $kills, - ':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;', + array( + ':game_times' => $row['game_times'] + 1, + ':kill_his' => $kill_his, + ':kills' => $row['kills'] + $kills, + ':harm_his' => $harm_his, + ':harm' => $row['harm'] + $harm, + ':alive_time' => $row['alive_time'] + $alive_time, + ':alive_time_his' => $alive_time_his, + ':accountid' => $account_id, + ':coin_num' => $row['coin_num'] + $coin_num, + ':modify_time' => time(), + ':daily_time' => $daily_time, + ':season_games' => $row['season_games'] + 1, + ':sea_max_kill' => $sea_max_kill, + ':sea_max_hart' => $sea_max_hart, + ':sea_avg_kill' => $row['sea_avg_kill'] + $kills, + ':newhand' => $newhand, + ':newhand2' => $newhand2, + ':game_times2' => $game_times2, + ) + ); if (!$ret) { die(); return; @@ -755,7 +804,6 @@ class RoleController{ 'errcode' => 0, 'errmsg' => '', )); - } public function battleReport() @@ -778,10 +826,12 @@ 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;', - array( - ':accountid' => $account_id - )); + $row = $conn->execQueryOne( + 'SELECT daily_time, coin_num, biogame_times FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id + ) + ); if (!$row) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家1'); return; @@ -800,15 +850,17 @@ 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 ' . - 'WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':coin_num' => $row['coin_num'] + $coin_num, - ':modify_time' => time(), - ':daily_time' => $daily_time, - ':biogame_times' => $row['biogame_times'] + 1, - )); + $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;', + array( + ':accountid' => $account_id, + ':coin_num' => $row['coin_num'] + $coin_num, + ':modify_time' => time(), + ':daily_time' => $daily_time, + ':biogame_times' => $row['biogame_times'] + 1, + ) + ); if (!$ret) { die(); return; @@ -846,7 +898,7 @@ class RoleController{ $snipe_kill = $_REQUEST['snipe_kill']; //狙击枪击杀数 $rifle_kill = $_REQUEST['rifle_kill']; //步枪击杀数 $pistol_kill = $_REQUEST['pistol_kill']; //手枪击杀数 - $submachine_kill = $_REQUEST['submachine_kill'];//冲锋枪击杀数 + $submachine_kill = $_REQUEST['submachine_kill']; //冲锋枪击杀数 $rescue_member = $_REQUEST['rescue_member']; //救起队友次数 $kill_his = $kills; $harm_his = $harm; @@ -867,10 +919,12 @@ class RoleController{ if (!$map_tpl_name) { $map_tpl_name = ''; } - $row = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;', - array( - ':accountid' => $account_id - )); + $row = $conn->execQueryOne( + 'SELECT * FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id + ) + ); if (!$row) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家1'); return; @@ -881,12 +935,14 @@ class RoleController{ $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(), - )); + $killret = $conn->execScript( + 'UPDATE user SET kill_modifytime=:kill_modifytime ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':kill_modifytime' => time(), + ) + ); if (!$killret) { die(); return; @@ -894,14 +950,16 @@ class RoleController{ } //更新胜场信息时间 if ($rank == 1) { - $winret = $conn->execScript('UPDATE user SET win_times=:win_times, season_win=:season_win, win_modifytime=:win_modifytime ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':win_times' => $row['win_times'] + 1, - ':season_win' => $row['season_win'] + 1, - ':win_modifytime' => time(), - )); + $winret = $conn->execScript( + 'UPDATE user SET win_times=:win_times, season_win=:season_win, win_modifytime=:win_modifytime ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':win_times' => $row['win_times'] + 1, + ':season_win' => $row['season_win'] + 1, + ':win_modifytime' => time(), + ) + ); if (!$winret) { die(); return; @@ -915,8 +973,10 @@ class RoleController{ $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) { $seaPoint = $this->getSeasonPoint($ii); - if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max'] - || $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1) { + if ( + $row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max'] + || $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1 + ) { $is_pro = $seaPoint['is_protect']; $min_score = $seaPoint['min']; } @@ -924,13 +984,15 @@ class RoleController{ if ($is_pro == 1 && $min_score > $update_score) { $update_score = $min_score; } - $inret = $conn->execScript('UPDATE user SET integral=:integral, rank_modifytime=:rank_modifytime ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':integral' => $update_score, - ':rank_modifytime' => time(), - )); + $inret = $conn->execScript( + 'UPDATE user SET integral=:integral, rank_modifytime=:rank_modifytime ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':integral' => $update_score, + ':rank_modifytime' => time(), + ) + ); if (!$inret) { die(); return; @@ -997,32 +1059,34 @@ class RoleController{ $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;', - array( - ':game_times' => $row['game_times'] + 1, - ':kill_his' => $kill_his, - ':kills' => $row['kills'] + $kills, - ':harm_his' => $harm_his, - ':harm' => $row['harm'] + $harm, - ':add_HP' => $row['add_HP'] + $add_HP, - ':alive_time' => $row['alive_time'] + $alive_time, - ':alive_time_his' => $alive_time_his, - ':add_HP_his' => $add_HP_his, - ':accountid' => $account_id, - ':coin_num' => $row['coin_num'] + $coin_num, - ':modify_time' => time(), - ':box_num' => $box_num, - ':score' => $row['score'] + $score, - ':daily_time' => $daily_time, - ':season_games' => $row['season_games'] + 1, - ':sea_max_kill' => $sea_max_kill, - ':sea_max_hart' => $sea_max_hart, - ':sea_avg_kill' => $row['sea_avg_kill'] + $kills, - ':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;', + array( + ':game_times' => $row['game_times'] + 1, + ':kill_his' => $kill_his, + ':kills' => $row['kills'] + $kills, + ':harm_his' => $harm_his, + ':harm' => $row['harm'] + $harm, + ':add_HP' => $row['add_HP'] + $add_HP, + ':alive_time' => $row['alive_time'] + $alive_time, + ':alive_time_his' => $alive_time_his, + ':add_HP_his' => $add_HP_his, + ':accountid' => $account_id, + ':coin_num' => $row['coin_num'] + $coin_num, + ':modify_time' => time(), + ':box_num' => $box_num, + ':score' => $row['score'] + $score, + ':daily_time' => $daily_time, + ':season_games' => $row['season_games'] + 1, + ':sea_max_kill' => $sea_max_kill, + ':sea_max_hart' => $sea_max_hart, + ':sea_avg_kill' => $row['sea_avg_kill'] + $kills, + ':newhand' => $newhand, + ':newhand2' => $newhand2, + ':game_times2' => $game_times2, + ) + ); if (!$ret) { die(); return; @@ -1072,15 +1136,19 @@ class RoleController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - $rowCount = $conn->execQueryRowCount('SELECT * FROM history_record WHERE accountid=:accountid;', - array( - ':accountid' => $account_id - )); + $rowCount = $conn->execQueryRowCount( + 'SELECT * FROM history_record WHERE accountid=:accountid;', + array( + ':accountid' => $account_id + ) + ); if ($rowCount != 0) { - $rows = $conn->execQuery('SELECT * FROM history_record WHERE accountid=:account_id order by game_time desc limit 0,10;', - array( - ':account_id' => $account_id - )); + $rows = $conn->execQuery( + 'SELECT * FROM history_record WHERE accountid=:account_id order by game_time desc limit 0,10;', + array( + ':account_id' => $account_id + ) + ); foreach ($rows as $row) { array_push($record_list, array( 'map_name' => $row['map_name'], @@ -1137,10 +1205,12 @@ class RoleController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - $row = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;', - array( - ':accountid' => $account_id - )); + $row = $conn->execQueryOne( + 'SELECT * FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id + ) + ); if (!$row) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; @@ -1171,12 +1241,14 @@ class RoleController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - $ret = $conn->execScript('UPDATE user SET collect_status=1, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':modify_time' => time(), - ':accountid' => $account_id - )); + $ret = $conn->execScript( + 'UPDATE user SET collect_status=1, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':modify_time' => time(), + ':accountid' => $account_id + ) + ); if (!$ret) { die(); return; @@ -1300,7 +1372,7 @@ class RoleController{ 'sex' => $robot_meta['sex'] ); - array_push ($member, array( + array_push($member, array( 'account_id' => $rob['id'], 'name' => $rob['name'], 'avatar_url' => $rob['avatar_url'], @@ -1323,9 +1395,8 @@ class RoleController{ return; } $switch_uuid = 'game2004api_switch:' . $account_id; - $r -> set($switch_uuid, $switch_id); - $r -> pexpire($switch_uuid, 1000 * 3600 * 24); - + $r->set($switch_uuid, $switch_id); + $r->pexpire($switch_uuid, 1000 * 3600 * 24); } protected function getSwitch($account_id) @@ -1363,7 +1434,7 @@ class RoleController{ $coin_num = $addreward->getCoinNum($account_id); echo json_encode(array( 'errcode' => 0, - 'errmsg'=> '', + 'errmsg' => '', 'coin_nums' => $coin_num, )); } @@ -1382,10 +1453,12 @@ class RoleController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - $row = $conn->execQueryOne('SELECT newhand, newhand2 FROM user WHERE accountid=:account_id;', - array( - ':account_id' => $account_id - )); + $row = $conn->execQueryOne( + 'SELECT newhand, newhand2 FROM user WHERE accountid=:account_id;', + array( + ':account_id' => $account_id + ) + ); $type = 1; if (isset($_REQUEST['type'])) { $type = $_REQUEST['type']; @@ -1397,12 +1470,14 @@ class RoleController{ phpcommon\sendError(ERR_USER_BASE + 2, '未达到领取条件'); return; } - $ret = $conn->execScript('UPDATE user SET newhand=2, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':modify_time' => time(), - ':accountid' => $account_id - )); + $ret = $conn->execScript( + 'UPDATE user SET newhand=2, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':modify_time' => time(), + ':accountid' => $account_id + ) + ); if (!$ret) { die(); return; @@ -1413,12 +1488,14 @@ class RoleController{ phpcommon\sendError(ERR_USER_BASE + 2, '未达到领取条件'); return; } - $ret = $conn->execScript('UPDATE user SET newhand2=2, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':modify_time' => time(), - ':accountid' => $account_id - )); + $ret = $conn->execScript( + 'UPDATE user SET newhand2=2, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':modify_time' => time(), + ':accountid' => $account_id + ) + ); if (!$ret) { die(); return; @@ -1447,7 +1524,7 @@ class RoleController{ $addreward = new classes\AddReward(); foreach ($item_list as $item) { $items = $addreward->addReward($item['item_id'], $item['item_num'], $account_id, $item['time'], 0); - foreach($items as $i) { + foreach ($items as $i) { array_push($all_item_list, array( 'item_id' => $i['item_id'], 'item_num' => $i['item_num'], @@ -1459,7 +1536,7 @@ class RoleController{ $num = $addreward->getDiamondNum($account_id); echo json_encode(array( 'errcode' => 0, - 'errmsg'=> '', + 'errmsg' => '', 'item_list' => $item_list, 'coin_num' => $coin_num, 'diamond_nums' => $num, @@ -1475,7 +1552,7 @@ class RoleController{ $session_id = $this->createSessionId($account_id, $registertime, $session_key); echo json_encode(array( 'errcode' => 0, - 'errmsg'=> '', + 'errmsg' => '', 'session_id' => $session_id, )); } @@ -1485,17 +1562,18 @@ class RoleController{ $nowtime = time(); // error_log($accountid . 'f3a6a9a5-217a-4079-ab99-b5d69b8212be' . $registertime . $nowtime); $session_id = $nowtime - . '_' - . $registertime - . '_' - . md5($accountid . 'f3a6a9a5-217a-4079-ab99-b5d69b8212be' . $registertime . $nowtime) - . '_' - . md5('f3a6a9a5-217a-4079-ab99-b5d69b8212be' - . $accountid - . $session_key - . time() - . rand() - ); + . '_' + . $registertime + . '_' + . md5($accountid . 'f3a6a9a5-217a-4079-ab99-b5d69b8212be' . $registertime . $nowtime) + . '_' + . md5( + 'f3a6a9a5-217a-4079-ab99-b5d69b8212be' + . $accountid + . $session_key + . time() + . rand() + ); return $session_id; } @@ -1514,10 +1592,12 @@ class RoleController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - $rowUser = $conn->execQueryOne('SELECT coin_times, coin_num FROM user WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - )); + $rowUser = $conn->execQueryOne( + 'SELECT coin_times, coin_num FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ) + ); if (!$rowUser) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); @@ -1529,11 +1609,13 @@ class RoleController{ $id = $_REQUEST['id']; } - $rowEquip = $conn->execQueryOne('SELECT id, lv FROM equip WHERE accountid=:accountid AND id=:id;', - array( - ':accountid' => $account_id, - ':id' => $id, - )); + $rowEquip = $conn->execQueryOne( + 'SELECT id, lv FROM equip WHERE accountid=:accountid AND id=:id;', + array( + ':accountid' => $account_id, + ':id' => $id, + ) + ); if (!$rowEquip) { phpcommon\sendError(ERR_USER_BASE + 3, '没有这个装备'); return; @@ -1568,14 +1650,16 @@ class RoleController{ //$coin_num = $_REQUEST['num']; //$coin_num = round($num * pow($val, $coin_times)); //error_log($coin_num); - $ret = $conn->execScript('UPDATE user SET coin_times=:coin_times, coin_num=:coin_num, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':coin_times' => $coin_times + 1, - ':coin_num' => $coin_num + $rowUser['coin_num'], - ':modify_time' => time() - )); + $ret = $conn->execScript( + 'UPDATE user SET coin_times=:coin_times, coin_num=:coin_num, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':coin_times' => $coin_times + 1, + ':coin_num' => $coin_num + $rowUser['coin_num'], + ':modify_time' => time() + ) + ); if (!$ret) { die(); return; @@ -1605,10 +1689,12 @@ class RoleController{ } //$info = array(); $id = $_REQUEST['id']; - $rowUser = $conn->execQueryOne('SELECT newInfo FROM user WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - )); + $rowUser = $conn->execQueryOne( + 'SELECT newInfo FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ) + ); if (!$rowUser) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); @@ -1619,13 +1705,15 @@ class RoleController{ $info = array(); } array_push($info, (int)$id); - $ret = $conn->execScript('UPDATE user SET newInfo=:newInfo,modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':newInfo' => json_encode($info), - ':modify_time' => time() - )); + $ret = $conn->execScript( + 'UPDATE user SET newInfo=:newInfo,modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':newInfo' => json_encode($info), + ':modify_time' => time() + ) + ); if (!$ret) { die(); return; @@ -1652,13 +1740,15 @@ class RoleController{ return; } $num = $_REQUEST['num']; - $ret = $conn->execScript('UPDATE user SET first_day_ad=:first_day_ad,modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':first_day_ad' => $num, - ':modify_time' => time() - )); + $ret = $conn->execScript( + 'UPDATE user SET first_day_ad=:first_day_ad,modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':first_day_ad' => $num, + ':modify_time' => time() + ) + ); if (!$ret) { die(); return; @@ -1685,10 +1775,12 @@ class RoleController{ return; } - $rowUser = $conn->execQueryOne('SELECT diamond_num, share_video_times FROM user WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - )); + $rowUser = $conn->execQueryOne( + 'SELECT diamond_num, share_video_times FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ) + ); if (!$rowUser) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); @@ -1697,14 +1789,16 @@ class RoleController{ $p = $this->getParameter(SHARE_VIDEO_REWARD); $num = $p['param_value']; - $ret = $conn->execScript('UPDATE user SET diamond_num=:diamond_num, share_video_times=:share_video_times, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':diamond_num' => $rowUser['diamond_num'] + $num, - ':share_video_times' => $rowUser['share_video_times'] + 1, - ':modify_time' => time() - )); + $ret = $conn->execScript( + 'UPDATE user SET diamond_num=:diamond_num, share_video_times=:share_video_times, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':diamond_num' => $rowUser['diamond_num'] + $num, + ':share_video_times' => $rowUser['share_video_times'] + 1, + ':modify_time' => time() + ) + ); if (!$ret) { die(); return; @@ -1715,7 +1809,7 @@ class RoleController{ $diamond_num = $addreward->getDiamondNum($account_id); echo json_encode(array( 'errcode' => 0, - 'errmsg'=> '', + 'errmsg' => '', 'diamond_nums' => $diamond_num, )); @@ -1736,22 +1830,26 @@ class RoleController{ return; } - $rowUser = $conn->execQueryOne('SELECT first_gift FROM user WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - )); + $rowUser = $conn->execQueryOne( + 'SELECT first_gift FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ) + ); if (!$rowUser) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - $ret = $conn->execScript('UPDATE user SET first_gift=1, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':modify_time' => time() - )); + $ret = $conn->execScript( + 'UPDATE user SET first_gift=1, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':modify_time' => time() + ) + ); if (!$ret) { die(); return; @@ -1774,7 +1872,7 @@ class RoleController{ )); - foreach($items as $i) { + foreach ($items as $i) { array_push($all_item_list, array( 'item_id' => $i['item_id'], 'item_num' => $i['item_num'], @@ -1782,7 +1880,7 @@ class RoleController{ )); } $items = $addreward->addReward(10003, 88, $account_id, 0, 0); - foreach($items as $i) { + foreach ($items as $i) { array_push($all_item_list, array( 'item_id' => $i['item_id'], 'item_num' => $i['item_num'], @@ -1793,8 +1891,8 @@ class RoleController{ $diamond_num = $addreward->getDiamondNum($account_id); echo json_encode(array( 'errcode' => 0, - 'errmsg'=> '', - 'item_list'=>$item_list, + 'errmsg' => '', + 'item_list' => $item_list, 'all_item_list' => $all_item_list, 'diamond_nums' => $diamond_num, 'flag' => 1, @@ -1816,26 +1914,30 @@ class RoleController{ return; } - $rowUser = $conn->execQueryOne('SELECT act_video_status FROM user WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - )); + $rowUser = $conn->execQueryOne( + 'SELECT act_video_status FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ) + ); if (!$rowUser) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - if ($rowUser['act_video_status'] != 1){ + if ($rowUser['act_video_status'] != 1) { phpcommon\sendError(ERR_USER_BASE + 2, '奖励不可领取'); return; } - $ret = $conn->execScript('UPDATE user SET act_video_status=2, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':modify_time' => time() - )); + $ret = $conn->execScript( + 'UPDATE user SET act_video_status=2, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':modify_time' => time() + ) + ); if (!$ret) { die(); return; @@ -1844,13 +1946,13 @@ class RoleController{ $addreward = new classes\AddReward(); $item_list = array(); $all_item_list = array(); - array_push($item_list,array( + array_push($item_list, array( 'item_id' => 13018, 'item_num' => 1, 'time' => 0 )); $items = $addreward->addReward(13018, 1, $account_id, 0, 0); - foreach($items as $i) { + foreach ($items as $i) { array_push($all_item_list, array( 'item_id' => $i['item_id'], 'item_num' => $i['item_num'], @@ -1858,13 +1960,13 @@ class RoleController{ )); } - array_push($item_list,array( + array_push($item_list, array( 'item_id' => 15018, 'item_num' => 1, 'time' => 0 )); $items = $addreward->addReward(15018, 1, $account_id, 0, 0); - foreach($items as $i) { + foreach ($items as $i) { array_push($all_item_list, array( 'item_id' => $i['item_id'], 'item_num' => $i['item_num'], @@ -1874,7 +1976,7 @@ class RoleController{ $diamond_num = $addreward->getDiamondNum($account_id); echo json_encode(array( 'errcode' => 0, - 'errmsg'=> '', + 'errmsg' => '', 'diamond_nums' => $diamond_num, 'item_list' => $item_list, 'all_item_list' => $all_item_list, @@ -1897,26 +1999,30 @@ class RoleController{ return; } - $rowUser = $conn->execQueryOne('SELECT act_ad_status FROM user WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - )); + $rowUser = $conn->execQueryOne( + 'SELECT act_ad_status FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ) + ); if (!$rowUser) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - if ($rowUser['act_ad_status'] != 1){ + if ($rowUser['act_ad_status'] != 1) { phpcommon\sendError(ERR_USER_BASE + 2, '奖励不可领取'); return; } - $ret = $conn->execScript('UPDATE user SET act_ad_status=2, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':modify_time' => time() - )); + $ret = $conn->execScript( + 'UPDATE user SET act_ad_status=2, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':modify_time' => time() + ) + ); if (!$ret) { die(); return; @@ -1925,13 +2031,13 @@ class RoleController{ $addreward = new classes\AddReward(); $item_list = array(); $all_item_list = array(); - array_push($item_list,array( + array_push($item_list, array( 'item_id' => 13003, 'item_num' => 1, 'time' => 0 )); $items = $addreward->addReward(13003, 1, $account_id, 0, 0); - foreach($items as $i) { + foreach ($items as $i) { array_push($all_item_list, array( 'item_id' => $i['item_id'], 'item_num' => $i['item_num'], @@ -1939,13 +2045,13 @@ class RoleController{ )); } - array_push($item_list,array( + array_push($item_list, array( 'item_id' => 15003, 'item_num' => 1, 'time' => 0 )); $items = $addreward->addReward(15003, 1, $account_id, 0, 0); - foreach($items as $i) { + foreach ($items as $i) { array_push($all_item_list, array( 'item_id' => $i['item_id'], 'item_num' => $i['item_num'], @@ -1956,7 +2062,7 @@ class RoleController{ $diamond_num = $addreward->getDiamondNum($account_id); echo json_encode(array( 'errcode' => 0, - 'errmsg'=> '', + 'errmsg' => '', 'diamond_nums' => $diamond_num, 'item_list' => $item_list, 'all_item_list' => $all_item_list, @@ -1972,43 +2078,44 @@ class RoleController{ 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 share_video_sums, act_video_status FROM user WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, + $row = $conn->execQueryOne( + 'SELECT share_video_sums, act_video_status FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, - )); + ) + ); if (!$row) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; - } $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; } - $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;', - array( - ':accountid' => $account_id, - ':modify_time' => time(), - ':share_video_sums' => $row['share_video_sums'] + 1, - ':act_video_status' => $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;', + array( + ':accountid' => $account_id, + ':modify_time' => time(), + ':share_video_sums' => $row['share_video_sums'] + 1, + ':act_video_status' => $status, + ) + ); if (!$ret) { die(); return; } echo json_encode(array( 'errcode' => 0, - 'errmsg'=> '', + 'errmsg' => '', )); } @@ -2026,7 +2133,6 @@ class RoleController{ if (!$conn) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; - } $addreward = new classes\AddReward(); $item_list = array(); @@ -2041,34 +2147,40 @@ class RoleController{ $p2 = $this->getParameter(OPENING_SPEAR2); $equip2 = $p2['param_value']; if ($equip1 == $id) { - $ret = $conn->execScript('UPDATE user SET new_first_equip=1, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':modify_time' => time(), - )); + $ret = $conn->execScript( + 'UPDATE user SET new_first_equip=1, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':modify_time' => time(), + ) + ); if (!$ret) { die(); return; } - $ret = $conn->execScript('UPDATE equip SET using_id=:using_id, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':using_id' => $id, - ':modify_time' => time(), - )); + $ret = $conn->execScript( + 'UPDATE equip SET using_id=:using_id, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':using_id' => $id, + ':modify_time' => time(), + ) + ); if (!$ret) { die(); return; } } else if ($equip2 == $id) { - $ret = $conn->execScript('UPDATE user SET new_second_equip=1, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':modify_time' => time(), - )); + $ret = $conn->execScript( + 'UPDATE user SET new_second_equip=1, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':modify_time' => time(), + ) + ); if (!$ret) { die(); return; @@ -2076,10 +2188,9 @@ class RoleController{ } echo json_encode(array( 'errcode' => 0, - 'errmsg'=> '', + 'errmsg' => '', 'item_list' => $item_list, 'all_item_list' => $all_item_list, )); } } -?>