From 2eace9543980b8436ed9217cfe154ded5f36dad2 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Fri, 29 Jan 2021 13:29:23 +0800 Subject: [PATCH] 1 --- sql/gamedb.sql | 17 +- sql/gamedb2004_n_migrate_210129_01.sql | 21 ++ .../controller/ActivityController.class.php | 322 +++++++++++++++++- webapp/controller/RoleController.class.php | 12 +- webapp/metatable/draw.php | 26 ++ webapp/metatable/drop.php | 138 ++++++++ webapp/metatable/parameter.php | 2 +- 7 files changed, 531 insertions(+), 7 deletions(-) create mode 100644 sql/gamedb2004_n_migrate_210129_01.sql create mode 100644 webapp/metatable/draw.php create mode 100644 webapp/metatable/drop.php diff --git a/sql/gamedb.sql b/sql/gamedb.sql index b06588d..c377f0c 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -102,9 +102,10 @@ CREATE TABLE `user` ( `new_second_equip` int(11) NOT NULL DEFAULT '2' COMMENT '新玩家隔天结算武器', `sum_coin` double NOT NULL DEFAULT '0' COMMENT '累计充值金额', `recharge_times_total` int(11) NOT NULL DEFAULT '0' COMMENT '累计充值次数', - `blobdata` mediumblob NOT NULL DEFAULT '' COMMENT 'cpa数据json', `cpa_times` int(11) NOT NULL DEFAULT '0' COMMENT 'cpa看视频次数', + + `daily_diamond_times` int(11) NOT NULL DEFAULT '0' COMMENT '兑换钻石次数', PRIMARY KEY (`idx`), UNIQUE KEY `accountid` (`accountid`) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; @@ -321,4 +322,18 @@ CREATE TABLE `holiday` ( UNIQUE KEY `accountid` (`accountid`) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +DROP TABLE IF EXISTS `draw`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `draw` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `accountid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'accountid', + `id` int(11) NOT NULL DEFAULT '0' COMMENT '抽奖id', + `cd_time` int(11) NOT NULL DEFAULT '0' COMMENT 'cd时间', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `accountid_drawid` (`accountid`, `id`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; -- Dump completed on 2015-08-19 18:51:22 diff --git a/sql/gamedb2004_n_migrate_210129_01.sql b/sql/gamedb2004_n_migrate_210129_01.sql new file mode 100644 index 0000000..119b9e1 --- /dev/null +++ b/sql/gamedb2004_n_migrate_210129_01.sql @@ -0,0 +1,21 @@ +begin; + +alter table user add column `daily_diamond_times` int(11) NOT NULL DEFAULT '0' COMMENT '兑换钻石次数'; + +DROP TABLE IF EXISTS `draw`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `draw` ( + `idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id', + `accountid` varchar(60) CHARACTER SET utf8 NOT NULL COMMENT 'accountid', + `id` int(11) NOT NULL DEFAULT '0' COMMENT '抽奖id', + `cd_time` int(11) NOT NULL DEFAULT '0' COMMENT 'cd时间', + `createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间', + PRIMARY KEY (`idx`), + UNIQUE KEY `accountid_drawid` (`accountid`, `id`) +) ENGINE=InnoDB AUTO_INCREMENT=10000 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; + +insert into version (version) values(2021012901); + +commit; diff --git a/webapp/controller/ActivityController.class.php b/webapp/controller/ActivityController.class.php index db0172b..31384f8 100644 --- a/webapp/controller/ActivityController.class.php +++ b/webapp/controller/ActivityController.class.php @@ -2,7 +2,9 @@ require 'classes/Quest.php'; require 'classes/AddReward.php'; - +require_once 'metatable/draw.php'; +require_once 'metatable/parameter.php'; +require_once 'metatable/drop.php'; class ActivityController{ private $actTableCache = null; @@ -1535,5 +1537,323 @@ class ActivityController{ return $item_list; } + + protected function insertDrawDB($account_id, $id ) + { + $conn = $this->getMysql($account_id); + $ret = $conn->execScript('INSERT INTO draw(accountid, id, cd_time, createtime, modifytime) ' . + ' VALUES(:account_id, :id, 0, :createtime, :modifytime) ' . + ' ON DUPLICATE KEY UPDATE accountid=:account_id, id=:id, cd_time=0, modifytime=:modifytime;', + array( + ':account_id' => $account_id, + ':id' => $id, + ':createtime' => time(), + ':modifytime' => time(), + )); + if(!$ret){ + die(); + return; + } + } + + public function drawBoxInfo() + { + $account_id = $_REQUEST['account_id']; + //登录校验 + $login = loginVerify($account_id, $_REQUEST['session_id']); + if (!$login) { + phpcommon\sendError(ERR_USER_BASE + 1, 'session无效'); + return; + } + $conn = $this->getMysql($account_id); + if (!$conn) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + $rows = $conn->execQuery('SELECT id, cd_time FROM draw WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + )); + $info_list = array(); + if (!$rows) { + $draw_conf = metatable\getDrawConf(); + foreach ($draw_conf as $d) { + $this->insertDrawDB($account_id, $d['id']); + array_push($info_list, array( + 'id' => $d['id'], + 'cd_time' => 0, + )); + } + } else { + foreach ($rows as $row) { + if ($row['cd_time'] <= time()) { + $ret = $conn->execScript('UPDATE draw SET cd_time=:cd_time, modifytime=:modifytime ' . + ' WHERE accountid=:accountid AND id=:id;', + array( + ':accountid' => $account_id, + ':cd_time' => 0, + ':id' => $row['id'], + ':modifytime' => time() + )); + if (!$ret) { + die(); + return; + } + } + array_push($info_list, array( + 'id' => $row['id'], + 'cd_time' => $row['cd_time'], + )); + } + } + + echo json_encode(array( + 'errcode' => 0, + 'errmsg' => '', + 'info_list' => $info_list, + )); + } + + public function drawBoxReward() + { + $account_id = $_REQUEST['account_id']; + //登录校验 + $login = loginVerify($account_id, $_REQUEST['session_id']); + if (!$login) { + phpcommon\sendError(ERR_USER_BASE + 1, 'session无效'); + return; + } + $conn = $this->getMysql($account_id); + if (!$conn) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + $id = $_REQUEST['id']; + $row = $conn->execQueryOne('SELECT cd_time FROM draw WHERE accountid=:accountid AND id=:id;', + array( + ':accountid' => $account_id, + ':id' => $id, + )); + if (!$row) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + if ($row['cd_time'] < time() && $row['cd_time'] != 0) { + phpcommon\sendError(ERR_USER_BASE + 2, '冷却时间未到'); + return; + } + + $dr = metatable\getDrawById($id); + if (!$dr) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + $drop_id = $dr['one_drop']; + $times = $dr['one_count']; + $item_list = array(); + $extra_id = $dr['ten_drop']; + $extra_times = $dr['ten_count']; + $cdtime = $dr['time_cd']; + $ret = $conn->execScript('UPDATE draw SET cd_time=:cd_time, modifytime=:modifytime ' . + ' WHERE accountid=:accountid AND id=:id;', + array( + ':accountid' => $account_id, + ':cd_time' => time() + $cdtime, + ':id' => $id, + ':modifytime' => time() + )); + if (!$ret) { + die(); + return; + } + for ($j = 0; $j < $extra_times; $j++) { + $item_list = metatable\getDropAllListById($extra_id, $item_list); + } + for ($i = 0; $i < $times; $i++) { + $item_list = metatable\getDropAllListById($drop_id, $item_list); + } + + $all_item_list = array(); + $addreward = new classes\AddReward(); + if (is_array($item_list)) { + foreach ($item_list as $item) { + $items = $addreward->addReward($item['item_id'], $item['item_num'], $account_id, $item['time'], 0); + foreach($items as $i) { + array_push($all_item_list, array( + 'item_id' => $i['item_id'], + 'item_num' => $i['item_num'], + 'time' => $i['time'], + )); + } + } + } + $coin_num = $addreward->getCoinNum($account_id); + $diamond_num = $addreward->getDiamondNum($account_id); + echo json_encode(array( + 'errcode' => 0, + 'errmsg' => '', + 'item_list' => $item_list, + 'coin_nums' => $coin_num, + 'diamond_nums' => $diamond_num, + 'all_item_list' => $all_item_list, + )); + } + + public function drawSpeedUpTime() + { + $account_id = $_REQUEST['account_id']; + //登录校验 + $login = loginVerify($account_id, $_REQUEST['session_id']); + if (!$login) { + phpcommon\sendError(ERR_USER_BASE + 1, 'session无效'); + return; + } + $conn = $this->getMysql($account_id); + if (!$conn) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + $rowuser = $conn->execQueryOne('SELECT diamond_num, coin_num FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id + )); + if (!$rowuser) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + $coin_num = $rowuser['coin_num']; + $diamond_num = $rowuser['diamond_num']; + if ($_REQUEST['type'] == 1) { + $costid = metatable\getParameterByName('drawbox_cost'); + $cost = metatable\getParameterByName('drawbox_cost_num'); + if ($costid == 10001) { + if($cost >= $rowuser['coin_num']) { + phpcommon\sendError(ERR_USER_BASE + 2, '金币不足'); + return; + } else { + $coin_num = $rowuser['coin_num'] - $cost; + } + } + + if ($costid == 10003) { + if($cost >= $rowuser['diamond_num']) { + phpcommon\sendError(ERR_USER_BASE + 3, '钻石不足'); + return; + } else { + $diamond_num = $rowuser['diamond_num'] - $cost; + } + } + + $ret = $conn->execScript('UPDATE user SET coin_num=:coin_num, diamond_num=:diamond_num, modify_time=:modifytime ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':coin_num' => $coin_num, + ':diamond_num' => $diamond_num, + ':modifytime' => time() + )); + if (!$ret) { + die(); + return; + } + } + $rows = $conn->execQuery('SELECT id, cd_time FROM draw WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + )); + if (!$rows) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + $speedtime = metatable\getParameterByName('drawbox_ad_cd'); + if ($_REQUEST['type'] == 1) { + $speedtime = metatable\getParameterByName('drawbox_item_cd'); + } + foreach ($rows as $row) { + $cd_time = $row['cd_time'] - $speedtime; + if ($cd_time <= time()) { + $cd_time = 0; + } + $ret = $conn->execScript('UPDATE draw SET cd_time=:cd_time, modifytime=:modifytime ' . + ' WHERE accountid=:accountid AND id=:id;', + array( + ':accountid' => $account_id, + ':cd_time' => $cd_time, + ':id' => $row['id'], + ':modifytime' => time() + )); + if (!$ret) { + die(); + return; + } + } + echo json_encode(array( + 'errcode' => 0, + 'errmsg' => '', + 'coin_nums' => $coin_num, + 'diamond_nums' => $diamond_num, + )); + } + + public function duihuanCoin() + { + $account_id = $_REQUEST['account_id']; + //登录校验 + $login = loginVerify($account_id, $_REQUEST['session_id']); + if (!$login) { + phpcommon\sendError(ERR_USER_BASE + 1, 'session无效'); + return; + } + $conn = $this->getMysql($account_id); + if (!$conn) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + $rowuser = $conn->execQueryOne('SELECT daily_diamond_times FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id + )); + if (!$rowuser) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + $num = metatable\getParameterByName('adddiamond_num'); + $times = metatable\getParameterByName('adddiamond_times'); + $addreward = new classes\AddReward(); + if ($rowuser['daily_diamond_times'] >= $times) { + phpcommon\sendError(ERR_USER_BASE + 2, '今日兑换次数已用完'); + return; + } + $addreward->addReward(10003, $num, $account_id, 0, 0); + $diamond_times = $rowuser['daily_diamond_times'] + 1; + $ret = $conn->execScript('UPDATE user SET daily_diamond_times=:daily_diamond_times, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':daily_diamond_times' => $diamond_times, + ':modify_time' => time() + )); + if (!$ret) { + die(); + return; + } + + $coin_num = $addreward->getCoinNum($account_id); + $diamond_num = $addreward->getDiamondNum($account_id); + $item_list = array(); + array_push($item_list, array( + 'item_id' => 10003, + 'item_num' => $num, + 'time' => 0, + )); + echo json_encode(array( + 'errcode' => 0, + 'errmsg' => '', + 'coin_nums' => $coin_num, + 'diamond_nums' => $diamond_num, + 'daily_diamond_times' => $diamond_times, + 'item_list' => $item_list, + )); + } } ?> diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index c2ad8cf..53ea7a6 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -199,9 +199,9 @@ class RoleController{ break; } } - $ret = $conn->execScript('INSERT INTO user(accountid, user_name, avatar_url, game_times, win_times, kills, harm, add_HP, alive_time, coin_num, integral, kill_his, alive_time_his, harm_his, add_HP_his, act_share_time, act_share_status, create_time, modify_time, first_fight, collect_status, keys_num, battle_re_times, shop_flush_times, kefu_status, sign_sum, box_num, diamond_num, sum_coin, pass_status, score, season_status, recharge_times_total, first_gift, season_time, free_coin, free_diamond, season_end_score, kill_modifytime, win_modifytime, rank_modifytime, vip_score, first_login, daily_first_login, daily_time, free_box, update_time, season_games, season_win, sea_max_kill, sea_max_hart, sea_avg_kill, free_lot_ticket, free_dou_lot_ticket, daily_order1, daily_order2, daily_order3, first_bee, newhand, coin_times, newInfo, first_day_ad, share_video_times, share_video_sums, act_video_status, act_ad_status, biogame_times, shop_view_times, new_first_equip, newhand2,game_times2, view_times2, guildcoin_num, new_second_equip, blobdata, cpa_times) ' . - ' VALUES(:accountid, :user_name, :avatar_url, 0, 0, 0, 0, 0, 0, 10000, 0, 0, 0, 0, 0, 0, 0, :create_time, :modify_time, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, :season_time, 0, 0, 0, 0, 0, 0, 0, 0, 0, :daily_time, 0,:update_time,0,0,0,0,0,0,0,0,0,0,0,0,0,:newInfo,0,0,0,0,0,0,0,0,0,0,0,0,2,:blobdata, 0) ' . - ' ON DUPLICATE KEY UPDATE accountid=:accountid, user_name=:user_name, avatar_url=:avatar_url, game_times=0, win_times=0, kills=0, harm=0, add_HP=0, alive_time=0, coin_num=0, integral=0, kill_his=0, alive_time_his=0, harm_his=0, add_HP_his=0, act_share_time=0, act_share_status=0, modify_time=:modify_time, first_fight=0, collect_status=0, keys_num=0, battle_re_times=0, shop_flush_times=0, kefu_status=0, sign_sum=0, box_num=0, diamond_num=0, sum_coin=0, pass_status=0, score=0, season_status=1, recharge_times_total=0, first_gift=0, season_time=:season_time, free_coin=0, free_diamond=0, season_end_score=0, kill_modifytime=0, win_modifytime=0, rank_modifytime=0, vip_score=0, first_login=0, daily_first_login=0, daily_time=:daily_time, free_box=0, update_time=:update_time, season_games=0, season_win=0, sea_max_kill=0, sea_max_hart=0, sea_avg_kill=0, free_lot_ticket=0, free_dou_lot_ticket=0, daily_order1=0, daily_order2=0, daily_order3=0, first_bee=0, newhand=0, coin_times=0, newInfo=:newInfo, first_day_ad=0, share_video_times=0, share_video_sums=0, act_video_status=0, act_ad_status=0, biogame_times=0, shop_view_times=0, new_first_equip=0, newhand2=0, game_times2=0,view_times2=0, guildcoin_num=0, new_second_equip=2, blobdata=:blobdata, cpa_times=0;', + $ret = $conn->execScript('INSERT INTO user(accountid, user_name, avatar_url, game_times, win_times, kills, harm, add_HP, alive_time, coin_num, integral, kill_his, alive_time_his, harm_his, add_HP_his, act_share_time, act_share_status, create_time, modify_time, first_fight, collect_status, keys_num, battle_re_times, shop_flush_times, kefu_status, sign_sum, box_num, diamond_num, sum_coin, pass_status, score, season_status, recharge_times_total, first_gift, season_time, free_coin, free_diamond, season_end_score, kill_modifytime, win_modifytime, rank_modifytime, vip_score, first_login, daily_first_login, daily_time, free_box, update_time, season_games, season_win, sea_max_kill, sea_max_hart, sea_avg_kill, free_lot_ticket, free_dou_lot_ticket, daily_order1, daily_order2, daily_order3, first_bee, newhand, coin_times, newInfo, first_day_ad, share_video_times, share_video_sums, act_video_status, act_ad_status, biogame_times, shop_view_times, new_first_equip, newhand2,game_times2, view_times2, guildcoin_num, new_second_equip, blobdata, cpa_times, daily_diamond_times) ' . + ' VALUES(:accountid, :user_name, :avatar_url, 0, 0, 0, 0, 0, 0, 10000, 0, 0, 0, 0, 0, 0, 0, :create_time, :modify_time, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, :season_time, 0, 0, 0, 0, 0, 0, 0, 0, 0, :daily_time, 0,:update_time,0,0,0,0,0,0,0,0,0,0,0,0,0,:newInfo,0,0,0,0,0,0,0,0,0,0,0,0,2,:blobdata, 0, 0) ' . + ' ON DUPLICATE KEY UPDATE accountid=:accountid, user_name=:user_name, avatar_url=:avatar_url, game_times=0, win_times=0, kills=0, harm=0, add_HP=0, alive_time=0, coin_num=0, integral=0, kill_his=0, alive_time_his=0, harm_his=0, add_HP_his=0, act_share_time=0, act_share_status=0, modify_time=:modify_time, first_fight=0, collect_status=0, keys_num=0, battle_re_times=0, shop_flush_times=0, kefu_status=0, sign_sum=0, box_num=0, diamond_num=0, sum_coin=0, pass_status=0, score=0, season_status=1, recharge_times_total=0, first_gift=0, season_time=:season_time, free_coin=0, free_diamond=0, season_end_score=0, kill_modifytime=0, win_modifytime=0, rank_modifytime=0, vip_score=0, first_login=0, daily_first_login=0, daily_time=:daily_time, free_box=0, update_time=:update_time, season_games=0, season_win=0, sea_max_kill=0, sea_max_hart=0, sea_avg_kill=0, free_lot_ticket=0, free_dou_lot_ticket=0, daily_order1=0, daily_order2=0, daily_order3=0, first_bee=0, newhand=0, coin_times=0, newInfo=:newInfo, first_day_ad=0, share_video_times=0, share_video_sums=0, act_video_status=0, act_ad_status=0, biogame_times=0, shop_view_times=0, new_first_equip=0, newhand2=0, game_times2=0,view_times2=0, guildcoin_num=0, new_second_equip=2, blobdata=:blobdata, cpa_times=0, daily_diamond_times=0;', array( ':accountid' => $account_id, ':user_name' => $user_name, @@ -276,6 +276,7 @@ class RoleController{ 'new_second_equip' => 2, 'blobdata' => '', 'cpa_times' => 0, + 'daily_diamond_times' => 0, )); } else { if ($avatar_url != '') { @@ -308,6 +309,7 @@ class RoleController{ $new_second_equip = $row['new_second_equip']; $blobdata = $row['blobdata']; $cpa_times = $row['cpa_times']; + $daily_diamond_times = $row['daily_diamond_times']; if (!$blobdata) { $blobdata = ''; } @@ -331,7 +333,7 @@ class RoleController{ $blobdata = $cpa_list['cpastr']; $cpa_times = $cpa_list['cpa_times']; $ret = $conn->execScript('UPDATE user SET daily_first_login=0, kefu_status=0, coin_times=0, ' . - 'modify_time=:modify_time, first_day_ad=0, share_video_times=0, new_second_equip=:new_second_equip, cpa_times=:cpa_times, blobdata=:blobdata WHERE accountid=:accountid;', + 'modify_time=:modify_time, first_day_ad=0, share_video_times=0, new_second_equip=:new_second_equip, cpa_times=:cpa_times, blobdata=:blobdata, daily_diamond_times=0 WHERE accountid=:accountid;', array( ':accountid' => $account_id, ':modify_time' => time(), @@ -348,6 +350,7 @@ class RoleController{ $coin_times = 0; $first_day_ad = 0; $share_video_times = 0; + $daily_diamond_times = 0; if (time() > $row['season_time'] && $row['season_time'] != 0) { $this->updateSeasonStatus($account_id); } @@ -413,6 +416,7 @@ class RoleController{ 'login_day' => floor(($nowTime - phpcommon\getdayseconds($row['create_time'])) / 3600 / 24), 'blobdata' => $blobdata, 'cpa_times' => $cpa_times, + 'daily_diamond_times' => $daily_diamond_times, )); } } diff --git a/webapp/metatable/draw.php b/webapp/metatable/draw.php new file mode 100644 index 0000000..056cc87 --- /dev/null +++ b/webapp/metatable/draw.php @@ -0,0 +1,26 @@ + $random) { + $item_id = $item_id_array[$i][0]; + $item_num = $item_num_array[$i][0]; + $time = 0; + if (!empty($time_array[$i][0]) && $time_array[$i][0] != '') { + $time = $time_array[$i][0]; + } + array_push($item_list, array( + 'item_id' => $item_id, + 'item_num' => $item_num, + 'time' => $time, + )); + } + } + } else if ($d['type'] == 2) { + $weight_sum = 0; + $keys = 0; + for ($i = 0; $i < count($weight_array); $i++) { + $weight_sum += $weight_array[$i][0]; + } + $random = Rand(0, $weight_sum); + $weight = 0; + for ($i = 0; $i < count($weight_array); $i++) { + $weight += $weight_array[$i][0]; + if ($weight > $random) { + $keys = $i; + break; + } + } + $item_id = $item_id_array[$keys][0]; + $item_num = $item_num_array[$keys][0]; + $item_time = $time_array[$keys][0]; + array_push($item_list, array( + 'item_id' => $item_id, + 'item_num' => $item_num, + 'time' => $item_time, + )); + } + return $item_list; +} + +function getDropListById($drop_id) +{ + $d = getDropById($drop_id); + if (!$d) { + return null; + } + $item_list = array(); + $item_list = getDropInfo($d, $item_list); + return $item_list; +} + +function getDropInfoById($drop_id) +{ + $d = getDropById($drop_id); + if (!$d) { + return null; + } + $item_list = array(); + $item_id_array = getExplode($d['item_id']); + $item_num_array = getExplode($d['num']); + $weight_array = getExplode($d['weight']); + $time_array = getExplode($d['time']); + for ($i = 0; $i < count($weight_array); $i++) { + $item_id = $item_id_array[$i][0]; + $item_num = $item_num_array[$i][0]; + $weight = $weight_array[$i][0]; + $time = 0; + if (!empty($time_array[$i][0]) && $time_array[$i][0] != '') { + $time = $time_array[$i][0]; + } + array_push($item_list, array( + 'item_id' => $item_id, + 'item_num' => $item_num, + 'time' => $time, + 'weight' => $weight, + )); + } + return $item_list; +} diff --git a/webapp/metatable/parameter.php b/webapp/metatable/parameter.php index f730816..e1a88a9 100644 --- a/webapp/metatable/parameter.php +++ b/webapp/metatable/parameter.php @@ -21,7 +21,7 @@ function getParameterByName($param_name) $conf = getParameterConf(); foreach ($conf as $key => $val) { if ($val['param_name'] == $param_name) { - return $val; + return $val['param_value']; } } return null;