From 1b79cee577d5987cc9c5f99c57f4220b719c8917 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Sat, 15 Aug 2020 00:34:50 +0800 Subject: [PATCH] 1 --- webapp/bootstrap/init.php | 2 +- webapp/classes/AddReward.php | 63 ++++--- webapp/classes/Quest.php | 11 +- .../controller/ActivityController.class.php | 156 +++++++++++++----- webapp/controller/AdditemController.class.php | 34 +++- webapp/controller/BagController.class.php | 58 ++++--- webapp/controller/EquipController.class.php | 127 ++++++++++---- webapp/controller/FriendController.class.php | 18 +- .../controller/GameOverController.class.php | 77 ++++----- webapp/controller/HangController.class.php | 62 +++++-- webapp/controller/PassController.class.php | 101 +++++++++--- webapp/controller/PayController.class.php | 92 +++++++---- webapp/controller/QuestController.class.php | 40 +++-- webapp/controller/RankController.class.php | 13 +- webapp/controller/RoleController.class.php | 150 ++++++++++------- webapp/controller/ShareController.class.php | 68 ++++---- webapp/controller/ShopController.class.php | 84 +++++++--- webapp/controller/SignController.class.php | 106 +++++++++--- 18 files changed, 870 insertions(+), 392 deletions(-) diff --git a/webapp/bootstrap/init.php b/webapp/bootstrap/init.php index dd88b9d..1bea545 100644 --- a/webapp/bootstrap/init.php +++ b/webapp/bootstrap/init.php @@ -96,6 +96,6 @@ require 'config_loader.php'; function needSpecConfig($channel) { - return $channel == 6001; + return $channel == 6002; } diff --git a/webapp/classes/AddReward.php b/webapp/classes/AddReward.php index c8e83bf..4845be3 100644 --- a/webapp/classes/AddReward.php +++ b/webapp/classes/AddReward.php @@ -18,9 +18,14 @@ class AddReward { return $conn; } - protected function getItem($item_id) + protected function getItem($item_id, $accountid) { - $g_conf_item_cluster = require('../res/item@item.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_item_cluster = require("../res/$channel/item@item.php"); + } else { + $g_conf_item_cluster = require('../res/item@item.php'); + } $item_conf = getItemConfig($g_conf_item_cluster, $item_id); $it = array( 'id' => $item_conf['id'], @@ -31,9 +36,14 @@ class AddReward { return $it; } - protected function getBag($bag_id) + protected function getBag($bag_id, $accountid) { - $g_conf_bag_cluster = require('../res/bag@bag.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_bag_cluster = require("../res/$channel/bag@bag.php"); + } else { + $g_conf_bag_cluster = require('../res/bag@bag.php'); + } $bag_conf = getBagConfig($g_conf_bag_cluster, $bag_id); $b = array( 'id' => $bag_conf['id'], @@ -56,9 +66,14 @@ class AddReward { return $arr; } - protected function getEquip($equip_id) + protected function getEquip($equip_id, $accountid) { - $g_conf_equip_cluster = require('../res/equip@equip.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_equip_cluster = require("../res/$channel/equip@equip.php"); + } else { + $g_conf_equip_cluster = require('../res/equip@equip.php'); + } $equip_conf = getEquipConfig($g_conf_equip_cluster, $equip_id); if (!$equip_conf) { return null; @@ -78,7 +93,7 @@ class AddReward { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); die(); } - $it = $this->getItem($item_id); + $it = $this->getItem($item_id, $account_id); if (!$it) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个道具'); die(); @@ -91,7 +106,7 @@ class AddReward { )); foreach ($item_list as $item) { - $i = $this->getItem($item['item_id']); + $i = $this->getItem($item['item_id'], $account_id); if ($i['type'] == 1){ $this->addCoin($item['item_id'], $item['item_num'], $account_id); } else if ($i['type'] == 2) { @@ -201,7 +216,7 @@ class AddReward { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); die(); } - $it = $this->getItem($item_id); + $it = $this->getItem($item_id, $accountid); $status = 1; $sum = 0; if ($it['type'] == 10) { @@ -210,7 +225,7 @@ class AddReward { ':accountid' => $accountid, )); foreach ($rows as $r) { - $it = $this->getItem($r['id']); + $it = $this->getItem($r['id'], $accountid); if ($r['status'] == 0 && $it['type'] == 10) { $sum++; } @@ -407,8 +422,13 @@ class AddReward { public function getStatus($item_id, $status, $accountid) { $s = $status; - $b = $this->getBag($item_id); - $bag_meta_table = require('../res/bag@bag.php'); + $b = $this->getBag($item_id, $accountid); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $bag_meta_table = require("../res/$channel/bag@bag.php"); + } else { + $bag_meta_table = require('../res/bag@bag.php'); + } //正在装备的道具 $flag = 0; $conn = $this->getMysql($accountid); @@ -419,7 +439,7 @@ class AddReward { if ($b['fuction'] != 5) { foreach ($bag_meta_table as $bag_info) { $id = $bag_info['id']; - $bag = $this->getBag($id); + $bag = $this->getBag($id, $accountid); if ($bag['fuction'] != $b['fuction']) { continue; } @@ -443,7 +463,7 @@ class AddReward { $emoji_num = 0; foreach ($bag_meta_table as $bag_info) { $id = $bag_info['id']; - $bag = $this->getBag($id); + $bag = $this->getBag($id, $accountid); if ($bag['fuction'] != $b['fuction']) { continue; } @@ -472,13 +492,18 @@ class AddReward { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - $b = $this->getBag($item_id); - $bag_meta_table = require('../res/bag@bag.php'); + $b = $this->getBag($item_id, $accountid); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $bag_meta_table = require("../res/$channel/bag@bag.php"); + } else { + $bag_meta_table = require('../res/bag@bag.php'); + } //正在装备的道具 if ($b['fuction'] != 5) { foreach ($bag_meta_table as $bag_info) { $id = $bag_info['id']; - $bag = $this->getBag($id); + $bag = $this->getBag($id, $accountid); if ($bag['fuction'] != $b['fuction']) { continue; } @@ -560,7 +585,7 @@ class AddReward { )); } else { //转化碎片 - $e = $this->getEquip($item_id); + $e = $this->getEquip($item_id, $accountid); if (!$e) { phpcommon\sendError(ERR_USER_BASE + 2, '没有这个装备'); die(); @@ -578,7 +603,7 @@ class AddReward { public function getRealIndexid($id, $accountid) { - $e = $this->getEquip($id); + $e = $this->getEquip($id, $accountid); if (!$e || $e['real_index_id'] == '' || !$e['real_index_id']) { return intval($id); } diff --git a/webapp/classes/Quest.php b/webapp/classes/Quest.php index 30560b8..fe733ef 100644 --- a/webapp/classes/Quest.php +++ b/webapp/classes/Quest.php @@ -19,9 +19,14 @@ class Quest{ return $conn; } - protected function getQuest($quest_id) + protected function getQuest($quest_id, $accountid) { - $g_conf_quest_cluster = require('../res/task@task.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_quest_cluster = require("../res/$channel/task@task.php"); + } else { + $g_conf_quest_cluster = require('../res/task@task.php'); + } $quest_conf = getQuestConfig($g_conf_quest_cluster, $quest_id); $q = array( 'id' => $quest_conf['id'], @@ -39,7 +44,7 @@ class Quest{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - $q = $this->getQuest($quest_id); + $q = $this->getQuest($quest_id, $account_id); if (!$q) { phpcommon\sendError(ERR_USER_BASE + 2, '没有这个任务'); return; diff --git a/webapp/controller/ActivityController.class.php b/webapp/controller/ActivityController.class.php index 5210cf3..99ec26b 100644 --- a/webapp/controller/ActivityController.class.php +++ b/webapp/controller/ActivityController.class.php @@ -30,9 +30,14 @@ class ActivityController{ return $r; } - protected function getBox($box_id) + protected function getBox($box_id, $accountid) { - $box_meta_table = require('../res/box@box.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $box_meta_table = require("../res/$channel/box@box.php"); + } else { + $box_meta_table = require('../res/box@box.php'); + } $box_meta = getBoxConfig($box_meta_table, $box_id); $b = array( 'box_id' => $box_meta['box_type'], @@ -45,9 +50,14 @@ class ActivityController{ return $b; } - protected function getParameter($para_id) + protected function getParameter($para_id, $accountid) { - $parameter_meta_cluster = require('../res/parameter@parameter.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $parameter_meta_cluster = require("../res/$channel/parameter@parameter.php"); + } else { + $parameter_meta_cluster = require('../res/parameter@parameter.php'); + } $parameter_meta = getParameterConfig($parameter_meta_cluster, $para_id); $p = array( 'id' => $parameter_meta['id'], @@ -57,9 +67,14 @@ class ActivityController{ return $p; } - protected function getDrop($drop_id) + protected function getDrop($drop_id, $accountid) { - $drop_meta_table = require('../res/drop@drop.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $drop_meta_table = require("../res/$channel/drop@drop.php"); + } else { + $drop_meta_table = require('../res/drop@drop.php'); + } $drop_meta = getDropConfig($drop_meta_table, $drop_id); $d = array( 'drop_id' => $drop_meta['drop_id'], @@ -85,9 +100,14 @@ class ActivityController{ return $arr; } - protected function getLottery($lot_id) + protected function getLottery($lot_id, $accountid) { - $g_conf_lot_cluster = require('../res/lottery@lottery.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_lot_cluster = require("../res/$channel/lottery@lottery.php"); + } else { + $g_conf_lot_cluster = require('../res/lottery@lottery.php'); + } $lot_conf = getLotteryConfig($g_conf_lot_cluster, $lot_id); $l = array( 'id' => $lot_conf['id'], @@ -102,9 +122,14 @@ class ActivityController{ return $l; } - protected function getItem($item_id) + protected function getItem($item_id, $accountid) { - $g_conf_item_cluster = require('../res/item@item.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_item_cluster = require("../res/$channel/item@item.php"); + } else { + $g_conf_item_cluster = require('../res/item@item.php'); + } $item_conf = getItemConfig($g_conf_item_cluster, $item_id); $it = array( 'id' => $item_conf['id'], @@ -116,9 +141,14 @@ class ActivityController{ return $it; } - protected function getDrawTableConfig($id) + protected function getDrawTableConfig($id, $accountid) { - $g_conf_lot_cluster = require('../res/lotterydraw@lotterydraw.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_lot_cluster = require("../res/$channel/lotterydraw@lotterydraw.php"); + } else { + $g_conf_lot_cluster = require('../res/lotterydraw@lotterydraw.php'); + } $lot_conf = getLotteryConfig($g_conf_lot_cluster, $id); $l = array( 'id' => $lot_conf['id'], @@ -132,9 +162,14 @@ class ActivityController{ return $l; } - protected function getreward($re_id) + protected function getreward($re_id, $accountid) { - $g_conf_re_cluster = require('../res/randreward@randreward.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_re_cluster = require("../res/$channel/randreward@randreward.php"); + } else { + $g_conf_re_cluster = require('../res/randreward@randreward.php'); + } $re_conf = getRandrewardConfig($g_conf_re_cluster, $re_id); $re = array( 'id' => $re_conf['id'], @@ -145,9 +180,14 @@ class ActivityController{ return $re; } - protected function getRecommend($rec_id) + protected function getRecommend($rec_id, $accountid) { - $g_conf_rec_cluster = require('../res/recommend@recommend.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_rec_cluster = require("../res/$channel/recommend@recommend.php"); + } else { + $g_conf_rec_cluster = require('../res/recommend@recommend.php'); + } $rec_conf = getRecommendConfig($g_conf_rec_cluster, $rec_id); $rec = array( 'pool' => $rec_conf['pool'], @@ -226,8 +266,8 @@ class ActivityController{ return; } //刷新次数 - $p_free = $this->getParameter(FREELOTTERY_TIME); - $p_video = $this->getParameter(VIDEOLOTTERY_TIME); + $p_free = $this->getParameter(FREELOTTERY_TIME, $account_id); + $p_video = $this->getParameter(VIDEOLOTTERY_TIME, $account_id); $free_times = $p_free['value']; $video_times = $p_video['value']; $row = $conn->execQueryOne('SELECT free_times, video_times FROM activity WHERE accountid=:accountid;', @@ -330,16 +370,21 @@ class ActivityController{ } //随机确认奖励 $weight_sum = 0; - $g_conf_lot_cluster = require('../res/lotterydraw@lotterydraw.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $g_conf_lot_cluster = require("../res/$channel/lotterydraw@lotterydraw.php"); + } else { + $g_conf_lot_cluster = require('../res/lotterydraw@lotterydraw.php'); + } for ($i = 1; $i <= count($g_conf_lot_cluster); $i++) { - $l = $this->getDrawTableConfig($i); + $l = $this->getDrawTableConfig($i, $account_id); $weight_sum += $l['jilv']; } $random = Rand(0, $weight_sum); $weight = 0; $key = 0; for ($ii = 1; $ii <= count($g_conf_lot_cluster); $ii++) { - $l = $this->getDrawTableConfig($ii); + $l = $this->getDrawTableConfig($ii, $account_id); $weight += $l['jilv']; if ($weight >= $random) { $key = $ii; @@ -435,7 +480,12 @@ class ActivityController{ } //随机确认奖励 $weight_sum = 0; - $g_conf_lot_cluster = require('../res/lottery@lottery.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $g_conf_lot_cluster = require("../res/$channel/lottery@lottery.php"); + } else { + $g_conf_lot_cluster = require('../res/lottery@lottery.php'); + } $lot_array = array(); $draw_uuid = $_REQUEST['draw_uuid']; $item_id = 0; @@ -456,9 +506,14 @@ class ActivityController{ } if ($row['free_times'] + $row['video_times'] + 1 == 5) { - $g_conf_lot_cluster = require('../res/lottery@lottery.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $g_conf_lot_cluster = require("../res/$channel/lottery@lottery.php"); + } else { + $g_conf_lot_cluster = require('../res/lottery@lottery.php'); + } for($g = 1; $g <= count($g_conf_lot_cluster); $g++) { - $l = $this->getLottery($g); + $l = $this->getLottery($g, $account_id); if ($l['jilv'] == 0) { array_push($lot_array, array( 'key' => $g @@ -466,7 +521,7 @@ class ActivityController{ } } for ($i1 = 0; $i1 < count($lot_array); $i1++) { - $l = $this->getLottery($lot_array[$i1]['key']); + $l = $this->getLottery($lot_array[$i1]['key'], $account_id); $weight_sum += $l['jilv']; } $random = Rand(0, 100); @@ -496,14 +551,14 @@ class ActivityController{ } for ($i = 0; $i < count($lot_array); $i++) { - $l = $this->getLottery($lot_array[$i]['key']); + $l = $this->getLottery($lot_array[$i]['key'], $account_id); $weight_sum += $l['jilv']; } $random = Rand(1, $weight_sum); // error_log($random); for ($ii = 0; $ii < count($lot_array); $ii++) { - $l = $this->getLottery($lot_array[$ii]['key']); + $l = $this->getLottery($lot_array[$ii]['key'], $account_id); $weight += $l['jilv']; if ($weight >= $random) { @@ -552,7 +607,7 @@ class ActivityController{ )); if ($_REQUEST['type'] == 0) { - $p_flush = $this->getParameter(FREELOTTERY_TIME); + $p_flush = $this->getParameter(FREELOTTERY_TIME, $account_id); if ($p_flush['value'] <= $row['free_times']) { phpcommon\sendError(ERR_USER_BASE + 3, '今日刷新次数已满'); return; @@ -572,7 +627,7 @@ class ActivityController{ } } if ($_REQUEST['type'] == 1) { - $p_flush = $this->getParameter(VIDEOLOTTERY_TIME); + $p_flush = $this->getParameter(VIDEOLOTTERY_TIME, $account_id); if ($p_flush['value'] <= $row['video_times']) { phpcommon\sendError(ERR_USER_BASE + 3, '今日刷新次数已满'); return; @@ -629,7 +684,7 @@ class ActivityController{ return; } //增加奖励 - $p = $this->getParameter(REWARD_TIMES); + $p = $this->getParameter(REWARD_TIMES, $account_id); $times = $p['value'] - 1; $addreward = new classes\AddReward(); $addreward->addReward($row['item_id'], $row['item_num'] * $times, $account_id,0,0); @@ -646,9 +701,19 @@ class ActivityController{ $draw_list = array(); $g_conf_lot_cluster = array(); if ($type == 1) { - $g_conf_lot_cluster = require('../res/lottery@lottery.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_lot_cluster = require("../res/$channel/lottery@lottery.php"); + } else { + $g_conf_lot_cluster = require('../res/lottery@lottery.php'); + } } else { - $g_conf_lot_cluster = require('../res/lotterydraw@lotterydraw.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_lot_cluster = require("../res/$channel/lotterydraw@lotterydraw.php"); + } else { + $g_conf_lot_cluster = require('../res/lotterydraw@lotterydraw.php'); + } } $day = 1; if ($type == 1 && phpcommon\extractChannel($accountid) == 6006) { @@ -664,9 +729,9 @@ class ActivityController{ $key = 0; $l = array(); if ($type == 1) { - $l = $this->getLottery($i); + $l = $this->getLottery($i, $accountid); } else { - $l = $this->getDrawTableConfig($i); + $l = $this->getDrawTableConfig($i, $accountid); } //确定商品id和数量 $weight_sum = 0; @@ -718,7 +783,7 @@ class ActivityController{ return; } $pool = $_REQUEST['pool']; - $rec = $this->getRecommend($pool); + $rec = $this->getRecommend($pool, $account_id); $reward_id = 0; $item_list = array(); $all_item_list = array(); @@ -730,7 +795,7 @@ class ActivityController{ for($i = 0; $i < $rec['reward']; $i++) { $item_num = 1; $time = $this->randtime($rec['time']); - $reward_id = $this->randlottery($reward_array, $pool); + $reward_id = $this->randlottery($reward_array, $pool, $account_id); array_push($reward_array, array( 'id' => $reward_id )); @@ -805,15 +870,20 @@ class ActivityController{ return $key; } - protected function randlottery($id, $pool) + protected function randlottery($id, $pool, $accountid) { $weight_sum = 0; $rand_array = array(); $po = $pool - 1; - $g_conf_item_cluster = require('../res/item@item.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_item_cluster = require("../res/$channel/item@item.php"); + } else { + $g_conf_item_cluster = require('../res/item@item.php'); + } foreach($g_conf_item_cluster as $items) { $flag = 0; - $it = $this->getItem($items['id']); + $it = $this->getItem($items['id'], $accountid); if ($it['id'] != 0) { foreach ($id as $ids) { if ($it['id'] == $ids['id']) { @@ -871,10 +941,10 @@ class ActivityController{ $daily_order1 = $row['daily_order1']; $daily_order2 = $row['daily_order2']; $daily_order3 = $row['daily_order3']; - $p1 = $this->getParameter(LOGINBOX_TIME1); - $p2 = $this->getParameter(LOGINBOX_TIME2); - $p3 = $this->getParameter(LOGINBOX_TIME3); - $p = $this->getParameter(LOGINBOX_TIME); + $p1 = $this->getParameter(LOGINBOX_TIME1, $account_id); + $p2 = $this->getParameter(LOGINBOX_TIME2, $account_id); + $p3 = $this->getParameter(LOGINBOX_TIME3, $account_id); + $p = $this->getParameter(LOGINBOX_TIME, $account_id); $pt1 = $p1['value']; $pt2 = $p2['value']; $pt3 = $p3['value']; diff --git a/webapp/controller/AdditemController.class.php b/webapp/controller/AdditemController.class.php index cfa8631..76c4a83 100644 --- a/webapp/controller/AdditemController.class.php +++ b/webapp/controller/AdditemController.class.php @@ -14,22 +14,33 @@ class AdditemController{ return $conn; } - protected function getItem($item_id) + protected function getItem($item_id, $accountid) { - $g_conf_item_cluster = require('../res/item@item.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_item_cluster = require("../res/$channel/item@item.php"); + } else { + $g_conf_item_cluster = require('../res/item@item.php'); + } $item_conf = getItemConfig($g_conf_item_cluster, $item_id); $it = array( 'id' => $item_conf['id'], 'diamond' => $item_conf['diamond'], 'type' => $item_conf['fuction'], - 'diamond_hour' => $item_conf['diamond_hour'] + 'diamond_hour' => $item_conf['diamond_hour'], + 'pool_weight' => $item_conf['pool_weight'], ); return $it; } - protected function getBag($bag_id) + protected function getBag($bag_id, $accountid) { - $g_conf_bag_cluster = require('../res/bag@bag.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_bag_cluster = require("../res/$channel/bag@bag.php"); + } else { + $g_conf_bag_cluster = require('../res/bag@bag.php'); + } $bag_conf = getBagConfig($g_conf_bag_cluster, $bag_id); $b = array( 'id' => $bag_conf['id'], @@ -52,9 +63,14 @@ class AdditemController{ return $arr; } - protected function getParameter($para_id) + protected function getParameter($para_id, $accountid) { - $parameter_meta_cluster = require('../res/parameter@parameter.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $parameter_meta_cluster = require("../res/$channel/parameter@parameter.php"); + } else { + $parameter_meta_cluster = require('../res/parameter@parameter.php'); + } $parameter_meta = getParameterConfig($parameter_meta_cluster, $para_id); $p = array( 'id' => $parameter_meta['id'], @@ -79,7 +95,7 @@ class AdditemController{ die(); return; } - $it = $this->getItem($item_id); + $it = $this->getItem($item_id, $accountid); if (!$it) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个道具'); die(); @@ -212,7 +228,7 @@ class AdditemController{ return; } - $p = $this->getParameter(DIAMONDTOCOIN_NUM); + $p = $this->getParameter(DIAMONDTOCOIN_NUM, $accountid); $estr = explode('|', $p['param_value']); $addnum = floor($estr[1] / $estr[0] * $num); $ret = $conn->execScript('UPDATE user SET coin_num=:coin_num, diamond_num=:diamond_num, modify_time=:modify_time ' . diff --git a/webapp/controller/BagController.class.php b/webapp/controller/BagController.class.php index 6de09c4..2ea9196 100644 --- a/webapp/controller/BagController.class.php +++ b/webapp/controller/BagController.class.php @@ -18,9 +18,14 @@ class BagController{ return $conn; } - protected function getBag($bag_id) + protected function getBag($bag_id, $accountid) { - $g_conf_bag_cluster = require('../res/bag@bag.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_bag_cluster = require("../res/$channel/bag@bag.php"); + } else { + $g_conf_bag_cluster = require('../res/bag@bag.php'); + } $bag_conf = getBagConfig($g_conf_bag_cluster, $bag_id); $b = array( 'id' => $bag_conf['id'], @@ -30,28 +35,38 @@ class BagController{ return $b; } - protected function getItem($item_id) + protected function getItem($item_id, $accountid) { - $g_conf_item_cluster = require('../res/item@item.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_item_cluster = require("../res/$channel/item@item.php"); + } else { + $g_conf_item_cluster = require('../res/item@item.php'); + } $item_conf = getItemConfig($g_conf_item_cluster, $item_id); $it = array( 'id' => $item_conf['id'], 'diamond' => $item_conf['diamond'], - 'dprice' => $item_conf['dprice'], 'type' => $item_conf['fuction'], - 'diamond_hour' => $item_conf['diamond_hour'] + 'diamond_hour' => $item_conf['diamond_hour'], + 'pool_weight' => $item_conf['pool_weight'], ); return $it; } - protected function getParameter($para_id) + protected function getParameter($para_id, $accountid) { - $g_conf_para_cluster = require('../res/parameter@parameter.php'); - $para_conf = getParameterConfig($g_conf_para_cluster, $para_id); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $parameter_meta_cluster = require("../res/$channel/parameter@parameter.php"); + } else { + $parameter_meta_cluster = require('../res/parameter@parameter.php'); + } + $parameter_meta = getParameterConfig($parameter_meta_cluster, $para_id); $p = array( - 'id' => $para_conf['id'], - 'param_name' => $para_conf['param_name'], - 'param_value' => $para_conf['param_value'], + 'id' => $parameter_meta['id'], + 'param_name' => $parameter_meta['param_name'], + 'param_value' => $parameter_meta['param_value'], ); return $p; } @@ -156,13 +171,18 @@ class BagController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - $b = $this->getBag($item_id); - $bag_meta_table = require('../res/bag@bag.php'); + $b = $this->getBag($item_id, $account_id); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $bag_meta_table = require("../res/$channel/bag@bag.php"); + } else { + $bag_meta_table = require('../res/bag@bag.php'); + } //正在装备的道具 if ($b['fuction'] != 5 && $b['fuction'] != 6) { foreach ($bag_meta_table as $bag_info) { $id = $bag_info['id']; - $bag = $this->getBag($id); + $bag = $this->getBag($id, $account_id); if ($bag['fuction'] != $b['fuction']) { continue; } @@ -239,7 +259,7 @@ class BagController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - $b = $this->getBag($item_id); + $b = $this->getBag($item_id,$account_id); $row = $conn->execQueryOne('SELECT status,active_time FROM bag WHERE accountid=:accountid AND id=:id;', array( @@ -327,7 +347,7 @@ class BagController{ return; } $addreward = new classes\AddReward(); - $ptime = $this->getParameter(RECOMMEND_TIME); + $ptime = $this->getParameter(RECOMMEND_TIME, $account_id); $addreward->addReward($item_id, 1, $account_id, $ptime['param_value'], 0); echo json_encode(array( 'errcode' => 0, @@ -354,8 +374,8 @@ class BagController{ $addreward = new classes\AddReward(); $random = Rand(0, 10000); $time = 1; - $p = $this->getParameter(RECOMMEND_FOREVER_WEIGHT); - $ptime = $this->getParameter(RECOMMEND_TIME); + $p = $this->getParameter(RECOMMEND_FOREVER_WEIGHT, $account_id); + $ptime = $this->getParameter(RECOMMEND_TIME, $account_id); if ($random < $p['param_value']) { $time = 0; } else { diff --git a/webapp/controller/EquipController.class.php b/webapp/controller/EquipController.class.php index 9097010..63005bd 100644 --- a/webapp/controller/EquipController.class.php +++ b/webapp/controller/EquipController.class.php @@ -18,35 +18,60 @@ class EquipController{ return $conn; } - protected function getItem($item_id) + protected function getItem($item_id, $accountid) { - $g_conf_item_cluster = require('../res/item@item.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_item_cluster = require("../res/$channel/item@item.php"); + + } else { + $g_conf_item_cluster = require('../res/item@item.php'); + + } $item_conf = getItemConfig($g_conf_item_cluster, $item_id); $it = array( 'id' => $item_conf['id'], 'diamond' => $item_conf['diamond'], - //'dprice' => $item_conf['dprice'], 'type' => $item_conf['fuction'], - 'diamond_hour' => $item_conf['diamond_hour'] + 'diamond_hour' => $item_conf['diamond_hour'], + 'pool_weight' => $item_conf['pool_weight'], + ); return $it; + } - protected function getParameter($para_id) + + protected function getParameter($para_id, $accountid) { - $g_conf_para_cluster = require('../res/parameter@parameter.php'); - $para_conf = getParameterConfig($g_conf_para_cluster, $para_id); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $parameter_meta_cluster = require("../res/$channel/parameter@parameter.php"); + + } else { + $parameter_meta_cluster = require('../res/parameter@parameter.php'); + + } + $parameter_meta = getParameterConfig($parameter_meta_cluster, $para_id); $p = array( - 'id' => $para_conf['id'], - 'param_name' => $para_conf['param_name'], - 'param_value' => $para_conf['param_value'], + 'id' => $parameter_meta['id'], + 'param_name' => $parameter_meta['param_name'], + 'param_value' => $parameter_meta['param_value'], + ); return $p; + } - protected function getEquip($equip_id) + + protected function getEquip($equip_id, $accountid) { - $g_conf_equip_cluster = require('../res/equip@equip.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_equip_cluster = require("../res/$channel/equip@equip.php"); + } else { + $g_conf_equip_cluster = require('../res/equip@equip.php'); + } $equip_conf = getEquipConfig($g_conf_equip_cluster, $equip_id); if (!$equip_conf) { return null; @@ -166,16 +191,22 @@ class EquipController{ die(); return; } - $e = $this->getEquip($row['id']); + $e = $this->getEquip($row['id'], $account_id); if ($e['upgrade_priority'] == '') { $flag = 1; } } if ($flag == 0) { //更新老玩家数据 - $g_conf_lot_cluster = require('../res/equip@equip.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $g_conf_equip_cluster = require("../res/$channel/equip@equip.php"); + } else { + $g_conf_equip_cluster = require('../res/equip@equip.php'); + } + for ($i = 0; $i < count($g_conf_lot_cluster); $i++) { - $e = $this->getEquip(12100 + $i); + $e = $this->getEquip(12100 + $i, $account_id); if (!$e || $e['id'] >= $row['id'] || $e['upgrade_priority'] == '') { continue; } @@ -250,9 +281,15 @@ class EquipController{ )); if (!$row) { $id = 0; - $g_conf_lot_cluster = require('../res/equip@equip.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $g_conf_equip_cluster = require("../res/$channel/equip@equip.php"); + } else { + $g_conf_equip_cluster = require('../res/equip@equip.php'); + } + for ($i = 0; $i < count($g_conf_lot_cluster); $i++) { - $e = $this->getEquip(12100 + $i); + $e = $this->getEquip(12100 + $i, $account_id); if (!$e) { continue; } @@ -355,7 +392,7 @@ class EquipController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - $e = $this->getEquip($row['id']); + $e = $this->getEquip($row['id'], $account_id); if (!$e) { phpcommon\sendError(ERR_USER_BASE + 2, '没有这个装备'); return; @@ -395,9 +432,15 @@ class EquipController{ ':account_id' => $account_id )); $max_p = $e['upgrade_priority']; - $g_conf_lot_cluster = require('../res/equip@equip.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $g_conf_equip_cluster = require("../res/$channel/equip@equip.php"); + } else { + $g_conf_equip_cluster = require('../res/equip@equip.php'); + } + for ($i = 0; $i < count($g_conf_lot_cluster); $i++) { - $ec = $this->getEquip(12100 + $i); + $ec = $this->getEquip(12100 + $i, $account_id); if (!$ec) { continue; } @@ -503,12 +546,20 @@ class EquipController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - $e1 = $this->getEquip($row['id']); + $e1 = $this->getEquip($row['id'], $account_id); $last_id = $e1['upgrade_priority']; $id = 0; - $g_conf_lot_cluster = require('../res/equip@equip.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $g_conf_equip_cluster = require("../res/$channel/equip@equip.php"); + + } else { + $g_conf_equip_cluster = require('../res/equip@equip.php'); + + } + for ($i = 0; $i < count($g_conf_lot_cluster); $i++) { - $ec = $this->getEquip(12100 + $i); + $ec = $this->getEquip(12100 + $i, $account_id); if (!$ec || empty($ec['upgrade_priority'])) { continue; } @@ -517,7 +568,7 @@ class EquipController{ break; } } - $e = $this->getEquip($id); + $e = $this->getEquip($id, $account_id); if (!$e) { phpcommon\sendError(ERR_USER_BASE + 2, '没有这个装备'); return; @@ -693,7 +744,7 @@ class EquipController{ phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家'); return; } - $e = $this->getEquip($equip_id); + $e = $this->getEquip($equip_id, $account_id); if (!$e) { phpcommon\sendError(ERR_USER_BASE + 2, '没有这个装备'); return; @@ -754,7 +805,7 @@ class EquipController{ } } foreach ($arr3 as $ar) { - $it = $this->getItem($ar[0]); + $it = $this->getItem($ar[0],$account_id); if (!$it) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个道具'); return; @@ -839,7 +890,7 @@ class EquipController{ return; } - $it = $this->getItem($item_id); + $it = $this->getItem($item_id, $account_id); if (!$it) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个道具'); die(); @@ -919,7 +970,7 @@ class EquipController{ } $lv = $row['lv']; - $e = $this->getEquip($equip_id); + $e = $this->getEquip($equip_id, $account_id); if (!$e) { phpcommon\sendError(ERR_USER_BASE + 2, '没有这个装备'); return; @@ -933,13 +984,21 @@ class EquipController{ } $arr2 = array(); $flag = 0; - for ($a = 0; $a < count($arr); $a++) { - $str = $arr[$a][0]; + $valexp = 0; + if ($lv == 0) { + $str = $arr[$lv][0]; $estr = explode(';', $str); - if ($estr[1][0] > $row['exp']) { - phpcommon\sendError(ERR_USER_BASE + 4, '未达到进阶需求'); - return; - } + $valexp = $estr[1]; + } else { + $str1 = $arr[$lv][0]; + $estr1 = explode(';', $str1); + $str = $arr[$lv - 1][0]; + $estr = explode(';', $str); + $valexp = $estr1[1] - $estr[1]; + } + if ($valexp > $row['exp']) { + phpcommon\sendError(ERR_USER_BASE + 4, '未达到进阶需求'); + return; } if ($lv >= $e['max_level']) { phpcommon\sendError(ERR_USER_BASE + 5, '达到最大等级'); diff --git a/webapp/controller/FriendController.class.php b/webapp/controller/FriendController.class.php index ab35ec9..8dccd7c 100644 --- a/webapp/controller/FriendController.class.php +++ b/webapp/controller/FriendController.class.php @@ -17,9 +17,14 @@ class FriendController{ )); return $conn; } - protected function getSeasonPoint($seaPoint_id) + protected function getSeasonPoint($seaPoint_id, $accountid) { - $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $seaPoint_meta_table = require("../res/$channel/parameter@parameter.php"); + } else { + $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + } $seaPoint_meta = getSeasonPointConfig($seaPoint_meta_table, $seaPoint_id); $seaPoint = array( 'id' => $seaPoint_meta['id'], @@ -48,9 +53,14 @@ class FriendController{ } $rank = 1; - $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $seaPoint_meta_table = require("../res/$channel/parameter@parameter.php"); + } else { + $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + } for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) { - $seaPoint = $this->getSeasonPoint($ii); + $seaPoint = $this->getSeasonPoint($ii, $account_id); if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max'] || $seaPoint['max'] == -1) { $rank = $ii; diff --git a/webapp/controller/GameOverController.class.php b/webapp/controller/GameOverController.class.php index 7100239..1328fce 100644 --- a/webapp/controller/GameOverController.class.php +++ b/webapp/controller/GameOverController.class.php @@ -31,22 +31,6 @@ class GameOverController{ } - protected function getBox($box_id) - { - $box_meta_table = require('../res/box@box.php'); - $box_meta = getBoxConfig($box_meta_table, $box_id); - $b = array( - 'box_id' => $box_meta['box_type'], - 'item_id' => $box_meta['item_id'], - 'num' => $box_meta['num'], - 'weight' => $box_meta['weight'], - 'type' => $box_meta['type'], - 'time' => $box_meta['time'], - 'count' => $box_meta['count'], - ); - return $b; - } - protected function getExplode($string) { $delim = "|"; @@ -60,27 +44,15 @@ class GameOverController{ return $arr; } - protected function getEquip($equip_id) - { - $g_conf_equip_cluster = require('../res/equip@equip.php'); - $equip_conf = getEquipConfig($g_conf_equip_cluster, $equip_id); - $e = array( - 'id' => $equip_conf['id'], - 'upgrade_priority' => $equip_conf['upgrade_priority'], - 'equip_upgrade' => $equip_conf['equip_upgrade'], - 'level_gold_cost' => $equip_conf['level_gold_cost'], - 'max_level' => $equip_conf['max_level'], - 'equip_upgradematerial' => $equip_conf['equip_upgradematerial'], - 'equip_upgradetime' => $equip_conf['equip_upgradetime'], - 'diamond_cost' => $equip_conf['diamond_cost'], - 'drop_id' => $equip_conf['drop_id'] - ); - return $e; - } - protected function getDrop($drop_id) + protected function getDrop($drop_id, $accountid) { - $drop_meta_table = require('../res/drop@drop.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $drop_meta_table = require("../res/$channel/drop@drop.php"); + } else { + $drop_meta_table = require('../res/drop@drop.php'); + } $drop_meta = getDropConfig($drop_meta_table, $drop_id); $d = array( 'drop_id' => $drop_meta['drop_id'], @@ -92,21 +64,34 @@ class GameOverController{ return $d; } - protected function getParameter($para_id) + protected function getParameter($para_id, $accountid) { - $parameter_meta_cluster = require('../res/parameter@parameter.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $parameter_meta_cluster = require("../res/$channel/parameter@parameter.php"); + } else { + $parameter_meta_cluster = require('../res/parameter@parameter.php'); + } $parameter_meta = getParameterConfig($parameter_meta_cluster, $para_id); $p = array( 'id' => $parameter_meta['id'], 'name' => $parameter_meta['param_name'], 'param_value' => $parameter_meta['param_value'], + ); return $p; + } - protected function getRankReward($rank) + + protected function getRankReward($rank, $accountid) { - $rank_meta_table = require('../res/rankReward@rankReward.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $rank_meta_table = require("../res/$channel/rankReward@rankReward.php"); + } else { + $rank_meta_table = require('../res/rankReward@rankReward.php'); + } $rank_meta = getRankRewardConfig($rank_meta_table, $rank); $d = array( 'rank' => $rank_meta['rank'], @@ -147,11 +132,11 @@ class GameOverController{ if (isset($_REQUEST['type'])) { $type = $_REQUEST['type']; } - $p = $this->getParameter(EQUIPREWARD_PARAMETER); + $p = $this->getParameter(EQUIPREWARD_PARAMETER, $account_id); $par = $p['param_value']; if ($type == 1) { - $ar = $this->getRankReward($rank); + $ar = $this->getRankReward($rank, $account_id); $coin = $ar['zbmode_param']; $num = ceil($ar['zbmode_param'] / $par); if (isset($_REQUEST['kills'])) { @@ -171,7 +156,7 @@ class GameOverController{ 'time' => 0, )); } else { - $first_list = $this->randomReward($rank, $type); + $first_list = $this->randomReward($rank, $type, $account_id); } $first_db = array( 'first_uuid' => $first_uuid, @@ -270,14 +255,14 @@ class GameOverController{ return $item_list; } - protected function randomReward($rank,$type) + protected function randomReward($rank,$type, $accountid) { //随机奖励 - $r = $this->getRankReward($rank); - $b = $this->getDrop($r['ad_drop']); + $r = $this->getRankReward($rank, $accountid); + $b = $this->getDrop($r['ad_drop'], $accountid); $count = $r['ad_num']; if ($type == 1) { - $b = $this->getDrop($r['js_drop']); + $b = $this->getDrop($r['js_drop'], $accountid); $count = $r['js_num']; } $item_list = array(); diff --git a/webapp/controller/HangController.class.php b/webapp/controller/HangController.class.php index 554fea8..38e3c04 100644 --- a/webapp/controller/HangController.class.php +++ b/webapp/controller/HangController.class.php @@ -28,22 +28,37 @@ class HangController{ return $arr; } - protected function getParameter($para_id) + protected function getParameter($para_id, $accountid) { - $parameter_meta_cluster = require('../res/parameter@parameter.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $parameter_meta_cluster = require("../res/$channel/parameter@parameter.php"); + + } else { + $parameter_meta_cluster = require('../res/parameter@parameter.php'); + + } $parameter_meta = getParameterConfig($parameter_meta_cluster, $para_id); $p = array( 'id' => $parameter_meta['id'], 'name' => $parameter_meta['param_name'], 'value' => $parameter_meta['param_value'], + ); return $p; + } - protected function getSeason($season_id) + + protected function getSeason($season_id, $accountid) { - $season_meta_table = require('../res/season@season.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $season_meta_table = require("../res/$channel/season@season.php"); + } else { + $season_meta_table = require('../res/season@season.php'); + } $season_meta = getSeasonConfig($season_meta_table, $season_id); $season = array( 'number' => $season_meta['season_number'], @@ -55,9 +70,14 @@ class HangController{ return $season; } - protected function getSeasonPoint($seaPoint_id) + protected function getSeasonPoint($seaPoint_id, $accountid) { - $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $seaPoint_meta_table = require("../res/$channel/seasomPoint@seasomPoint.php"); + } else { + $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + } $seaPoint_meta = getSeasonPointConfig($seaPoint_meta_table, $seaPoint_id); $seaPoint = array( 'id' => $seaPoint_meta['id'], @@ -142,9 +162,15 @@ class HangController{ $end_time = 0; $sea_reward = array(); $rank_status = 0; - $season_meta_table = require('../res/season@season.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $season_meta_table = require("../res/$channel/season@season.php"); + } else { + $season_meta_table = require('../res/season@season.php'); + } + for ($i = 1; $i <= count($season_meta_table); $i++) { - $season = $this->getSeason($i); + $season = $this->getSeason($i, $account_id); if (time() >= strtotime($season['open_time']) && time() <= strtotime($season['end_time'])) { $open_time = strtotime($season['open_time']); $end_time = strtotime($season['end_time']); @@ -221,9 +247,17 @@ class HangController{ } $pass_status = $row['pass_status']; $rank_status = 0; - $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $seaPoint_meta_table = require("../res/$channel/seasomPoint@seasomPoint.php"); + + } else { + $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + + } + for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) { - $seaPoint = $this->getSeasonPoint($ii); + $seaPoint = $this->getSeasonPoint($ii, $account_id); if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max'] || $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1) { @@ -336,10 +370,10 @@ class HangController{ $daily_order1 = $row['daily_order1']; $daily_order2 = $row['daily_order2']; $daily_order3 = $row['daily_order3']; - $p1 = $this->getParameter(LOGINBOX_TIME1); - $p2 = $this->getParameter(LOGINBOX_TIME2); - $p3 = $this->getParameter(LOGINBOX_TIME3); - $p = $this->getParameter(LOGINBOX_TIME); + $p1 = $this->getParameter(LOGINBOX_TIME1, $account_id); + $p2 = $this->getParameter(LOGINBOX_TIME2, $account_id); + $p3 = $this->getParameter(LOGINBOX_TIME3, $account_id); + $p = $this->getParameter(LOGINBOX_TIME, $account_id); $pt1 = $p1['value']; $pt2 = $p2['value']; $pt3 = $p3['value']; diff --git a/webapp/controller/PassController.class.php b/webapp/controller/PassController.class.php index 8931e79..ad355ea 100644 --- a/webapp/controller/PassController.class.php +++ b/webapp/controller/PassController.class.php @@ -31,9 +31,14 @@ class PassController{ return $arr; } - protected function getSeason($season_id) + protected function getSeason($season_id, $accountid) { - $season_meta_table = require('../res/season@season.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $season_meta_table = require("../res/$channel/season@season.php"); + } else { + $season_meta_table = require('../res/season@season.php'); + } $season_meta = getSeasonConfig($season_meta_table, $season_id); $season = array( 'number' => $season_meta['season_number'], @@ -46,9 +51,14 @@ class PassController{ return $season; } - protected function getSeasonPoint($seaPoint_id) + protected function getSeasonPoint($seaPoint_id, $accountid) { - $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $seaPoint_meta_table = require("../res/$channel/seasomPoint@seasomPoint.php"); + } else { + $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + } $seaPoint_meta = getSeasonPointConfig($seaPoint_meta_table, $seaPoint_id); $seaPoint = array( 'id' => $seaPoint_meta['id'], @@ -81,9 +91,17 @@ class PassController{ $end_time = 0; $sea_reward = array(); $rank_status = 0; - $season_meta_table = require('../res/season@season.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $season_meta_table = require("../res/$channel/season@season.php"); + + } else { + $season_meta_table = require('../res/season@season.php'); + + } + for ($i = 1; $i <= count($season_meta_table); $i++) { - $season = $this->getSeason($i); + $season = $this->getSeason($i, $account_id); if (time() >= strtotime($season['open_time']) && time() <= strtotime($season['end_time'])) { $open_time = strtotime($season['open_time']); $end_time = strtotime($season['end_time']); @@ -148,9 +166,17 @@ class PassController{ return; } $rank_status = 0; - $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $seaPoint_meta_table = require("../res/$channel/seasomPoint@seasomPoint.php"); + + } else { + $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + + } + for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) { - $seaPoint = $this->getSeasonPoint($ii); + $seaPoint = $this->getSeasonPoint($ii, $account_id); if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max'] || $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1) { @@ -260,9 +286,17 @@ class PassController{ //$delim = ':'; //$drop_multiply = explode($delim, $seaPoint['reward']); $season = array(); - $season_meta_table = require('../res/season@season.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $season_meta_table = require("../res/$channel/season@season.php"); + + } else { + $season_meta_table = require('../res/season@season.php'); + + } + for ($i = 1; $i <= count($season_meta_table); $i++) { - $season = $this->getSeason($i); + $season = $this->getSeason($i, $account_id); if (time() >= strtotime($season['open_time']) && time() <= strtotime($season['end_time'])) { break; } @@ -346,16 +380,29 @@ class PassController{ $reward = array(); $level = 0; - $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $seaPoint_meta_table = require("../res/$channel/seasomPoint@seasomPoint.php"); + } else { + $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + } for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) { - $seaPoint = $this->getSeasonPoint($ii); + $seaPoint = $this->getSeasonPoint($ii, $account_id); if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max'] || $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1) { $season = array(); - $season_meta_table = require('../res/season@season.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $season_meta_table = require("../res/$channel/season@season.php"); + + } else { + $season_meta_table = require('../res/season@season.php'); + + } + for ($i = 1; $i <= count($season_meta_table); $i++) { - $season = $this->getSeason($i); + $season = $this->getSeason($i, $account_id); if (time() >= strtotime($season['open_time']) && time() <= strtotime($season['end_time'])) { break; } @@ -449,9 +496,17 @@ class PassController{ $reward = array(); $level = 0; //积分结算 - $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $seaPoint_meta_table = require("../res/$channel/seasomPoint@seasomPoint.php"); + + } else { + $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + + } + for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) { - $seaPoint = $this->getSeasonPoint($ii); + $seaPoint = $this->getSeasonPoint($ii, $account_id); if ($row['season_end_score'] >= $seaPoint['min'] && $row['season_end_score'] <= $seaPoint['max'] || $row['season_end_score'] >= $seaPoint['min'] && $seaPoint['max'] == -1) { @@ -460,10 +515,18 @@ class PassController{ } } //奖励结算 - $season_meta_table = require('../res/season@season.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $season_meta_table = require("../res/$channel/season@season.php"); + + } else { + $season_meta_table = require('../res/season@season.php'); + + } + $id = 0; for ($i = 1; $i <= count($season_meta_table); $i++) { - $season = $this->getSeason($i); + $season = $this->getSeason($i, $account_id); if (time() >= strtotime($season['open_time']) && time() <= strtotime($season['end_time'])) { $open_time = strtotime($season['open_time']); $end_time = strtotime($season['end_time']); @@ -471,7 +534,7 @@ class PassController{ break; } } - $s = $this->getSeason($id); + $s = $this->getSeason($id, $account_id); if ($s) { $delim1 = '|'; diff --git a/webapp/controller/PayController.class.php b/webapp/controller/PayController.class.php index bddce2d..c2134cb 100644 --- a/webapp/controller/PayController.class.php +++ b/webapp/controller/PayController.class.php @@ -18,10 +18,15 @@ class PayController{ return $conn; } - protected function getItem($item_id) + protected function getItem($item_id, $accountid) { - $item_meta_table = require('../res/item@item.php'); - $item_meta = getItemConfig($item_meta_table, $item_id); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_item_cluster = require("../res/$channel/item@item.php"); + } else { + $g_conf_item_cluster = require('../res/item@item.php'); + } + $item_meta = getItemConfig($g_conf_item_cluster, $item_id); $item = array( 'id' => $item_meta['id'], 'name' => $item_meta['name'], @@ -34,9 +39,14 @@ class PayController{ return $item; } - protected function getVip($vip_id) + protected function getVip($vip_id, $accountid) { - $vip_meta_table = require('../res/vip@vip.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $vip_meta_table = require("../res/$channel/vip@vip.php"); + } else { + $vip_meta_table = require('../res/vip@vip.php'); + } $vip_meta = getVipConfig($vip_meta_table, $vip_id); $vip = array( 'level' => $vip_meta['level'], @@ -48,9 +58,14 @@ class PayController{ return $vip; } - protected function getParameter($para_id) + protected function getParameter($para_id, $accountid) { - $parameter_meta_cluster = require('../res/parameter@parameter.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $parameter_meta_cluster = require("../res/$channel/parameter@parameter.php"); + } else { + $parameter_meta_cluster = require('../res/parameter@parameter.php'); + } $parameter_meta = getParameterConfig($parameter_meta_cluster, $para_id); $p = array( 'id' => $parameter_meta['id'], @@ -80,9 +95,14 @@ class PayController{ } - protected function getDrop($drop_id) + protected function getDrop($drop_id, $accountid) { - $drop_meta_table = require('../res/drop@drop.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $drop_meta_table = require("../res/$channel/drop@drop.php"); + } else { + $drop_meta_table = require('../res/drop@drop.php'); + } $drop_meta = getDropConfig($drop_meta_table, $drop_id); $d = array( 'drop_id' => $drop_meta['drop_id'], @@ -107,9 +127,9 @@ class PayController{ return $arr; } - protected function getItemInfo($itemid) + protected function getItemInfo($itemid, $accountid) { - $d = $this->getDrop($itemid); + $d = $this->getDrop($itemid, $accountid); if (!$d) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个道具'); die(); @@ -161,8 +181,8 @@ class PayController{ $diamond_meta_table = require('../res/diamondshop@diamondshop.php'); for ($i = 1; $i <= count($diamond_meta_table); $i++) { $diamond = $this->getDiamondShop($i); - $item = $this->getItem($diamond['item_id']); - $item_list = $this->getItemInfo($item['fuctionindex']); + $item = $this->getItem($diamond['item_id'], $account_id); + $item_list = $this->getItemInfo($item['fuctionindex'], $account_id); if (!$item || !$diamond) { continue; } @@ -192,7 +212,7 @@ class PayController{ $open_time = '-1'; $end_time = '-1'; if ($diamond['coin_type'] != 0) { - $sub_item = $this->getItem($diamond['coin_type']); + $sub_item = $this->getItem($diamond['coin_type'], $account_id); $coin_icon = $sub_item['icon']; } else { //免费金币钻石领取次数及有效时间 @@ -269,7 +289,7 @@ class PayController{ for ($i = 0; $i < count($vip_meta_table); $i++) { $vip_status = 0; $vip_today_status = 0; - $vip = $this->getVip($i); + $vip = $this->getVip($i, $account_id); if ($row['vip_score'] >= $vip['require']) { $vip_level = $vip['level']; $vip_icon = $vip['vipicon']; @@ -284,8 +304,8 @@ class PayController{ $vip_status = $rowVip['reward_status']; $vip_today_status = $rowVip['today_reward_status']; } - $vip_item_list = $this->getVipItemInfo($vip['reward']); - $vip_today_item_list = $this->getVipItemInfo($vip['dailyreward']); + $vip_item_list = $this->getVipItemInfo($vip['reward'], $account_id); + $vip_today_item_list = $this->getVipItemInfo($vip['dailyreward'], $account_id); array_push($vip_list, array( 'vip_id' => $vip['level'], 'require' => $vip['require'], @@ -295,7 +315,7 @@ class PayController{ 'vip_today_item_list' => $vip_today_item_list, )); } - $v = $this->getVip($vip_level + 1); + $v = $this->getVip($vip_level + 1, $account_id); $sum = $v['require']; $coin_num = $sum - $row['vip_score']; echo json_encode(array( @@ -309,14 +329,14 @@ class PayController{ )); } - protected function getVipItemInfo($id) + protected function getVipItemInfo($id, $acoount_id) { - $item = $this->getItem($id); + $item = $this->getItem($id, $account_id); if (!$item) { phpcommon\sendError(ERR_USER_BASE + 2, '没有这个道具'); die(); } - $d = $this->getDrop($item['fuctionindex']); + $d = $this->getDrop($item['fuctionindex'], $account_id); if (!$d) { phpcommon\sendError(ERR_USER_BASE + 2, '没有这个道具'); die(); @@ -358,7 +378,7 @@ class PayController{ $vip_id = $_REQUEST['vip_id']; $type = $_REQUEST['reward_type']; $status = 0; - $vip = $this->getVip($vip_id); + $vip = $this->getVip($vip_id, $account_id); if (!$vip) { phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励'); return; @@ -416,10 +436,10 @@ class PayController{ //发送奖励 $item_list = array(); if ($type == 2) { - $item_list = $this->getVipItemInfo($vip['reward']); + $item_list = $this->getVipItemInfo($vip['reward'], $account_id); } if ($type == 1) { - $item_list = $this->getVipItemInfo($vip['dailyreward']); + $item_list = $this->getVipItemInfo($vip['dailyreward'], $account_id); } $addreward = new classes\AddReward(); foreach ($item_list as $item) { @@ -444,7 +464,7 @@ class PayController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - $vip = $this->getVip($vipid); + $vip = $this->getVip($vipid, $accountid); if (!$vip) { phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励'); return; @@ -487,8 +507,12 @@ class PayController{ } $itemid = $_REQUEST['itemid']; $itemnum = $_REQUEST['itemnum']; - - $item_meta_table = require('../res/item@item.php'); + $channel = phpcommon\extractChannel($_REQUEST['account_id']); + if (needSpecConfig($channel)) { + $item_meta_table = require("../res/$channel/item@item.php"); + } else { + $item_meta_table = require('../res/item@item.php'); + } $item_meta = getItemConfig($item_meta_table, $itemid); if (!$item_meta || $item_meta['rmbprice'] < 0.001) { phpcommon\sendError(ERR_USER_BASE + 2, '参数错误'); @@ -577,7 +601,7 @@ class PayController{ continue; } $item = $this->getItem($diamond['item_id']); - $item_list = $this->getItemInfo($item['fuctionindex']); + $item_list = $this->getItemInfo($item['fuctionindex'], $account_id); if (!$item_list) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个道具'); return; @@ -682,15 +706,15 @@ class PayController{ if ($item_id != $diamond['item_id']) { continue; } - $item = $this->getItem($diamond['item_id']); - $item_list = $this->getItemInfo($item['fuctionindex']); + $item = $this->getItem($diamond['item_id'], $account_id); + $item_list = $this->getItemInfo($item['fuctionindex'], $account_id); if (!$item_list) { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个道具'); return; } } //添加道具 - $p = $this->getParameter(REWARD_TIMES); + $p = $this->getParameter(REWARD_TIMES, $account_id); $times = $p['value'] - 1; foreach ($item_list as $item) { $addreward = new classes\AddReward(); @@ -726,9 +750,9 @@ class PayController{ return; } $newhand = $row['newhand']; - $p1 = $this->getParameter(NEWHAND_NUM1); + $p1 = $this->getParameter(NEWHAND_NUM1, $account_id); $fight_times = $p1['value']; - $p2 = $this->getParameter(NEWHAND_NUM2); + $p2 = $this->getParameter(NEWHAND_NUM2, $account_id); $view_times = $p2['value']; if ($row['game_times'] >= $fight_times && $row['vip_score'] + 1 == $view_times && $newhand == 0) { $newhand = 1; @@ -778,7 +802,7 @@ class PayController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - $item = $this->getItem(10005); + $item = $this->getItem(10005, $account_id); if (!$item) { phpcommon\sendError(ERR_USER_BASE + 2, '没有这个道具'); return; diff --git a/webapp/controller/QuestController.class.php b/webapp/controller/QuestController.class.php index e5a33bf..9b94cdf 100644 --- a/webapp/controller/QuestController.class.php +++ b/webapp/controller/QuestController.class.php @@ -18,9 +18,14 @@ class QuestController{ return $conn; } - protected function getQuest($quest_id) + protected function getQuest($quest_id, $accountid) { - $g_conf_quest_cluster = require('../res/task@task.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_quest_cluster = require("../res/$channel/task@task.php"); + } else { + $g_conf_quest_cluster = require('../res/task@task.php'); + } $quest_conf = getQuestConfig($g_conf_quest_cluster, $quest_id); $q = array( 'id' => $quest_conf['id'], @@ -33,9 +38,14 @@ class QuestController{ return $q; } - protected function getParameter($para_id) + protected function getParameter($para_id, $accountid) { - $parameter_meta_cluster = require('../res/parameter@parameter.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $parameter_meta_cluster = require("../res/$channel/parameter@parameter.php"); + } else { + $parameter_meta_cluster = require('../res/parameter@parameter.php'); + } $parameter_meta = getParameterConfig($parameter_meta_cluster, $para_id); $p = array( 'id' => $parameter_meta['id'], @@ -59,10 +69,18 @@ class QuestController{ return $arr; } - protected function getDrop($drop_id) + protected function getDrop($drop_id, $accountid) { - $g_conf_drop_cluster = require('../res/drop@drop.php'); - $drop_conf = getDropConfig($g_conf_drop_cluster, $drop_id); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $drop_meta_table = require("../res/$channel/drop@drop.php"); + + } else { + $drop_meta_table = require('../res/drop@drop.php'); + + } + + $drop_conf = getDropConfig($drop_meta_table, $drop_id); $d = array( 'drop_id' => $drop_conf['drop_id'], 'item_id' => $drop_conf['item_id'], @@ -133,7 +151,7 @@ class QuestController{ } $quest_id = $_REQUEST['quest_id']; $quest_type = $_REQUEST['type']; - $p = $this->getParameter(REWARD_TIMES); + $p = $this->getParameter(REWARD_TIMES, $account_id); $times = $p['value'] - 1; //发奖励 if ($quest_type == 0) { @@ -142,7 +160,7 @@ class QuestController{ phpcommon\sendError(ERR_USER_BASE + 2, '没有这个任务'); return; } - $d = $this->getDrop($t['reward']); + $d = $this->getDrop($t['reward'], $account_id); if (!$d) { phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励'); return; @@ -169,7 +187,7 @@ class QuestController{ $addreward = new classes\AddReward(); $addreward->addReward($item_id, $item_num, $account_id, 0, 0); } else { - $q = $this->getQuest($quest_id); + $q = $this->getQuest($quest_id, $account_id); if (!$q) { phpcommon\sendError(ERR_USER_BASE + 2, '没有这个任务'); return; @@ -240,7 +258,7 @@ class QuestController{ } //发奖励 - $q = $this->getQuest($quest_id); + $q = $this->getQuest($quest_id, $account_id); if (!$q) { phpcommon\sendError(ERR_USER_BASE + 2, '没有这个任务'); return; diff --git a/webapp/controller/RankController.class.php b/webapp/controller/RankController.class.php index 57031c5..6f23c2c 100644 --- a/webapp/controller/RankController.class.php +++ b/webapp/controller/RankController.class.php @@ -27,9 +27,14 @@ class RankController{ return $r; } - protected function getSeasonPoint($seaPoint_id) + protected function getSeasonPoint($seaPoint_id, $accountid) { - $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $seaPoint_meta_table = require("../res/$channel/seasomPoint@seasomPoint.php"); + } else { + $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + } $seaPoint_meta = getSeasonPointConfig($seaPoint_meta_table, $seaPoint_id); $seaPoint = array( 'id' => $seaPoint_meta['id'], @@ -74,7 +79,7 @@ class RankController{ if ($row) { $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) { - $seaPoint = $this->getSeasonPoint($ii); + $seaPoint = $this->getSeasonPoint($ii, $account_id); if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max'] || $seaPoint['max'] == -1) { $rank = $ii; @@ -251,7 +256,7 @@ class RankController{ $rank = 0; $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) { - $seaPoint = $this->getSeasonPoint($ii); + $seaPoint = $this->getSeasonPoint($ii, $account_id); if ($integral_db[$i][8] >= $seaPoint['min'] && $integral_db[$i][8] <= $seaPoint['max'] || $integral_db[$i][8] >= $seaPoint['min'] && $seaPoint['max'] == -1) { diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index b0a601a..561ceef 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -30,9 +30,14 @@ class RoleController{ return $r; } - protected function getParameter($para_id) + protected function getParameter($para_id, $accountid) { - $parameter_meta_cluster = require('../res/parameter@parameter.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $parameter_meta_cluster = require("../res/$channel/parameter@parameter.php"); + } else { + $parameter_meta_cluster = require('../res/parameter@parameter.php'); + } $parameter_meta = getParameterConfig($parameter_meta_cluster, $para_id); $p = array( 'id' => $parameter_meta['id'], @@ -42,26 +47,14 @@ class RoleController{ return $p; } - protected function getActivityRewardConfig($activityReward_id) + protected function getDrop($drop_id, $accountid) { - $g_conf_activityReward_cluster = require('../res/activityReward@activityReward.php'); - $activityReward_conf = getActivityRewardConfig($g_conf_activityReward_cluster, $activityReward_id); - $act = array( - 'id' => $activityReward_conf['id'], - 'activity_id' => $activityReward_conf['activity_id'], - 'condition' => $activityReward_conf['condition'], - 'parameter' => $activityReward_conf['parameter'], - 'start_end_time' => $activityReward_conf['start_end_time'], - 'activity_reward' => $activityReward_conf['activity_reward'], - 'exchange_num' => $activityReward_conf['exchange_num'], - 'exchange_item' => $activityReward_conf['exchange_item'] - ); - return $act; - } - - protected function getDrop($drop_id) - { - $g_conf_drop_cluster = require('../res/drop@drop.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_drop_cluster = require("../res/$channel/drop@drop.php"); + } else { + $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'], @@ -73,9 +66,14 @@ class RoleController{ return $d; } - protected function getEquipUp($equipUp_id) + protected function getEquipUp($equipUp_id, $accountid) { - $g_conf_equipUp_cluster = require('../res/equipUpgrade@equipUpgrade.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_equipUp_cluster = require("../res/$channel/equipUpgrade@equipUpgrade.php"); + } else { + $g_conf_equipUp_cluster = require('../res/equipUpgrade@equipUpgrade.php'); + } $equipUp_conf = getEquipUpgradeConfig($g_conf_equipUp_cluster, $equipUp_id); $e = array( 'id' => $equipUp_conf['id'], @@ -97,9 +95,14 @@ class RoleController{ return $arr; } - protected function getSeason($season_id) + protected function getSeason($season_id, $accountid) { - $season_meta_table = require('../res/season@season.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $season_meta_table = require("../res/$channel/season@season.php"); + } else { + $season_meta_table = require('../res/season@season.php'); + } $season_meta = getSeasonConfig($season_meta_table, $season_id); $season = array( 'number' => $season_meta['season_number'], @@ -111,9 +114,14 @@ class RoleController{ return $season; } - protected function getSeasonPoint($seaPoint_id) + protected function getSeasonPoint($seaPoint_id, $accountid) { - $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $seaPoint_meta_table = require("../res/$channel/seasomPoint@seasomPoint.php"); + } else { + $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + } $seaPoint_meta = getSeasonPointConfig($seaPoint_meta_table, $seaPoint_id); $seaPoint = array( 'id' => $seaPoint_meta['id'], @@ -126,9 +134,14 @@ class RoleController{ return $seaPoint; } - protected function getRankReward($rank) + protected function getRankReward($rank, $accountid) { - $rank_meta_table = require('../res/rankReward@rankReward.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $rank_meta_table = require("../res/$channel/rankReward@rankReward.php"); + } else { + $rank_meta_table = require('../res/rankReward@rankReward.php'); + } $rank_meta = getRankRewardConfig($rank_meta_table, $rank); $d = array( 'rank' => $rank_meta['rank'], @@ -176,16 +189,21 @@ class RoleController{ //$newInfo = array(); if (!$row) { $season_time = 0; - $season_meta_table = require('../res/season@season.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $season_meta_table = require("../res/$channel/season@season.php"); + } else { + $season_meta_table = require('../res/season@season.php'); + } for ($i = 1; $i <= count($season_meta_table); $i++) { - $season = $this->getSeason($i); + $season = $this->getSeason($i, $account_id); if (time() >= strtotime($season['open_time']) && time() <= strtotime($season['end_time'])) { $season_time = strtotime($season['end_time']); 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) ' . - ' VALUES(:accountid, :user_name, :avatar_url, 0, 0, 0, 0, 0, 0, 3000, 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) ' . + ' VALUES(:accountid, :user_name, :avatar_url, 0, 0, 0, 0, 0, 0, 5000, 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) ' . ' 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;', array( ':accountid' => $account_id, @@ -213,7 +231,7 @@ class RoleController{ 'harm' => 0, 'add_HP' => 0, 'alive_time' => 0, - 'coin_num' => 3000, + 'coin_num' => 5000, 'first_fight' => 0, 'collect_status' => 0, 'keys_num' => 0, @@ -377,19 +395,29 @@ class RoleController{ ':accountid' => $account_id, )); if (time() > $rowUser['season_time'] && $rowUser['season_time'] != 0) { - $season_meta_table = require('../res/season@season.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $season_meta_table = require("../res/$channel/season@season.php"); + } else { + $season_meta_table = require('../res/season@season.php'); + } $end_time = 0; for ($i = 1; $i <= count($season_meta_table); $i++) { - $season = $this->getSeason($i); + $season = $this->getSeason($i, $account_id); if (time() >= strtotime($season['open_time']) && time() <= strtotime($season['end_time'])) { $end_time = strtotime($season['end_time']); break; } } - $season_point_table = require('../res/seasomPoint@seasomPoint.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $seaPoint_point_table = require("../res/$channel/seasomPoint@seasomPoint.php"); + } else { + $seaPoint_point_table = require('../res/seasomPoint@seasomPoint.php'); + } $integral = 0; for ($j = 1; $j <= count($season_point_table); $j++) { - $seasonpoint = $this->getSeasonPoint($j); + $seasonpoint = $this->getSeasonPoint($j, $account_id); if ($rowUser['integral'] <= $seasonpoint['max'] || $seasonpoint['max'] == -1) { $integral = $seasonpoint['topoint']; @@ -474,9 +502,14 @@ class RoleController{ $min_score = 0; $update_score = $integral + $row['integral']; $is_pro = 0; - $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $seaPoint_meta_table = require("../res/$channel/seasomPoint@seasomPoint.php"); + } else { + $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + } for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) { - $seaPoint = $this->getSeasonPoint($ii); + $seaPoint = $this->getSeasonPoint($ii, $account_id); if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max'] || $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1) { $is_pro = $seaPoint['is_protect']; @@ -558,9 +591,9 @@ class RoleController{ } $daily_first_login = $row['daily_first_login']; $newhand = $row['newhand']; - $p1 = $this->getParameter(NEWHAND_NUM1); + $p1 = $this->getParameter(NEWHAND_NUM1, $account_id); $fight_times = $p1['param_value']; - $p2 = $this->getParameter(NEWHAND_NUM2); + $p2 = $this->getParameter(NEWHAND_NUM2, $account_id); $view_times = $p2['param_value']; if ($row['game_times'] + 1 == $fight_times && $row['vip_score'] >= $view_times) { $newhand = 1; @@ -628,7 +661,7 @@ class RoleController{ return; } $rank = $_REQUEST['rank']; - $ar = $this->getRankReward($rank); + $ar = $this->getRankReward($rank, $account_id); $coin_num = $ar['zbmode_param']; $row = $conn->execQueryOne('SELECT daily_time, coin_num, biogame_times FROM user WHERE accountid=:accountid;', array( @@ -764,9 +797,14 @@ class RoleController{ $min_score = 0; $update_score = $integral + $row['integral']; $is_pro = 0; - $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $seaPoint_meta_table = require("../res/$channel/seasomPoint@seasomPoint.php"); + } else { + $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + } for ($ii = 1; $ii <= count($seaPoint_meta_table); $ii++) { - $seaPoint = $this->getSeasonPoint($ii); + $seaPoint = $this->getSeasonPoint($ii, $account_id); if ($row['integral'] >= $seaPoint['min'] && $row['integral'] <= $seaPoint['max'] || $row['integral'] >= $seaPoint['min'] && $seaPoint['max'] == -1) { $is_pro = $seaPoint['is_protect']; @@ -829,9 +867,9 @@ class RoleController{ }*/ $newhand = $row['newhand']; - $p1 = $this->getParameter(NEWHAND_NUM1); + $p1 = $this->getParameter(NEWHAND_NUM1, $account_id); $fight_times = $p1['param_value']; - $p2 = $this->getParameter(NEWHAND_NUM2); + $p2 = $this->getParameter(NEWHAND_NUM2, $account_id); $view_times = $p2['param_value']; if ($row['game_times'] + 1 == $fight_times && $row['vip_score'] >= $view_times) { $newhand = 1; @@ -1013,7 +1051,7 @@ class RoleController{ die(); return; } - $d = $this->getDrop(24003); + $d = $this->getDrop(24003,$account_id); if (!$d) { phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励'); return; @@ -1058,7 +1096,7 @@ class RoleController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - $d = $this->getDrop(24003); + $d = $this->getDrop(24003,$account_id); if (!$d) { phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励'); return; @@ -1068,7 +1106,7 @@ class RoleController{ $weight_array = $this->getExplode($d['weight']); $i = 0; $item_list = array(); - $p = $this->getParameter(REWARD_TIMES); + $p = $this->getParameter(REWARD_TIMES, $account_id); $times = $p['param_value'] - 1; foreach ($weight_array as $item) { if ($item[0] >= Rand(0, 10000)) { @@ -1186,7 +1224,7 @@ class RoleController{ $reward_id = $_REQUEST['reward_id']; $reward_num = $_REQUEST['reward_num']; $addreward = new classes\AddReward(); - $p = $this->getParameter(GAMEOVER_REWARD_TIMES); + $p = $this->getParameter(GAMEOVER_REWARD_TIMES, $account_id); $times = $p['param_value'] - 1; $addreward->addReward(10001, $coin_num * $times, $account_id, 0, 0); if ($reward_id != 0) { @@ -1232,7 +1270,7 @@ class RoleController{ die(); return; } - $d = $this->getDrop(29001); + $d = $this->getDrop(29001,$account_id); if (!$d) { phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励'); return; @@ -1339,14 +1377,14 @@ class RoleController{ } $coin_times = $rowUser['coin_times']; - $p1 = $this->getParameter(DAILYCOIN_TIMES); + $p1 = $this->getParameter(DAILYCOIN_TIMES, $account_id); $max_times = $p1['param_value']; - $p2 = $this->getParameter(DAILYCOIN_DECAY); + $p2 = $this->getParameter(DAILYCOIN_DECAY, $account_id); $val = $p2['param_value']; - $p3 = $this->getParameter(DAILYCOIN_NUM); + $p3 = $this->getParameter(DAILYCOIN_NUM, $account_id); $num = $p3['param_value']; - $e = $this->getEquipUp($rowEquip['id']); + $e = $this->getEquipUp($rowEquip['id'], $account_id); if (!$e) { phpcommon\sendError(ERR_USER_BASE + 3, '没有这个装备'); return; @@ -1485,7 +1523,7 @@ class RoleController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - $p = $this->getParameter(SHARE_VIDEO_REWARD); + $p = $this->getParameter(SHARE_VIDEO_REWARD, $account_id); $num = $p['param_value']; $ret = $conn->execScript('UPDATE user SET diamond_num=:diamond_num, share_video_times=:share_video_times, modify_time=:modify_time ' . diff --git a/webapp/controller/ShareController.class.php b/webapp/controller/ShareController.class.php index 187ac91..be47bd8 100644 --- a/webapp/controller/ShareController.class.php +++ b/webapp/controller/ShareController.class.php @@ -30,9 +30,14 @@ class ShareController{ return $r; } - protected function getDrop($drop_id) + protected function getDrop($drop_id, $accountid) { - $drop_meta_table = require('../res/drop@drop.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $drop_meta_table = require("../res/$channel/drop@drop.php"); + } else { + $drop_meta_table = require('../res/drop@drop.php'); + } $drop_meta = getDropConfig($drop_meta_table, $drop_id); $d = array( 'drop_id' => $drop_meta['drop_id'], @@ -44,24 +49,14 @@ class ShareController{ return $d; } - protected function getBox($box_id) + protected function getShare($share_id, $accountid) { - $box_meta_table = require('../res/box@box.php'); - $box_meta = getBoxConfig($box_meta_table, $box_id); - $b = array( - 'box_id' => $box_meta['box_type'], - 'item_id' => $box_meta['item_id'], - 'num' => $box_meta['num'], - 'weight' => $box_meta['weight'], - 'type' => $box_meta['type'], - 'time' => $box_meta['time'], - ); - return $b; - } - - protected function getShare($share_id) - { - $share_meta_table = require('../res/share@share.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $share_meta_table = require("../res/$channel/share@share.php"); + } else { + $share_meta_table = require('../res/share@share.php'); + } $share_meta = getShareConfig($share_meta_table, $share_id); $sh = array( 'id' => $share_meta['id'], @@ -84,10 +79,15 @@ class ShareController{ return $arr; } - - protected function getParameter($para_id) + protected function getParameter($para_id, $accountid) { - $parameter_meta_cluster = require('../res/parameter@parameter.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $parameter_meta_cluster = require("../res/$channel/parameter@parameter.php"); + } else { + $parameter_meta_cluster = require('../res/parameter@parameter.php'); + } + $parameter_meta = getParameterConfig($parameter_meta_cluster, $para_id); $p = array( 'id' => $parameter_meta['id'], @@ -255,7 +255,7 @@ class ShareController{ $diamond_num = 0; if ($free != 0) { if ($row['free_dou_lot_ticket'] <= 0) { - $p = $this->getParameter(DIAMONDBOX10); + $p = $this->getParameter(DIAMONDBOX10, $account_id); $diamond_num = $p['param_value']; } else { $ret = $conn->execScript('UPDATE user SET free_dou_lot_ticket=:free_dou_lot_ticket, ' . @@ -390,7 +390,7 @@ class ShareController{ phpcommon\sendError(ERR_USER_BASE + 1,'session失效'); return; } - $p = $this->getParameter(REWARD_TIMES); + $p = $this->getParameter(REWARD_TIMES, $account_id); $times = $p['param_value'] - 1; foreach ($user_db['boxreward_list'] as $boxreward) { //增加奖励 @@ -426,7 +426,15 @@ class ShareController{ array( ':accountid' => $account_id )); - $share_meta_table = require('../res/share@share.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $share_meta_table = require("../res/$channel/share@share.php"); + + } else { + $share_meta_table = require('../res/share@share.php'); + + } + if (count($rows) == 0) { $num = count($rows) + 1; for ($i = $num; $i <= count($share_meta_table); $i++) { @@ -453,7 +461,7 @@ class ShareController{ )); foreach ($rows as $row) { $item_list = array(); - $sh = $this->getShare($row['ach_id']); + $sh = $this->getShare($row['ach_id'], $account_id); $array = $this->getExplode($sh['rewards']); for ($i = 0; $i < count($array); $i++) { array_push($item_list, array( @@ -526,7 +534,7 @@ class ShareController{ //领取奖励 $data = json_decode($response, true); $peo_num = $data['invitee_num']; - $sh = $this->getShare($ach_id); + $sh = $this->getShare($ach_id, $account_id); if ($peo_num < $sh['people']) { phpcommon\sendError(ERR_USER_BASE + 4, '未达到人数要求'); return; @@ -603,12 +611,12 @@ class ShareController{ //领取奖励 $data = json_decode($response, true); $peo_num = $data['invitee_num']; - $sh = $this->getShare($ach_id); + $sh = $this->getShare($ach_id, $account_id); if ($peo_num < $sh['people']) { phpcommon\sendError(ERR_USER_BASE + 4, '未达到人数要求'); return; } - $p = $this->getParameter(REWARD_TIMES); + $p = $this->getParameter(REWARD_TIMES, $account_id); $times = $p['param_value'] - 1; $addreward = new classes\AddReward(); if ($ach_id != 6) { @@ -767,7 +775,7 @@ class ShareController{ phpcommon\sendError(ERR_USER_BASE + 1,'session失效'); return; } - $p = $this->getParameter(REWARD_TIMES); + $p = $this->getParameter(REWARD_TIMES, $account_id); $times = $p['param_value'] - 1; foreach ($user_db['kefureward_list'] as $kefureward) { //增加奖励 diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index 86c3b33..5128ef7 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -28,9 +28,21 @@ class ShopController{ )); return $conn; } - protected function getItem($item_id) + + protected function getItem($item_id, $accountid) { - $g_conf_item_cluster = require('../res/item@item.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_item_cluster = require("../res/$channel/item@item.php"); + + + } else { + $g_conf_item_cluster = require('../res/item@item.php'); + + + } + + $item_conf = getItemConfig($g_conf_item_cluster, $item_id); $it = array( 'id' => $item_conf['id'], @@ -65,9 +77,14 @@ class ShopController{ return $it; } - protected function getShop($shop_id) + protected function getShop($shop_id, $accountid) { - $g_conf_shop_cluster = require('../res/shop@shop.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_shop_cluster = require("../res/$channel/shop@shop.php"); + } else { + $g_conf_shop_cluster = require('../res/shop@shop.php'); + } $shop_conf = getShopConfig($g_conf_shop_cluster, $shop_id); $s = array( 'shop_id' => $shop_conf['shop_id'], @@ -84,10 +101,15 @@ class ShopController{ return $s; } - protected function getParameter($para_id) + protected function getParameter($para_id, $accountid) { - $g_conf_para_cluster = require('../res/parameter@parameter.php'); - $para_conf = getParameterConfig($g_conf_para_cluster, $para_id); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $parameter_meta_cluster = require("../res/$channel/parameter@parameter.php"); + } else { + $parameter_meta_cluster = require('../res/parameter@parameter.php'); + } + $para_conf = getParameterConfig($parameter_meta_cluster, $para_id); $p = array( 'id' => $para_conf['id'], 'param_name' => $para_conf['param_name'], @@ -109,7 +131,7 @@ class ShopController{ return $arr; } - protected function getShopInfo($shop_uuid) + protected function getShopInfo($shop_uuid, $accountid) { $r = $this->getRedis($shop_uuid); if (!$r) { @@ -119,7 +141,7 @@ class ShopController{ $shop_list = array(); $user_db_str = $r->get($shop_uuid); if (empty($user_db_str)) { - $shop_list = $this->randomShop(1); + $shop_list = $this->randomShop(1, $accountid); $shop_db = array( 'shop_uuid' => $shop_uuid, 'shop_list' => $shop_list, @@ -165,11 +187,16 @@ class ShopController{ $shop_uuid = 'game2004api_shop_uuid: ' . md5($_REQUEST['account_id']); $diamond_shop_uuid = 'game2004api_diamond_shop_uuid:' . md5($_REQUEST['account_id']); //商店信息 - $shop_list = $this->getShopInfo($shop_uuid); + $shop_list = $this->getShopInfo($shop_uuid, $account_id); $rand_coinshop = array(); $rand_diamondshop = array(); - $g_conf_item_cluster = require('../res/item@item.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $g_conf_item_cluster = require("../res/$channel/item@item.php"); + } else { + $g_conf_item_cluster = require('../res/item@item.php'); + } $rows = $conn->execQuery('SELECT * FROM bag WHERE accountid=:accountid;', array( ':accountid' => $account_id @@ -275,7 +302,7 @@ class ShopController{ if (count($rand_coinshop) >= 1) { $random_coin = Rand(0, count($rand_coinshop) - 1); $randcoin_id = $rand_coinshop[$random_coin]['id']; - $cinfo = $this->getItem($randcoin_id); + $cinfo = $this->getItem($randcoin_id, $account_id); $coin_discount = $this->randdiscount($cinfo['discount']); } @@ -284,7 +311,7 @@ class ShopController{ if (count($rand_diamondshop) >= 1) { $random_diamond = Rand(0, count($rand_diamondshop) - 1); $randdiamnod_id = $rand_diamondshop[$random_diamond]['id']; - $dinfo = $this->getItem($randdiamnod_id); + $dinfo = $this->getItem($randdiamnod_id, $account_id); $dia_discount = $this->randdiscount($dinfo['discount']); } @@ -392,7 +419,7 @@ class ShopController{ phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家'); return; } - $i = $this->getItem($id); + $i = $this->getItem($id, $account_id); $price = 0; if ($i['shop_type'] == 1) { $row_c = $conn->execQueryOne('SELECT * FROM shop WHERE accountid=:accountid AND coin_id=:id;', @@ -484,14 +511,14 @@ class ShopController{ ':id' => $id )); if ($row) { - $it = $this->getItem($id); + $it = $this->getItem($id, $account_id); if ($row['status'] != 2 && $row['active_time'] == 0 && $it['Isbug_again'] != 1) { phpcommon\sendError(ERR_USER_BASE + 4, '商品已购买'); return; } } //扣除货币 - $i = $this->getItem($id); + $i = $this->getItem($id, $account_id); $price = 0; $num = 1; if ($i['shop_type'] == 1) { @@ -624,7 +651,7 @@ class ShopController{ return; } //增加奖励 - $p = $this->getParameter(REWARD_TIMES); + $p = $this->getParameter(REWARD_TIMES, $account_id); $times = $p['param_value'] - 1; $addreward = new classes\AddReward(); $addreward->addReward($item_id, $item_num * $times, $account_id, $time, 0); @@ -654,9 +681,9 @@ class ShopController{ $shop_list = array(); $flush_times = 0; if ($_REQUEST['type'] == 3) { - $p = $this->getParameter(RAND_SHOP_GOLD); + $p = $this->getParameter(RAND_SHOP_GOLD, $account_id); if ($shop_type == 2) { - $p = $this->getParameter(RAND_DIAMONDSHOP_GOLD); + $p = $this->getParameter(RAND_DIAMONDSHOP_GOLD, $account_id); } $this->SubCoin($p['param_value'], $account_id, $_REQUEST['type']); } @@ -674,7 +701,7 @@ class ShopController{ return; } if ($shop_type == 1) { - $p_flush = $this->getParameter(MAX_SHOP_REFRESH); + $p_flush = $this->getParameter(MAX_SHOP_REFRESH, $account_id); if ($p_flush['param_value'] <= $row['shop_flush_times']) { phpcommon\sendError(ERR_USER_BASE + 3, '今日刷新次数已满'); return; @@ -693,7 +720,7 @@ class ShopController{ $flush_times = $row['shop_flush_times'] + 1; } if ($shop_type == 2) { - $p_flush = $this->getParameter(RAND_DIAMONDSHOP_TIME); + $p_flush = $this->getParameter(RAND_DIAMONDSHOP_TIME, $account_id); if ($p_flush['param_value'] <= $row['diamond_shop_flush_times']) { phpcommon\sendError(ERR_USER_BASE + 3, '今日刷新次数已满'); return; @@ -723,7 +750,7 @@ class ShopController{ return; } unset($user_db['shop_list']); - $shop_list = $this->randomShop($shop_type); + $shop_list = $this->randomShop($shop_type, $account_id); $user_db['shop_list'] = $shop_list; $r -> set($shop_uuid, json_encode($user_db)); $r -> pexpire($shop_uuid, 1000 * 3600 * 24); @@ -741,17 +768,22 @@ class ShopController{ )); } - protected function randomShop($type) + protected function randomShop($type, $accountid) { $shop_list = array(); - $g_conf_shop_cluster = require('../res/shop@shop.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_shop_cluster = require("../res/$channel/shop@shop.php"); + } else { + $g_conf_shop_cluster = require('../res/shop@shop.php'); + } $coin_len = 0; $diamond_len = 0; $len = 0; $id = 0; for ($i = 1; $i <= count($g_conf_shop_cluster); $i++) { - $s = $this->getShop($i); + $s = $this->getShop($i, $accountid); $coin_len++; } if ($type == 1) { @@ -769,7 +801,7 @@ class ShopController{ $discount = 0; $price = 0; $key = 0; - $s = $this->getShop($i); + $s = $this->getShop($i, $accountid); //确定商品id和数量 $weight_sum = 0; $weight_array = $this->getExplode($s['item_weight']); diff --git a/webapp/controller/SignController.class.php b/webapp/controller/SignController.class.php index 6236f04..0c0d583 100644 --- a/webapp/controller/SignController.class.php +++ b/webapp/controller/SignController.class.php @@ -18,9 +18,14 @@ class SignController{ return $conn; } - protected function getSign($sign_id) + protected function getSign($sign_id, $accountid) { - $g_conf_sign_cluster = require('../res/signDaily@signDaily.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_sign_cluster = require("../res/$channel/signDaily@signDaily.php"); + } else { + $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'], @@ -45,9 +50,17 @@ class SignController{ return $arr; } - protected function getItem($item_id) + protected function getItem($item_id, $accountid) { - $g_conf_item_cluster = require('../res/item@item.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $g_conf_item_cluster = require("../res/$channel/item@item.php"); + + } else { + $g_conf_item_cluster = require('../res/item@item.php'); + + } + $item_conf = getItemConfig($g_conf_item_cluster, $item_id); $it = array( 'id' => $item_conf['id'], @@ -61,9 +74,14 @@ class SignController{ } - protected function getSeason($season_id) + protected function getSeason($season_id, $accountid) { - $season_meta_table = require('../res/season@season.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $season_meta_table = require("../res/$channel/season@season.php"); + } else { + $season_meta_table = require('../res/season@season.php'); + } $season_meta = getSeasonConfig($season_meta_table, $season_id); $season = array( 'number' => $season_meta['season_number'], @@ -73,9 +91,17 @@ class SignController{ return $season; } - protected function getSeasonPoint($seaPoint_id) + protected function getSeasonPoint($seaPoint_id, $accountid) { - $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $seaPoint_meta_table = require("../res/$channel/seasomPoint@seasomPoint.php"); + + } else { + $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + + } + $seaPoint_meta = getSeasonPointConfig($seaPoint_meta_table, $seaPoint_id); $seaPoint = array( 'id' => $seaPoint_meta['id'], @@ -88,10 +114,18 @@ class SignController{ return $seaPoint; } - protected function getParameter($para_id) + protected function getParameter($para_id, $accountid) { - $g_conf_para_cluster = require('../res/parameter@parameter.php'); - $para_conf = getParameterConfig($g_conf_para_cluster, $para_id); + $channel = phpcommon\extractChannel($accountid); + if (needSpecConfig($channel)) { + $parameter_meta_cluster = require("../res/$channel/parameter@parameter.php"); + + } else { + $parameter_meta_cluster = require('../res/parameter@parameter.php'); + + } + + $para_conf = getParameterConfig($parameter_meta_cluster, $para_id); $p = array( 'id' => $para_conf['id'], 'param_name' => $para_conf['param_name'], @@ -237,14 +271,22 @@ class SignController{ $week = ceil($rowUser['sign_sum'] / 7); $dayid = ($week - 1) * 7; //如果大于配置表最后一周,按最后一周奖励 - $g_conf_sign_cluster = require('../res/signDaily@signDaily.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $g_conf_sign_cluster = require("../res/$channel/signDaily@signDaily.php"); + + } else { + $g_conf_sign_cluster = require('../res/signDaily@signDaily.php'); + + } + if ($dayid + 1 > count($g_conf_sign_cluster)) { $dayid = count($g_conf_sign_cluster) - 7; } //error_log($dayid); for ($day = $dayid + 1; $day <= $dayid + 7; $day++) { - $s = $this->getSign($day + 90000); + $s = $this->getSign($day + 90000, $account_id); array_push($item_list, array( 'item_id' => $s['item_id'], 'item_num' => $s['num'], @@ -307,12 +349,20 @@ class SignController{ $week = ceil($rowUser['sign_sum'] / 7); $dayid = ($week - 1) * 7 + $_REQUEST['sign_id']; //如果大于配置表最后一周,按最后一周奖励 - $g_conf_sign_cluster = require('../res/signDaily@signDaily.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $g_conf_sign_cluster = require("../res/$channel/signDaily@signDaily.php"); + + } else { + $g_conf_sign_cluster = require('../res/signDaily@signDaily.php'); + + } + if ($dayid > count($g_conf_sign_cluster)) { $dayid = count($g_conf_sign_cluster) - 7; } //$dayid = $_REQUEST['sign_id']; - $s = $this->getSign($dayid + 90000); + $s = $this->getSign($dayid + 90000, $account_id); $item_id_array = $this->getExplode($s['item_id']); $num_array = $this->getExplode($s['num']); $time_array = $this->getExplode($s['time']); @@ -397,13 +447,21 @@ class SignController{ $week = ceil($rowUser['sign_sum'] / 7); $dayid = ($week - 1) * 7 + $_REQUEST['sign_id']; //如果大于配置表最后一周,按最后一周奖励 - $g_conf_sign_cluster = require('../res/signDaily@signDaily.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $g_conf_sign_cluster = require("../res/$channel/signDaily@signDaily.php"); + + } else { + $g_conf_sign_cluster = require('../res/signDaily@signDaily.php'); + + } + if ($dayid > count($g_conf_sign_cluster)) { $dayid = count($g_conf_sign_cluster) - 7; } //$dayid = $_REQUEST['sign_id']; - $s = $this->getSign($dayid + 90000); + $s = $this->getSign($dayid + 90000, $account_id); $item_id_array = $this->getExplode($s['item_id']); $num_array = $this->getExplode($s['num']); $time_array = $this->getExplode($s['time']); @@ -636,20 +694,28 @@ class SignController{ $dayid = ($week - 1) * 7; $day = $rowUser['sign_sum'] % 7; //如果大于配置表最后一周,按最后一周奖励 - $g_conf_sign_cluster = require('../res/signDaily@signDaily.php'); + $channel = phpcommon\extractChannel($account_id); + if (needSpecConfig($channel)) { + $g_conf_sign_cluster = require("../res/$channel/signDaily@signDaily.php"); + + } else { + $g_conf_sign_cluster = require('../res/signDaily@signDaily.php'); + + } + if ($dayid + 1 > count($g_conf_sign_cluster)) { $dayid = count($g_conf_sign_cluster) - 7; } $sign_sum = $rowUser['sign_sum']; $item_num = 0; $item_name = ''; - $item = $this->getSign(90000 + $day + $dayid); + $item = $this->getSign(90000 + $day + $dayid, $account_id); if ($rowUser['sign_sum'] == 3) { $item_name = '咸鱼套装(永久)'; } else if ($rowUser['sign_sum'] == 7) { $item_name = '神秘宝箱'; } else { - $it = $this->getItem($item['item_id']); + $it = $this->getItem($item['item_id'], $account_id); $item_name = $it['name']; $item_num = $item['num']; }