From 14f45aab6dbb9182e7bcdabc39419339c3854962 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 29 Aug 2019 12:14:39 +0800 Subject: [PATCH] 1 --- .../controller/ActivityController.class.php | 9 ++--- webapp/controller/RoleController.class.php | 29 ++++++++------- .../ServerSwitchController.class.php | 35 ++++++++++++++----- webapp/controller/SignController.class.php | 6 ++-- 4 files changed, 50 insertions(+), 29 deletions(-) diff --git a/webapp/controller/ActivityController.class.php b/webapp/controller/ActivityController.class.php index acf928c..6854569 100644 --- a/webapp/controller/ActivityController.class.php +++ b/webapp/controller/ActivityController.class.php @@ -721,7 +721,7 @@ class ActivityController{ ':red_type' => $_REQUEST['type'], ':red_date' => phpcommon\getdayseconds(time()) )); - if ($row['red_sum'] + $item_num > $limit) { + if ($row['red_sum'] + $item['item_num'] > $limit) { phpcommon\sendError(ERR_USER_BASE + 3, '今日红包已领完'); return; } @@ -740,7 +740,7 @@ class ActivityController{ protected function getRedMysql() { - $mysql_conf = getMysqlConfig(); + $mysql_conf = getMysqlConfig(crc32('')); $conn = new phpcommon\Mysql(array( 'host' => $mysql_conf['host'], 'port' => $mysql_conf['port'], @@ -855,6 +855,7 @@ class ActivityController{ $param['re_user_name'] = $re_user_name; $param['amount'] = $amount; $param['desc'] = $desc; + $param['account_id'] = $account_id; $res = ''; if (!phpcommon\HttpClient::get($url, $param, $res)) { phpcommon\sendError(ERR_RETRY, '系统繁忙'); @@ -894,8 +895,8 @@ class ActivityController{ } } else { $sum = $row['red_sum'] + $item_num; - $ret = $red_conn->execScript('UPDATE redpack set red_sum=:red_sum, red_date=:red_date, modify_time=:modify_time ' . - ' WHERE red_type=:red_type;', + $ret = $red_conn->execScript('UPDATE redpack set red_sum=:red_sum, modify_time=:modify_time ' . + ' WHERE red_type=:red_type AND red_date=:red_date;', array( ':red_sum' => $sum, ':red_type' => $type, diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index 50346eb..64ea473 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -135,7 +135,8 @@ class RoleController{ 'pass_status' => 0, 'season_status' => 1, 'first_gift' => 0, - 'sum_coin' => 0 + 'sum_coin' => 0, + 'recharge_times_total' => 0 )); } else { echo json_encode(array( @@ -159,7 +160,8 @@ class RoleController{ 'pass_status' => $row['pass_status'], 'season_status' => $row['season_status'], 'first_gift' => $row['first_gift'], - 'sum_coin' => $row['sum_coin'] + 'sum_coin' => $row['sum_coin'], + 'recharge_times_total' => $row['recharge_times_total'] )); } } @@ -672,20 +674,21 @@ class RoleController{ return; } $member_list = array(); - for ($i = 1; $i <= 100; $i++) { - $num = 1; - $robot_id = 1000 + $i; - $rob = $this->getRobot($robot_id, $num); - array_push ($member_list, array( - 'account_id' => $rob['id'], - 'name' => $rob['name'], - 'avatar_url' => $rob['avatar_url'], - )); - } + $i = Rand(1, 100); + $coin = Rand(1, 100) * 0.01; + $num = 1; + $robot_id = 1000 + $i; + $rob = $this->getRobot($robot_id, $num); + array_push ($member_list, array( + 'account_id' => $rob['id'], + 'name' => $rob['name'], + 'avatar_url' => $rob['avatar_url'], + )); echo json_encode(array( 'errcode' => 0, 'errmsg' => '', - 'member_list' => $member_list + 'member_list' => $member_list, + 'num' => $coin, )); } diff --git a/webapp/controller/ServerSwitchController.class.php b/webapp/controller/ServerSwitchController.class.php index 3654055..5b03d40 100644 --- a/webapp/controller/ServerSwitchController.class.php +++ b/webapp/controller/ServerSwitchController.class.php @@ -37,25 +37,42 @@ class ServerSwitchController { die(); }*/ $payable = 0; + $recharge_times = isset($_REQUEST['recharge_times']) ? $_REQUEST['recharge_times'] : 0; /* - 玩家第一天不开放 - 玩家进来第二天,玩了7-8次战斗后开放(非北上广并且每天重置战斗次数) - 北上广第三天开放 + 1:玩家进入第一天,战斗7次,开放充值(除北上广深成)。 + 2:玩家进入第二天,战斗7次,已充值玩家战斗2次(除北上广深成)。 + 3:玩家进入第三天,战斗7次,已充值玩家战斗2次。 */ if (phpcommon\isValidSessionId($_REQUEST['account_id'], $_REQUEST['session_id'])) { $register_time = phpcommon\extractRegisterTimeFromSessionId($_REQUEST['session_id']); $nowtime = time(); - if ($nowtime - $register_time > 3600 * 24) { - if ($this->isForbidCity() && $nowtime - $register_time > 3600 * 24 * 2) { - if ($_REQUEST['battle_times'] >= 8) { - $payable = 1; - } + + $register_time = phpcommon\getdayseconds($register_time); + $nowtime = phpcommon\getdayseconds($nowtime); + if ($nowtime - $register_time > 3600 * 24 * 2) { + //第三天 + if ($_REQUEST['battle_times'] >= 7) { + $payable = 1; + } else if ($recharge_times > 0 && $_REQUEST['battle_times'] >= 2) { + $payable = 1; + } + } else if ($nowtime - $register_time > 3600 * 24 * 1) { + //第二天 + if ($this->isForbidCity()) { } else { - if ($_REQUEST['battle_times'] >= 8) { + if ($_REQUEST['battle_times'] >= 7) { + $payable = 1; + } else if ($recharge_times > 0 && $_REQUEST['battle_times'] >= 2) { $payable = 1; } } + } else { + //第一天 + if ($this->isForbidCity()) { + } else if ($_REQUEST['battle_times'] >= 7) { + $payable = 1; + } } } echo json_encode(array( diff --git a/webapp/controller/SignController.class.php b/webapp/controller/SignController.class.php index afd019a..14fda18 100644 --- a/webapp/controller/SignController.class.php +++ b/webapp/controller/SignController.class.php @@ -195,7 +195,7 @@ class SignController{ $dayid = ($week - 1) * 7; //如果大于配置表最后一周,按最后一周奖励 $g_conf_sign_cluster = require('../res/signDaily@signDaily.php'); - if ($dayid + 90000 > count($g_conf_sign_cluster)) { + if ($dayid > count($g_conf_sign_cluster)) { $dayid = count($g_conf_sign_cluster) - 7; } for ($day = $dayid + 1; $day <= $dayid + 7; $day++) @@ -261,7 +261,7 @@ class SignController{ $dayid = ($week - 1) * 7 + $_REQUEST['sign_id']; //如果大于配置表最后一周,按最后一周奖励 $g_conf_sign_cluster = require('../res/signDaily@signDaily.php'); - if ($dayid + 90000 > count($g_conf_sign_cluster)) { + if ($dayid > count($g_conf_sign_cluster)) { $dayid = count($g_conf_sign_cluster) - 7; } $s = $this->getSign($dayid + 90000); @@ -307,7 +307,7 @@ class SignController{ $dayid = ($week - 1) * 7 + $_REQUEST['sign_id']; //如果大于配置表最后一周,按最后一周奖励 $g_conf_sign_cluster = require('../res/signDaily@signDaily.php'); - if ($dayid + 90000 > count($g_conf_sign_cluster)) { + if ($dayid > count($g_conf_sign_cluster)) { $dayid = count($g_conf_sign_cluster) - 7; } $s = $this->getSign($day + 90000);