From 63f71b6e7c057064c525ae73ba48c620298caef2 Mon Sep 17 00:00:00 2001 From: wangwei01 Date: Mon, 17 Jun 2019 14:00:30 +0800 Subject: [PATCH] 1 --- webapp/bootstrap/config_loader.php | 5 ++++ webapp/classes/Quest.php | 2 +- .../controller/ActivityController.class.php | 6 ++--- webapp/controller/EquipController.class.php | 4 +-- webapp/controller/HangController.class.php | 27 ++++++++++++++++--- webapp/controller/QuestController.class.php | 6 ++--- webapp/controller/RoleController.class.php | 27 ++++++++++++++++--- webapp/controller/SignController.class.php | 8 +++--- webapp/controller/SkinController.class.php | 8 +++--- .../controller/SupplyBoxController.class.php | 6 ++--- webapp/controller/TeamController.class.php | 5 ---- webapp/controller/VoiceController.class.php | 2 +- 12 files changed, 72 insertions(+), 34 deletions(-) diff --git a/webapp/bootstrap/config_loader.php b/webapp/bootstrap/config_loader.php index eb10666..de2661f 100644 --- a/webapp/bootstrap/config_loader.php +++ b/webapp/bootstrap/config_loader.php @@ -117,5 +117,10 @@ function getDressUpgradeConfig($dressUp_table, $dressUp_id) { return array_key_exists($dressUp_id, $dressUp_table) ? $dressUp_table[$dressUp_id] : null; } + +function getRewardTimesConfig($rewardTimes_table, $rewardTimes_id) +{ + return array_key_exists((int)$rewardTimes_id, $rewardTimes_table) ? $rewardTimes_table[(int)$rewardTimes_id] : null; +} checkMysqlConfig(); checkRedisConfig(); diff --git a/webapp/classes/Quest.php b/webapp/classes/Quest.php index 240eb6e..0807fac 100644 --- a/webapp/classes/Quest.php +++ b/webapp/classes/Quest.php @@ -21,7 +21,7 @@ class Quest{ protected function getQuest($quest_id) { - $g_conf_quest_cluster = require('../res/game2001api.task.cluster.php'); + $g_conf_quest_cluster = require('../res/task@task.php'); $quest_conf = getQuestConfig($g_conf_quest_cluster, $quest_id); $q = array( 'id' => $quest_conf['id'], diff --git a/webapp/controller/ActivityController.class.php b/webapp/controller/ActivityController.class.php index 9080b60..2e6fe41 100644 --- a/webapp/controller/ActivityController.class.php +++ b/webapp/controller/ActivityController.class.php @@ -20,7 +20,7 @@ class ActivityController{ protected function getActivityConfig($activity_id) { - $g_conf_activity_cluster = require('../res/game2001api.activity.cluster.php'); + $g_conf_activity_cluster = require('../res/activity@activity.php'); $activity_conf = getActivityConfig($g_conf_activity_cluster, $activity_id); $a = array( 'id' => $activity_conf['id'], @@ -34,7 +34,7 @@ class ActivityController{ protected function getActivityRewardConfig($activityReward_id) { - $g_conf_activityReward_cluster = require('../res/game2001api.activityReward.cluster.php'); + $g_conf_activityReward_cluster = require('../res/activityReward@activityReward.php'); $activityReward_conf = getActivityRewardConfig($g_conf_activityReward_cluster, $activityReward_id); $act = array( 'id' => $activityReward_conf['id'], @@ -80,7 +80,7 @@ class ActivityController{ return; } //活动列表 - $g_conf_activity_cluster = require('../res/game2001api.activity.cluster.php'); + $g_conf_activity_cluster = require('../res/activity@activity.php'); for ($i = 1; $i <= count($g_conf_activity_cluster); $i++) { $start_status = 0; $a = $this->getActivityConfig($i); diff --git a/webapp/controller/EquipController.class.php b/webapp/controller/EquipController.class.php index dd7fb08..955bbe6 100644 --- a/webapp/controller/EquipController.class.php +++ b/webapp/controller/EquipController.class.php @@ -19,7 +19,7 @@ class EquipController{ protected function getEquip($equip_id) { - $g_conf_equip_cluster = require('../res/game2001api.equipUpgrade.cluster.php'); + $g_conf_equip_cluster = require('../res/equipUpgrade@equipUpgrade.php'); $equip_conf = getEquipConfig($g_conf_equip_cluster, $equip_id); $e = array( 'equip_id' => $equip_conf['id'], @@ -36,7 +36,7 @@ class EquipController{ protected function getParameter($para_id) { - $g_conf_para_cluster = require('../res/game2001api.parameter.cluster.php'); + $g_conf_para_cluster = require('../res/parameter@parameter.php'); $para_conf = getParameterConfig($g_conf_para_cluster, $para_id); $p = array( 'id' => $para_conf['id'], diff --git a/webapp/controller/HangController.class.php b/webapp/controller/HangController.class.php index bf8a5fa..b920a79 100644 --- a/webapp/controller/HangController.class.php +++ b/webapp/controller/HangController.class.php @@ -17,7 +17,7 @@ class HangController{ protected function getParameter($para_id) { - $g_conf_para_cluster = require('../res/game2001api.parameter.cluster.php'); + $g_conf_para_cluster = require('../res/parameter@parameter.php'); $para_conf = getParameterConfig($g_conf_para_cluster, $para_id); $p = array( 'id' => $para_conf['id'], @@ -63,13 +63,13 @@ class HangController{ $item_id = 10001; $p_num = $this->getParameter(GOLD); $p_time_limit = $this->getParameter(TIME_LIMIT); - $num = floor((time() - $row['hang_time']) / 5 * $p_num['param_value']); + $num = floor((time() - $row['hang_time']) / 5 * $p_num['param_value']); if ((time() - $row['hang_time']) >= $p_time_limit['param_value']) { $num = floor($p_time_limit['param_value'] / 5 * $p_num['param_value']); } if ($weight != 0) { - $p_gold = $this->getParameter(DOUBLE_GOLD); - $num = $num * $p_gold['param_value']; + $times = $this->getRewardTimes($num); + $num = $num * $times; } $row = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;', array( @@ -145,5 +145,24 @@ class HangController{ 'num' => $num )); } + + protected function getRewardTimes($coin_num) + { + $g_conf_reward_cluster = require('../res/rewardTimes@rewardTimes.php'); + $times = 1; + $reward_conf = array(); + for ($i = 0; $i <= count($g_conf_reward_cluster); $i++) { + $reward_id = $g_conf_reward_cluster[$i + 91000]['id']; + $reward_conf = getRewardTimesConfig($g_conf_reward_cluster, $reward_id); + if ($reward_conf['typeId'] != 1) { + continue; + } + if ((int)$coin_num >= $reward_conf['minGold'] && (int)$coin_num <= $reward_conf['maxGold']) { + $times = $reward_conf['times']; + break; + } + } + return $times; + } } ?> diff --git a/webapp/controller/QuestController.class.php b/webapp/controller/QuestController.class.php index 8216393..598bfec 100644 --- a/webapp/controller/QuestController.class.php +++ b/webapp/controller/QuestController.class.php @@ -19,7 +19,7 @@ class QuestController{ protected function getQuest($quest_id) { - $g_conf_quest_cluster = require('../res/game2001api.task.cluster.php'); + $g_conf_quest_cluster = require('../res/task@task.php'); $quest_conf = getQuestConfig($g_conf_quest_cluster, $quest_id); $q = array( 'id' => $quest_conf['id'], @@ -34,7 +34,7 @@ class QuestController{ protected function getTaskReward($taskReward_id) { - $g_conf_taskReward_cluster = require('../res/game2001api.taskReward.cluster.php'); + $g_conf_taskReward_cluster = require('../res/taskReward@taskReward.php'); $taskReward_conf = getTaskRewardConfig($g_conf_taskReward_cluster, $taskReward_id); $t = array( 'id' => $taskReward_conf['id'], @@ -60,7 +60,7 @@ class QuestController{ protected function getDrop($drop_id) { - $g_conf_drop_cluster = require('../res/game2001api.drop.cluster.php'); + $g_conf_drop_cluster = require('../res/drop@drop.php'); $drop_conf = getDropConfig($g_conf_drop_cluster, $drop_id); $d = array( 'drop_id' => $drop_conf['drop_id'], diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index 7203977..b962a3d 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -20,7 +20,7 @@ class RoleController{ protected function getActivityRewardConfig($activityReward_id) { - $g_conf_activityReward_cluster = require('../res/game2001api.activityReward.cluster.php'); + $g_conf_activityReward_cluster = require('../res/activityReward@activityReward.php'); $activityReward_conf = getActivityRewardConfig($g_conf_activityReward_cluster, $activityReward_id); $act = array( 'id' => $activityReward_conf['id'], @@ -52,7 +52,7 @@ class RoleController{ protected function getParameter($para_id) { - $g_conf_para_cluster = require('../res/game2001api.parameter.cluster.php'); + $g_conf_para_cluster = require('../res/parameter@parameter.php'); $para_conf = getParameterConfig($g_conf_para_cluster, $para_id); $p = array( 'id' => $para_conf['id'], @@ -417,8 +417,8 @@ class RoleController{ return; } $coin_num = $row['coin']; - $p_gold = $this->getParameter(DOUBLE_END_WAR); - $coin_num = $row['coin'] * ($p_gold['param_value'] - 1); + $times = $this->getRewardTimes($num); + $coin_num = $row['coin'] * ($times - 1); $rowUser = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;', array( ':accountid' => $account_id @@ -439,6 +439,25 @@ class RoleController{ 'errmsg' => '', )); } + + protected function getRewardTimes($coin_num) + { + $g_conf_reward_cluster = require('../res/rewardTimes@rewardTimes.php'); + $times = 1; + $reward_conf = array(); + for ($i = 0; $i <= count($g_conf_reward_cluster); $i++) { + $reward_id = $g_conf_reward_cluster[$i + 91100]['id']; + $reward_conf = getRewardTimesConfig($g_conf_reward_cluster, $reward_id); + if ($reward_conf['typeId'] != 1) { + continue; + } + if ((int)$coin_num >= $reward_conf['minGold'] && (int)$coin_num <= $reward_conf['maxGold']) { + $times = $reward_conf['times']; + break; + } + } + return $times; + } } diff --git a/webapp/controller/SignController.class.php b/webapp/controller/SignController.class.php index 681d151..15fdd7b 100644 --- a/webapp/controller/SignController.class.php +++ b/webapp/controller/SignController.class.php @@ -19,7 +19,7 @@ class SignController{ protected function getSign($sign_id) { - $g_conf_sign_cluster = require('../res/game2001api.signDaily.cluster.php'); + $g_conf_sign_cluster = require('../res/signDaily@signDaily.php'); $sign_conf = getSignConfig($g_conf_sign_cluster, $sign_id); $s = array( 'sign_id' => $sign_conf['sign_id'], @@ -32,7 +32,7 @@ class SignController{ protected function getActivityRewardConfig($activityReward_id) { - $g_conf_activityReward_cluster = require('../res/game2001api.activityReward.cluster.php'); + $g_conf_activityReward_cluster = require('../res/activityReward@activityReward.php'); $activityReward_conf = getActivityRewardConfig($g_conf_activityReward_cluster, $activityReward_id); $act = array( 'id' => $activityReward_conf['id'], @@ -62,7 +62,7 @@ class SignController{ protected function getParameter($para_id) { - $g_conf_para_cluster = require('../res/game2001api.parameter.cluster.php'); + $g_conf_para_cluster = require('../res/parameter@parameter.php'); $para_conf = getParameterConfig($g_conf_para_cluster, $para_id); $p = array( 'id' => $para_conf['id'], @@ -268,7 +268,7 @@ class SignController{ return; } //获得奖励 - $g_conf_sign_cluster = require('../res/game2001api.signDaily.cluster.php'); + $g_conf_sign_cluster = require('../res/signDaily@signDaily.php'); $sign_days = $row['sign_days'] % count($g_conf_sign_cluster); if ($sign_days == 0) { $sign_days = count($g_conf_sign_cluster); diff --git a/webapp/controller/SkinController.class.php b/webapp/controller/SkinController.class.php index 9ce8e0c..6f930ac 100644 --- a/webapp/controller/SkinController.class.php +++ b/webapp/controller/SkinController.class.php @@ -17,7 +17,7 @@ class SkinController{ protected function getSkin($skin_id) { - $g_conf_skin_cluster = require('../res/game2001api.dress.cluster.php'); + $g_conf_skin_cluster = require('../res/dress@dress.php'); $skin_conf = getSkinConfig($g_conf_skin_cluster, $skin_id); $s = array( 'skin_id' => $skin_conf['id'], @@ -34,7 +34,7 @@ class SkinController{ protected function getDressUpgrade($skin_id) { - $g_conf_skin_cluster = require('../res/game2001api.dressUpgrade.cluster.php'); + $g_conf_skin_cluster = require('../res/dressUpgrade@dressUpgrade.php'); $skin_conf = getDressUpgradeConfig($g_conf_skin_cluster, $skin_id); $d = array( 'id' => $skin_conf['id'], @@ -62,7 +62,7 @@ class SkinController{ protected function getParameter($para_id) { - $g_conf_para_cluster = require('../res/game2001api.parameter.cluster.php'); + $g_conf_para_cluster = require('../res/parameter@parameter.php'); $para_conf = getParameterConfig($g_conf_para_cluster, $para_id); $p = array( 'id' => $para_conf['id'], @@ -131,7 +131,7 @@ class SkinController{ phpcommon\sendError(ERR_USER_BASE + 1,'没有这个玩家'); return; } - $g_conf_skin_cluster = require('../res/game2001api.dress.cluster.php'); + $g_conf_skin_cluster = require('../res/dress@dress.php'); $s = $this->getSkin(14001); if(!$s){ phpcommon\sendError(ERR_USER_BASE + 1,'没有这个皮肤'); diff --git a/webapp/controller/SupplyBoxController.class.php b/webapp/controller/SupplyBoxController.class.php index ec76c69..28e397c 100644 --- a/webapp/controller/SupplyBoxController.class.php +++ b/webapp/controller/SupplyBoxController.class.php @@ -19,7 +19,7 @@ class SupplyBoxController{ protected function getSupplyBox($box_id) { - $g_conf_supply_cluster = require('../res/game2001api.supply.cluster.php'); + $g_conf_supply_cluster = require('../res/supply@supply.php'); $supply_conf = getSupplyConfig($g_conf_supply_cluster, $box_id); $s = array( 'id' => $supply_conf['id'], @@ -35,7 +35,7 @@ class SupplyBoxController{ protected function getDrop($drop_id) { - $g_conf_drop_cluster = require('../res/game2001api.drop.cluster.php'); + $g_conf_drop_cluster = require('../res/drop@drop.php'); $drop_conf = getDropConfig($g_conf_drop_cluster, $drop_id); $d = array( 'drop_id' => $drop_conf['drop_id'], @@ -62,7 +62,7 @@ class SupplyBoxController{ protected function getParameter($para_id) { - $g_conf_para_cluster = require('../res/game2001api.parameter.cluster.php'); + $g_conf_para_cluster = require('../res/parameter@parameter.php'); $para_conf = getParameterConfig($g_conf_para_cluster, $para_id); $p = array( 'id' => $para_conf['id'], diff --git a/webapp/controller/TeamController.class.php b/webapp/controller/TeamController.class.php index bfd8eb3..2cb649b 100644 --- a/webapp/controller/TeamController.class.php +++ b/webapp/controller/TeamController.class.php @@ -128,7 +128,6 @@ class teamController{ 'avatar_url' => $_REQUEST['avatar_url'], )); $r->set(TEAMID_KEY . $team_uuid, json_encode($user_db)); - $r->pexpire(TEAMID_KEY . $team_uuid, 1000 * 3600); echo json_encode(array( 'errcode' => 0, @@ -180,7 +179,6 @@ class teamController{ } $r->set(TEAMID_KEY . $team_uuid, json_encode($user_db)); - $r->pexpire(TEAMID_KEY . $team_uuid, 1000 * 3600); } echo json_encode(array( 'errcode' => 0, @@ -223,7 +221,6 @@ class teamController{ } $r->set(TEAMID_KEY . $team_uuid, json_encode($user_db)); - $r->pexpire(TEAMID_KEY . $team_uuid, 1000 * 3600); } echo json_encode(array( 'errcode' => 0, @@ -260,7 +257,6 @@ class teamController{ } $user_db['auto_fill'] = $_REQUEST['auto_fill']; $r->set(TEAMID_KEY . $team_uuid, json_encode($user_db)); - $r->pexpire(TEAMID_KEY . $team_uuid, 1000 * 3600); } echo json_encode(array( 'errcode' => 0, @@ -297,7 +293,6 @@ class teamController{ } $user_db['state'] = $_REQUEST['state']; $r->set(TEAMID_KEY . $team_uuid, json_encode($user_db)); - $r->pexpire(TEAMID_KEY . $team_uuid, 1000 * 3600); } echo json_encode(array( 'errcode' => 0, diff --git a/webapp/controller/VoiceController.class.php b/webapp/controller/VoiceController.class.php index 1f0f1ca..bca63b9 100644 --- a/webapp/controller/VoiceController.class.php +++ b/webapp/controller/VoiceController.class.php @@ -36,7 +36,7 @@ class VoiceController{ echo json_encode(array( 'errcode' => 0, 'errmsg' => '', - 'download_url' => "https://game2001api-test.kingsome.cn/webapp/index.php?c=Voice&a=download&res_id=" . $md5 + 'download_url' => "https://game2001api.kingsome.cn/webapp/index.php?c=Voice&a=download&res_id=" . $md5 )); }