From 7d52ce5bedce9d439ce829f02303ac2dd392cf28 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Mon, 11 Jan 2021 10:56:58 +0800 Subject: [PATCH] 1 --- webapp/classes/AddReward.php | 20 +++-- .../controller/ActivityController.class.php | 87 +++++++++++-------- .../controller/BaseAuthedController.class.php | 2 +- webapp/controller/EquipController.class.php | 38 ++++---- .../controller/GameOverController.class.php | 39 +++++++++ webapp/controller/HangController.class.php | 18 +++- .../NewPayActivityController.class.php | 44 ++++++---- webapp/controller/RoleController.class.php | 7 +- 8 files changed, 174 insertions(+), 81 deletions(-) diff --git a/webapp/classes/AddReward.php b/webapp/classes/AddReward.php index 479e472..49dcccc 100644 --- a/webapp/classes/AddReward.php +++ b/webapp/classes/AddReward.php @@ -497,10 +497,14 @@ class AddReward { $active_time = 0; } if ($t == 0) { - $status = $this->getStatus($item_id, $status,$accountid); + if ($item_id >= 14000 && $item_id < 15000) { + $status = $this->getStatus($item_id, $status,$accountid); + } } else if ($t == 1){ - $status = 0; - $this->updateStatus($item_id, $accountid); + if ($item_id >= 14000 && $item_id < 15000) { + $status = 0; + $this->updateStatus($item_id, $accountid); + } } $ret = $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) ' . @@ -537,10 +541,14 @@ class AddReward { } } if ($t == 0) { - $status = $this->getStatus($item_id, $status,$accountid); + if ($item_id >= 14000 && $item_id < 15000) { + $status = $this->getStatus($item_id, $status,$accountid); + } } else if ($t == 1){ - $status = 0; - $this->updateStatus($item_id, $accountid); + if ($item_id >= 14000 && $item_id < 15000) { + $status = 0; + $this->updateStatus($item_id, $accountid); + } } $ret = $conn->execScript('UPDATE bag SET active_time=:active_time, status=:status, modify_time=:modify_time ' . ' WHERE accountid=:account_id AND id=:id;', diff --git a/webapp/controller/ActivityController.class.php b/webapp/controller/ActivityController.class.php index f34e066..7f0b857 100644 --- a/webapp/controller/ActivityController.class.php +++ b/webapp/controller/ActivityController.class.php @@ -4,6 +4,7 @@ require 'classes/Quest.php'; require 'classes/AddReward.php'; require_once 'metatable/drop.php'; require_once 'metatable/draw.php'; +require_once 'metatable/parameter.php'; class ActivityController extends BaseAuthedController { @@ -1200,7 +1201,7 @@ class ActivityController extends BaseAuthedController { ':accountid' => $account_id, ':id' => $id, )); - if (!$row) { + if (!$row) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } @@ -1214,6 +1215,7 @@ class ActivityController extends BaseAuthedController { $times = 1; $extra_id = 0; $isfree = false; + $item_list = array(); if ($type == 0) { $cost = explode(':', $dr['onecost']); if ($rowd && $rowd['free_times'] != 0) { @@ -1223,50 +1225,67 @@ class ActivityController extends BaseAuthedController { $cost = explode(':', $dr['tencost']); $extra_id = $dr['ten_drop']; $times = 9; + if (isset($_REQUEST['isnew']) && $_REQUEST['isnew'] == 1) { + if ($id == 1) { + $drop_id = metatable\getParameterByName('newbie_draw_cloth1'); + $extra_id = metatable\getParameterByName('newbie_draw_cloth10'); + $times = 8; + array_push($item_list, array( + 'item_id' => 15001, + 'item_num' => 1, + 'time' => 0, + )); + } else if ($id == 2) { + $drop_id = metatable\getParameterByName('newbie_draw_arms1'); + $extra_id = metatable\getParameterByName('newbie_draw_arms10'); + } + } } $coin_num = $row['coin_num']; $rmb_num = $row['rmb_num']; $draw_times = $rowd['draw_times'] + 1; $free_times = $rowd['free_times']; - if (!$isfree) { - if ($cost[0] == 10001) { - if ($row['coin_num'] < $cost[1]) { - phpcommon\sendError(ERR_USER_BASE + 2, '金币不足'); - return; + if (isset($_REQUEST['isnew']) && $_REQUEST['isnew'] == 1) { + } else { + if (!$isfree) { + if ($cost[0] == 10001) { + if ($row['coin_num'] < $cost[1]) { + phpcommon\sendError(ERR_USER_BASE + 2, '金币不足'); + return; + } + $coin_num = $row['coin_num'] - $cost[1]; + } else if ($cost[0] == 10003) { + if ($row['rmb_num'] < $cost[1]) { + phpcommon\sendError(ERR_USER_BASE + 3, '点券不足'); + return; + } + $rmb_num = $row['rmb_num'] - $cost[1]; } - $coin_num = $row['coin_num'] - $cost[1]; - } else if ($cost[0] == 10003) { - if ($row['rmb_num'] < $cost[1]) { - phpcommon\sendError(ERR_USER_BASE + 3, '点券不足'); - return; - } - $rmb_num = $row['rmb_num'] - $cost[1]; + $ret = $conn->execScript('UPDATE user SET coin_num=:coin_num, rmb_num=:rmb_num, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':coin_num' => $coin_num, + ':rmb_num' => $rmb_num, + ':modify_time' => phpcommon\getNowTime() + )); + } else { + $free_times = $rowd['free_times'] - 1; } - $ret = $conn->execScript('UPDATE user SET coin_num=:coin_num, rmb_num=:rmb_num, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', + $ret = $conn->execScript('UPDATE draw SET free_times=:free_times, draw_times=:draw_times, modifytime=:modifytime ' . + ' WHERE accountid=:accountid AND id=:id;', array( ':accountid' => $account_id, - ':coin_num' => $coin_num, - ':rmb_num' => $rmb_num, - ':modify_time' => phpcommon\getNowTime() + ':free_times' => $free_times, + ':draw_times' => $draw_times, + ':id' => $id, + ':modifytime' => phpcommon\getNowTime() )); - } else { - $free_times = $rowd['free_times'] - 1; + if (!$ret) { + die(); + return; + } } - $ret = $conn->execScript('UPDATE draw SET free_times=:free_times, draw_times=:draw_times, modifytime=:modifytime ' . - ' WHERE accountid=:accountid AND id=:id;', - array( - ':accountid' => $account_id, - ':free_times' => $free_times, - ':draw_times' => $draw_times, - ':id' => $id, - ':modifytime' => phpcommon\getNowTime() - )); - if (!$ret) { - die(); - return; - } - $item_list = array(); if ($times == 1) { if ($draw_times % 10 == 0) { $item_list = metatable\getDropAllListById($extra_id, $item_list); diff --git a/webapp/controller/BaseAuthedController.class.php b/webapp/controller/BaseAuthedController.class.php index 2127ac2..6b12cab 100644 --- a/webapp/controller/BaseAuthedController.class.php +++ b/webapp/controller/BaseAuthedController.class.php @@ -82,7 +82,7 @@ class BaseAuthedController extends BaseController { $row = phpcommon\SqlHelper::selectOne ($this->getSelfMysql(), 'user', - array($fields), + $fields, array( 'accountid' => $this->getAccountId() ) diff --git a/webapp/controller/EquipController.class.php b/webapp/controller/EquipController.class.php index 42d84f7..c233f59 100644 --- a/webapp/controller/EquipController.class.php +++ b/webapp/controller/EquipController.class.php @@ -98,28 +98,28 @@ class EquipController extends BaseAuthedController { if (!$rows) { //新玩家装备数据 //$id = $addreward->getRealIndexid(12151, $account_id); - $id = 23001; - $ret = $conn->execScript('INSERT INTO equip(accountid, id, lv, active_time, sub_time, create_time, modify_time, using_id, exp) ' . - ' VALUES(:account_id, :id, 0, :active_time, :sub_time, :create_time, :modify_time, :using_id, 0) ' . - ' ON DUPLICATE KEY UPDATE accountid=:account_id, id=:id, lv=0, active_time=:active_time, sub_time=:sub_time, modify_time=:modify_time, using_id=:using_id, exp=0;', - array( - ':account_id' => $account_id, - ':id' => $id, - ':active_time' => 0, - ':create_time' => phpcommon\getNowTime(), - ':modify_time' => phpcommon\getNowTime(), - ':sub_time' => 0, - ':using_id' => $id, - )); - if(!$ret){ - die(); - return; - } + // $id = 23001; + // $ret = $conn->execScript('INSERT INTO equip(accountid, id, lv, active_time, sub_time, create_time, modify_time, using_id, exp) ' . + // ' VALUES(:account_id, :id, 0, :active_time, :sub_time, :create_time, :modify_time, :using_id, 0) ' . + // ' ON DUPLICATE KEY UPDATE accountid=:account_id, id=:id, lv=0, active_time=:active_time, sub_time=:sub_time, modify_time=:modify_time, using_id=:using_id, exp=0;', + // array( + // ':account_id' => $account_id, + // ':id' => $id, + // ':active_time' => 0, + // ':create_time' => phpcommon\getNowTime(), + // ':modify_time' => phpcommon\getNowTime(), + // ':sub_time' => 0, + // ':using_id' => $id, + // )); + // if(!$ret){ + // die(); + // return; + // } array_push($equip_list, array( - 'id' => $id, + 'id' => 0, 'lv' => 0, 'active_time' => 0, - 'using_id' => $id, + 'using_id' => 0, 'exp' => 0, 'time_flag' => 0, )); diff --git a/webapp/controller/GameOverController.class.php b/webapp/controller/GameOverController.class.php index ec7daa7..94fd91e 100644 --- a/webapp/controller/GameOverController.class.php +++ b/webapp/controller/GameOverController.class.php @@ -586,4 +586,43 @@ class GameOverController extends BaseAuthedController { 'errmsg'=> '', )); } + + public function addGameTimes() + { + $row = phpcommon\SqlHelper::selectOne + ($this->getSelfMysql(), + 'user', + array( + 'game_times', + ), + array( + 'accountid' => $this->getAccountId() + ) + ); + if (!$row) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + + $ret = phpcommon\SqlHelper::update + ($this->getSelfMysql(), + 'user', + array( + 'accountid' => $this->getAccountId() + ), + array( + 'game_times' => $row['game_times'] + 1, + 'modify_time' => $this->getNowTime() + ) + ); + if (!$ret) { + die(); + return; + } + echo json_encode(array( + 'errcode' => 0, + 'errmsg'=> '', + 'game_times' => $row['game_times'] + 1, + )); + } } diff --git a/webapp/controller/HangController.class.php b/webapp/controller/HangController.class.php index ea7a740..ab62afd 100644 --- a/webapp/controller/HangController.class.php +++ b/webapp/controller/HangController.class.php @@ -449,6 +449,7 @@ class HangController extends BaseAuthedController { return; } $num = 0; + $onlinetime = phpcommon\getNowTime(); } else { $addreward = new classes\AddReward(); $p_num = $this->getParameter(OFFLINE_REWARD_NUMBER); @@ -462,6 +463,7 @@ class HangController extends BaseAuthedController { } $val2 = $addreward->getVipVal($account_id, 6); $num = floor($num + $num * $val2 / 100); + $onlinetime = $row['hang_time']; } $cost = metatable\getParameterByName('season_card_cost'); echo json_encode(array( @@ -489,6 +491,7 @@ class HangController extends BaseAuthedController { 'pass_array' => $pass_array, 'onlinenum' => $num, 'max_rank' => $max_rank, + 'onlinetime' => $onlinetime, )); } @@ -509,6 +512,18 @@ class HangController extends BaseAuthedController { $num = 0; $item_list = array(); $all_item_list = array(); + $rowuser = $conn->execQueryOne('SELECT game_times FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id + )); + if (!$rowuser || $rowuser['game_times'] < metatable\getParameterByName('function_open_coin')) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + $isnew = 0; + if (isset($_REQUEST['isnew']) && $_REQUEST['isnew'] == 1) { + $isnew = 1; + } $row = $conn->execQueryOne('SELECT * FROM hang WHERE accountid=:accountid;', array( ':accountid' => $account_id @@ -536,7 +551,8 @@ class HangController extends BaseAuthedController { $val = $addreward->getVipVal($account_id, 8); $max_time = $p_time_limit['value'] + $val; $num = floor((phpcommon\getNowTime() - $row['hang_time']) / $p_val['value'] * $p_num['value']); - if ((phpcommon\getNowTime() - $row['hang_time']) >= $max_time) { + if ((phpcommon\getNowTime() - $row['hang_time']) >= $max_time || + $isnew == 1) { $num = floor($max_time / $p_val['value'] * $p_num['value']); } $val2 = $addreward->getVipVal($account_id, 6); diff --git a/webapp/controller/NewPayActivityController.class.php b/webapp/controller/NewPayActivityController.class.php index 628de02..76ba9ce 100644 --- a/webapp/controller/NewPayActivityController.class.php +++ b/webapp/controller/NewPayActivityController.class.php @@ -9,7 +9,7 @@ require_once 'metatable/parameter.php'; require_once 'metatable/activityplus.php'; require_once 'metatable/parameter.php'; -class PayActivityController extends BaseAuthedController { +class NewPayActivityController extends BaseAuthedController { private $data = null; @@ -224,7 +224,7 @@ class PayActivityController extends BaseAuthedController { 'rmb_lot_ticket' ), array( - 'accontid' => $this->getAccountId() + 'accountid' => $this->getAccountId() ) ); if (!$row) { @@ -365,7 +365,7 @@ class PayActivityController extends BaseAuthedController { } $isUp = false; $addreward = new classes\AddReward(); - $new_lv = $addreward->getVipLevel($account_id); + $new_lv = $addreward->getVipLevel($this->getAccountId()); $item_list = $this->getActRewardList($type, $id, $idx, $draw_type); if (!$item_list || empty($item_list)) { phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励'); @@ -373,7 +373,7 @@ class PayActivityController extends BaseAuthedController { } $all_item_list = array(); foreach ($item_list as $item) { - $items = $addreward->addReward($item['item_id'], $item['item_num'], $account_id, $item['time'], 0); + $items = $addreward->addReward($item['item_id'], $item['item_num'], $this->getAccountId(), $item['time'], 0); foreach($items as $i) { array_push($all_item_list, array( 'item_id' => $i['item_id'], @@ -382,13 +382,19 @@ class PayActivityController extends BaseAuthedController { )); } } - $coin_num = $addreward->getCoinNum($account_id); - $rmb_num = $addreward->getRmbNum($account_id); - $rmb_ticket = $addreward->getRmbTicketNum($account_id); - $row = $conn->execQueryOne('SELECT free_box FROM user WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - )); + $coin_num = $addreward->getCoinNum($this->getAccountId()); + $rmb_num = $addreward->getRmbNum($this->getAccountId()); + $rmb_ticket = $addreward->getRmbTicketNum($this->getAccountId()); + $row = phpcommon\SqlHelper::selectOne + ($this->getSelfMysql(), + 'user', + array( + 'free_box', + ), + array( + 'accountid' => $this->getAccountId() + ) + ); echo json_encode(array( 'errcode' => 0, 'errmsg' => '', @@ -462,7 +468,7 @@ class PayActivityController extends BaseAuthedController { $actdb = isset($this->data['daily_list'][$id]) ? $this->data['daily_list'][$id] : null; if ($actdb == null) { $actdb = array(); - $cond_conf = explode('|', $act['condition']); + $cond_conf = explode('|', $actMeta['condition']); foreach ($cond_conf as $c) { $actdb[$c] = array( 'act_cond' => $c, //活动目标条件 @@ -487,7 +493,7 @@ class PayActivityController extends BaseAuthedController { //计算价格 $decPrice = 0; foreach ($actdb as $c) { - if ($this->calcDailyActCondRemainDay($actdb) > 0 && $c['act_cond'] < $cond) { + if ($this->calcDailyActRemainDay($actdb) > 0 && $c['act_cond'] < $cond) { $decPrice += $c['act_cond']; } } @@ -495,7 +501,7 @@ class PayActivityController extends BaseAuthedController { } { //计算剩余天数 - $new_remain_day = $this->getDailyActCondRemainDay($actdb) + $cond; + $new_remain_day = $this->calcDailyActRemainDay($actdb) + $cond; $actdb['remain_day'] = $new_remain_day; $actdb['last_buytime'] = $this->getNowTime(); $cond_actdb['last_buytime'] = $this->getNowTime(); @@ -507,6 +513,15 @@ class PayActivityController extends BaseAuthedController { return null; } $item_list = metatable\getDropListById($item_conf['fuctionindex']); + $item_str = $item_conf['buy_reward']; + $it_arr = $this->getExplode($item_str); + foreach ($it_arr as $it) { + array_push($item_list, array( + 'item_id' => $it[0], + 'item_num' => $it[1], + 'time' => $it[2], + )); + } for ($i = 1; $i < $cond_idx + 1; $i++) { $addreward->addReward($i + 19000, 1, $this->getAccountId(), 0, 0); } @@ -1039,4 +1054,3 @@ class PayActivityController extends BaseAuthedController { } -?> diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index b85f1ab..dfa84cc 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -279,7 +279,7 @@ class RoleController extends BaseAuthedController { // } // if ($avatar_url != $row['avatar_url']) { // $ret = $conn->execScript('UPDATE user SET avatar_url=:avatar_url, modify_time=:modify_time ' . - // ' WHERE accountid=:accountid;', + // ' WHERE accountid=:accountid;', // array( // ':accountid' => $account_id, // ':avatar_url' => $avatar_url, @@ -799,7 +799,7 @@ class RoleController extends BaseAuthedController { public function oldBattleReport() { $account_id = $_REQUEST['account_id']; //账号 - $conn = $this->getMysql($account_id); + $conn = $this->getMysql($account_id); if (!$conn) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; @@ -977,7 +977,6 @@ class RoleController extends BaseAuthedController { } $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( @@ -1483,7 +1482,6 @@ class RoleController extends BaseAuthedController { protected function createSessionId($accountid, $registertime, $session_key) { $nowtime = phpcommon\getNowTime(); - // error_log($accountid . 'f3a6a9a5-217a-4079-ab99-b5d69b8212be' . $registertime . $nowtime); $session_id = $nowtime . '_' . $registertime @@ -1567,7 +1565,6 @@ class RoleController extends BaseAuthedController { } //$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(