diff --git a/sql/gamedb.sql b/sql/gamedb.sql index be9f43b..305959c 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -100,6 +100,9 @@ CREATE TABLE `user` ( `newhand2` int(11) NOT NULL DEFAULT '0' COMMENT '精英礼包领取状态', `game_times2` int(11) NOT NULL DEFAULT '0' COMMENT '精英礼包战斗场次', `view_times2` int(11) NOT NULL DEFAULT '0' COMMENT '精英礼包视频场次', + + `guildcoin_num` int(11) NOT NULL DEFAULT '0' COMMENT '战队货币', + `new_second_equip` int(11) NOT NULL DEFAULT '2' COMMENT '新玩家隔天结算武器', PRIMARY KEY (`idx`), UNIQUE KEY `accountid` (`accountid`) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; diff --git a/sql/gamedb2004_n_migrate_201014_01.sql b/sql/gamedb2004_n_migrate_201014_01.sql new file mode 100644 index 0000000..051e276 --- /dev/null +++ b/sql/gamedb2004_n_migrate_201014_01.sql @@ -0,0 +1,8 @@ +begin; + +alter table user add column `guildcoin_num` int(11) NOT NULL DEFAULT '0' COMMENT '战队货币'; +alter table user add column `new_second_equip` int(11) NOT NULL DEFAULT '2' COMMENT '新玩家结算武器'; + +insert into version (version) values(2020101401); + +commit; diff --git a/webapp/bootstrap/init.php b/webapp/bootstrap/init.php index db7b68e..d734dc0 100644 --- a/webapp/bootstrap/init.php +++ b/webapp/bootstrap/init.php @@ -91,11 +91,16 @@ define('DAILYCOIN_TIMES', 131); //每日金币领取次数 define('DAILYCOIN_NUM', 132); //每日金币基准数 define('SHARE_VIDEO_REWARD', 147); //分享视频奖励 define('EQUIPREWARD_PARAMETER', 152); //结算比例 -define('DIAMONDTOCOIN_NUM', 153); //钻石换金币 -define('CREAM_TASK_01', 155); //钻石换金币 -define('CREAM_TASK_02', 156); //钻石换金币 +define('DIAMONDTOCOIN_NUM', 153); //钻石换金币 +define('CREAM_TASK_01', 155); //钻石换金币 +define('CREAM_TASK_02', 156); //钻石换金币 +define('CLAN_VIDEO_DIAMOND', 165); //观看视频,领取的钻石数量 +define('CLAN_DIAMOND', 164); //创建战队需要的钻石数量 +define('OPENING_SPEAR', 154); //新玩家奖励第一把武器 +define('OPENING_SPEAR2', 178); //新玩家奖励第二把武器 + require 'config_loader.php'; function getConfigBaseDir() diff --git a/webapp/controller/GameOverController.class.php b/webapp/controller/GameOverController.class.php index 0a6088d..c3a41b2 100644 --- a/webapp/controller/GameOverController.class.php +++ b/webapp/controller/GameOverController.class.php @@ -463,4 +463,62 @@ class GameOverController{ } return $item_list; } + + public function getDiamond() + { + $account_id = $_REQUEST['account_id']; + //登录校验 + $login = loginVerify($account_id, $_REQUEST['session_id']); + if (!$login) { + phpcommon\sendError(ERR_USER_BASE + 1, 'session无效'); + return; + } + $addreward = new classes\AddReward(); + $p = $this->getParameter(CLAN_VIDEO_DIAMOND); + $par = $p['param_value']; + $items = $addreward->addReward(10003, $par, $account_id, 0, 0); + $diamond_num = $addreward->getDiamondNum($account_id); + echo json_encode(array( + 'errcode' => 0, + 'errmsg'=> '', + 'diamond_nums' => $diamond_num, + )); + } + + public function updateDiamond() + { + $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 + 2, '没有这个玩家'); + die(); + } + $rowUser = $conn->execQueryOne('SELECT diamond_num FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + )); + if (!$rowUser) { + phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家'); + return; + } + $p = $this->getParameter(CLAN_DIAMOND); + $par = $p['param_value']; + if ($rowUser['diamond_num'] < $par) { + $par = 0; + } + $addreward = new classes\AddReward(); + $items = $addreward->addReward(10003, -$par, $account_id, 0, 0); + $diamond_num = $addreward->getDiamondNum($account_id); + echo json_encode(array( + 'errcode' => 0, + 'errmsg'=> '', + 'diamond_nums' => $diamond_num, + )); + } } diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index 8fc0f37..761dc7b 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) ' . - ' 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) ' . - ' 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;', + $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) ' . + ' 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) ' . + ' 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;', array( ':accountid' => $account_id, ':user_name' => $user_name, @@ -271,6 +271,8 @@ class RoleController{ 'newhand2' =>0, 'game_times2'=>0, 'view_times2'=>0, + 'guildcoin_num' => 0, + 'new_second_equip' => 2, )); } else { if ($avatar_url != '') { @@ -300,6 +302,7 @@ class RoleController{ $first_day_ad = $row['first_day_ad']; $share_video_times = $row['share_video_times']; $act_ad_status = $row['act_ad_status']; + $new_second_equip = $row['new_second_equip']; if ($row['vip_score'] >= 5 && $act_ad_status != 2) { $act_ad_status = 1; $ret = $conn->execScript('UPDATE user SET act_ad_status=:act_ad_status WHERE accountid=:accountid;', @@ -313,11 +316,15 @@ class RoleController{ } } if ($row['update_time'] == 0 || ($nowTime - phpcommon\getdayseconds($row['update_time']) > 0)) { + if ($new_second_equip == 2 && $row['new_first_equip'] == 1) { + $new_second_equip = 0; + } $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 WHERE accountid=:accountid;', + 'modify_time=:modify_time, first_day_ad=0, share_video_times=0, new_second_equip=:new_second_equip WHERE accountid=:accountid;', array( ':accountid' => $account_id, ':modify_time' => time(), + ':new_second_equip' => $new_second_equip, )); if (!$ret) { die(); @@ -388,6 +395,8 @@ class RoleController{ 'newhand2' =>$row['newhand2'], 'game_times2'=>$row['game_times2'], 'view_times2'=>$row['view_times2'], + 'guildcoin_num'=> $row['guildcoin_num'], + 'new_second_equip' => $new_second_equip, )); } } @@ -1954,26 +1963,43 @@ class RoleController{ 'time' => 0 )); $all_item_list = $addreward->addReward($id, 1, $account_id, 0, 0); - $ret = $conn->execScript('UPDATE user SET new_first_equip=1, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':modify_time' => time(), - )); - if (!$ret) { - die(); - return; - } - $ret = $conn->execScript('UPDATE equip SET using_id=:using_id, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':using_id' => $id, - ':modify_time' => time(), - )); - if (!$ret) { - die(); - return; + $p1 = $this->getParameter(OPENING_SPEAR); + $equip1 = $p1['param_value']; + $p2 = $this->getParameter(OPENING_SPEAR2); + $equip2 = $p2['param_value']; + if ($equip1 == $id) { + $ret = $conn->execScript('UPDATE user SET new_first_equip=1, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':modify_time' => time(), + )); + if (!$ret) { + die(); + return; + } + $ret = $conn->execScript('UPDATE equip SET using_id=:using_id, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':using_id' => $id, + ':modify_time' => time(), + )); + if (!$ret) { + die(); + return; + } + } else if ($equip2 == $id) { + $ret = $conn->execScript('UPDATE user SET new_second_equip=1, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':modify_time' => time(), + )); + if (!$ret) { + die(); + return; + } } echo json_encode(array( 'errcode' => 0, diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index f4a4fdb..18e9191 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -191,6 +191,7 @@ class ShopController{ 'equ_list' => $user_db['equ_list'], 'clo_list' => $user_db['clo_list'], 'item_list' => $user_db['item_list'], + 'guild_list' => $user_db['guild_list'], )); } @@ -216,8 +217,14 @@ class ShopController{ $equ_list = $this->randomNewShop(4); $clo_list = $this->randomNewShop(5); $item_list = $this->randomNewShop(6); + $guild_list = $this->randomNewShop(7); $active_time = time(); } else { + if (empty($user_db['guild_list'])) { + $guild_list = $this->randomNewShop(7); + } else { + $guild_list = $user_db['guild_list']; + } $act_list = $user_db['act_list']; $free_list = $user_db['free_list']; $sel_list = $user_db['sel_list']; @@ -244,7 +251,9 @@ class ShopController{ } else if($shop_conf[$i]['shop_id'] == 5) { $clo_list = $this->randomNewShop(5); } else if($shop_conf[$i]['shop_id'] == 6) { - $item_list = $this->randomNewShop(6); + $item_list = $this->randomNewShop(6); + } else if ($shop_conf[$i]['shop_id'] == 7) { + $guild_list = $this->randomNewShop(7); } } $active_time = $nowTime; @@ -259,6 +268,7 @@ class ShopController{ 'equ_list' => $equ_list, 'clo_list' => $clo_list, 'item_list' => $item_list, + 'guild_list' => $guild_list, ); $this->saveShopDB($account_id, $shop_db); } @@ -502,6 +512,12 @@ class ShopController{ return $re; } } + } else if ($type == 7) { + foreach ($user_db['guild_list'] as $re) { + if ($re['id'] == $id) { + return $re; + } + } } return null; } @@ -1242,7 +1258,7 @@ class ShopController{ phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家'); return; } - $rowCoin = $conn->execQueryOne('SELECT coin_num, diamond_num, shop_view_times, first_day_ad FROM user WHERE accountid=:accountid;', + $rowCoin = $conn->execQueryOne('SELECT coin_num, diamond_num, guildcoin_num, shop_view_times, first_day_ad FROM user WHERE accountid=:accountid;', array( ':accountid' => $account_id )); @@ -1298,6 +1314,24 @@ class ShopController{ } } } + + if ($tips == 4) { + if ($rowCoin['guildcoin_num'] < $coin_num) { + phpcommon\sendError(ERR_USER_BASE + 8, '战队货币不足'); + die(); + return; + } + $ret = $conn->execScript('UPDATE user SET guildcoin_num=:guildcoin_num, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':guildcoin_num' => $rowCoin['guildcoin_num'] - $coin_num, + ':modify_time' => time() + )); + if (!$ret) { + die(); + } + } } } ?> diff --git a/webapp/controller/SignController.class.php b/webapp/controller/SignController.class.php index ee8cae0..f4d5747 100644 --- a/webapp/controller/SignController.class.php +++ b/webapp/controller/SignController.class.php @@ -169,7 +169,7 @@ class SignController{ $flag = 0; foreach ($rows as $row) { if ($row['sign_id'] > $last_sign_id) { - if ($last_sign_time >= $row['sign_time']) { + if ($last_sign_time <= $row['sign_time']) { $last_sign_time = $row['sign_time']; } $last_sign_id = $row['sign_id']; diff --git a/webapp/metatable/shop.php b/webapp/metatable/shop.php index 7398619..9b58a5d 100644 --- a/webapp/metatable/shop.php +++ b/webapp/metatable/shop.php @@ -49,15 +49,6 @@ function randGoods($shop_conf, $exclude_goods) $goods_buy = getExplode($shop_conf['price']); $goods_discount = explode('|', $shop_conf['discount']); $discount_num = $shop_conf['discount_num']; - // if (!empty($exclude_goods)) { - // for ($i = count($goods_list) - 1; $i >= 0; --$i) { - // if (array_key_exists($goods_list[$i], $exclude_goods)) { - // array_splice($goods_list, $i, 1); - // array_splice($goods_weight, $i, 1); - // --$num; - // } - // } - // } $goods = array(); for ($i = 0; $i < $num; ++$i) { $rand_space = 0;