diff --git a/sql/gamedb.sql b/sql/gamedb.sql index bc06b5f..1feff03 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -90,6 +90,10 @@ CREATE TABLE `user` ( `daily_order2` int(11) NOT NULL DEFAULT '0' COMMENT '每日免费宝箱2', `daily_order3` int(11) NOT NULL DEFAULT '0' COMMENT '每日免费宝箱3', `first_bee` int(11) NOT NULL DEFAULT '0' COMMENT '首次蜜蜂抽奖', + + `newhand` int(11) NOT NULL DEFAULT '0' COMMENT '新手奖励状态', + `coin_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日兑换金币次数', + `newInfo` mediumblob NOT NULL COMMENT '新手引导信息', PRIMARY KEY (`idx`), UNIQUE KEY `accountid` (`accountid`) ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; @@ -241,4 +245,21 @@ CREATE TABLE `additem_log` ( ) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin; +DROP TABLE IF EXISTS `equip`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `equip` ( + `idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id', + `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `id` int(11) NOT NULL DEFAULT '0' COMMENT '装备id', + `lv` int(11) NOT NULL DEFAULT '0' COMMENT '装备等级', + `active_time` int(11) NOT NULL DEFAULT '0' COMMENT '进阶时间', + `sub_time` int(11) NOT NULL DEFAULT '0' COMMENT '缩短时间', + `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modify_time` 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; + + -- Dump completed on 2015-08-19 18:51:22 diff --git a/sql/gamedb2004_n_migrate_200529_01.sql b/sql/gamedb2004_n_migrate_200529_01.sql new file mode 100644 index 0000000..8c2d51a --- /dev/null +++ b/sql/gamedb2004_n_migrate_200529_01.sql @@ -0,0 +1,26 @@ +begin; + +alter table user add column `newhand` int(11) NOT NULL DEFAULT '0' COMMENT '新手奖励状态'; +alter table user add column `coin_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日兑换金币次数'; +alter table user add column `newInfo` mediumblob NOT NULL COMMENT '新手引导信息'; +UPDATE user set vip_score=0 WHERE 1=1; + +DROP TABLE IF EXISTS `equip`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `equip` ( + `idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id', + `accountid` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id', + `id` int(11) NOT NULL DEFAULT '0' COMMENT '装备id', + `lv` int(11) NOT NULL DEFAULT '0' COMMENT '装备等级', + `active_time` int(11) NOT NULL DEFAULT '0' COMMENT '进阶时间', + `sub_time` int(11) NOT NULL DEFAULT '0' COMMENT '缩短时间', + `create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间', + `modify_time` 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; + +insert into version (version) values(20200529); + +commit; diff --git a/webapp/bootstrap/init.php b/webapp/bootstrap/init.php index 06ee216..1758c73 100644 --- a/webapp/bootstrap/init.php +++ b/webapp/bootstrap/init.php @@ -84,6 +84,11 @@ define('LOGINBOX_TIME1', 100); //登录礼包-早晨开始时间 define('LOGINBOX_TIME2', 101); //登录礼包-中午开始时间 define('LOGINBOX_TIME3', 102); //登录礼包-晚上开始时间 define('LOGINBOX_TIME', 103); //登录礼包延时 +define('NEWHAND_NUM1', 108); //新人奖励战斗次数 +define('NEWHAND_NUM2', 109); //新人奖励广告次数 +define('DAILYCOIN_DECAY', 130); //每日金币衰减比例 +define('DAILYCOIN_TIMES', 131); //每日金币领取次数 +define('DAILYCOIN_NUM', 132); //每日金币基准数 require 'config_loader.php'; diff --git a/webapp/classes/AddReward.php b/webapp/classes/AddReward.php index 6f00918..7b5033f 100644 --- a/webapp/classes/AddReward.php +++ b/webapp/classes/AddReward.php @@ -85,7 +85,7 @@ class AddReward { $this->addticket($item['item_id'], $item['item_num'], $account_id); } else if ($i['type'] == 9){ $this->addtenticket($item['item_id'], $item['item_num'], $account_id); - } else if ($i['type'] == 10){ + } else if ($i['type'] == 10 || $i['type'] == 11){ $this->addweizhuang($item['item_id'], $item['item_num'], $account_id); } else { $price = $i['diamond']; @@ -184,20 +184,23 @@ class AddReward { phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); die(); } - $rows = $conn->execQuery('SELECT id, status FROM bag WHERE accountid=:accountid;', - array( - ':accountid' => $accountid, - )); + $it = $this->getItem($item_id); + $status = 1; $sum = 0; - foreach ($rows as $r) { - $it = $this->getItem($r['id']); - if ($r['status'] == 0 && $it['type'] == 10) { - $sum++; + if ($it['type'] == 10) { + $rows = $conn->execQuery('SELECT id, status FROM bag WHERE accountid=:accountid;', + array( + ':accountid' => $accountid, + )); + foreach ($rows as $r) { + $it = $this->getItem($r['id']); + if ($r['status'] == 0 && $it['type'] == 10) { + $sum++; + } + } + if ($sum < 4) { + $status = 0; } - } - $status = 0; - if ($sum >= 4) { - $status = 1; } $row = $conn->execQueryOne('SELECT status, num FROM bag WHERE accountid=:accountid AND id=:id;', array( @@ -221,12 +224,14 @@ class AddReward { die(); } } else { - $status = $row['status']; - if ($row['status'] == 2) { - if ($sum >= 4) { - $status = 1; - } else { - $status = 0; + if ($it['type'] == 10) { + $status = $row['status']; + if ($row['status'] == 2) { + if ($sum >= 4) { + $status = 1; + } else { + $status = 0; + } } } $ret = $conn->execScript('UPDATE bag SET num=:num, status=:status, modify_time=:modify_time ' . diff --git a/webapp/controller/ActivityController.class.php b/webapp/controller/ActivityController.class.php index fefc819..58ca2a9 100644 --- a/webapp/controller/ActivityController.class.php +++ b/webapp/controller/ActivityController.class.php @@ -192,51 +192,6 @@ class ActivityController{ ); $r -> set($drawtable_uuid, json_encode($drawtable_db)); $r -> pexpire($drawtable_uuid, 1000 * 3600 * 24); - /*if (empty($user_db_str)) { - $drawtable_list = $this->randomReward(2); - $drawtable_db = array( - 'drawtable_uuid' => $drawtable_uuid, - 'drawtable_list' => $drawtable_list, - ); - $r -> set($drawtable_uuid, json_encode($drawtable_db)); - $r -> pexpire($drawtable_uuid, 1000 * 3600 * 24); - } else { - $drawtable_db = json_decode($user_db_str, true); - $drawtable_list = $this->randomReward(2); - $drawtable_db = array( - 'drawtable_uuid' => $drawtable_uuid, - 'drawtable_list' => $drawtable_list, - ); - $r -> set($drawtable_uuid, json_encode($drawtable_db)); - $r -> pexpire($drawtable_uuid, 1000 * 3600 * 24); - $rowTime = $conn->execQueryOne('SELECT modify_time FROM activity WHERE accountid=:accountid;', - array( - ':accountid' => $account_id - )); - if (phpcommon\getdayseconds(time()) - phpcommon\getdayseconds($rowTime['modify_time']) > 0) { - $drawtable_list = $this->randomReward(2); - $drdrawtableaw_db = array( - 'drawtable_uuid' => $drawtable_uuid, - 'drawdrawtable_list' => $drawtable_list, - ); - $r -> set($drawtable_uuid, json_encode($drawtable_db)); - $r -> pexpire($drawtable_uuid, 1000 * 3600 * 24); - } else { - $user_db = json_decode($user_db_str, true); - if (empty($user_db)) { - phpcommon\sendError(ERR_USER_BASE + 1,'session失效'); - return; - } - foreach ($user_db['drawtable_list'] as $drawtable) { - array_push($drawtable_list, array( - 'item_id' => $drawtable['item_id'], - 'item_num' => $drawtable['item_num'], - 'quailty' => $drawtable['quailty'], - 'time' => $drawtable['time'], - )); - } - } - }*/ echo json_encode(array( 'errcode' => 0, @@ -297,7 +252,6 @@ class ActivityController{ $free_times = $p_free['value'] - $row['free_times']; $video_times = $p_video['value'] - $row['video_times']; } - //道具物品 $user_db_str = $r->get($draw_uuid); if (empty($user_db_str)) { @@ -499,7 +453,7 @@ class ActivityController{ return; } - if ($row['free_times'] + $row['video_times'] + 1 == 6) { + if ($row['free_times'] + $row['video_times'] + 1 == 3) { $g_conf_lot_cluster = require('../res/lottery@lottery.php'); for($g = 1; $g <= count($g_conf_lot_cluster); $g++) { $l = $this->getLottery($g); @@ -519,7 +473,7 @@ class ActivityController{ } else { $key = $lot_array[1]['key']; } - } else if ($row['free_times'] + $row['video_times'] + 1 == 10) { + } else if ($row['free_times'] + $row['video_times'] + 1 == 6) { foreach ($user_db['draw_list'] as $draw) { if (isset($draw['status']) && $draw['status'] != 0) { continue; @@ -556,7 +510,6 @@ class ActivityController{ } } } - foreach ($user_db['draw_list'] as &$draw) { if ($draw['key'] + 1 == $key) { $item_id = $draw['item_id']; diff --git a/webapp/controller/AdditemController.class.php b/webapp/controller/AdditemController.class.php index 25acaf3..1166f55 100644 --- a/webapp/controller/AdditemController.class.php +++ b/webapp/controller/AdditemController.class.php @@ -82,16 +82,22 @@ class AdditemController{ $status = 1; $active_time = 0; if ($item_id != 0){ - $ret = $conn->execScript('INSERT INTO bag(accountid, id, color_id, status, active_time, create_time, modify_time) ' . - ' VALUES(:account_id, :id, 0, :status, :active_time, :create_time, :modify_time) ' . - ' ON DUPLICATE KEY UPDATE accountid=:account_id, id=:id, color_id=0, status=:status, active_time=:active_time, modify_time=:modify_time;', + if ($it['type'] == 10 || $it['type'] == 11) { + $item_num = $row['num'] + $item_num; + } else { + $item_num = 1; + } + $ret = $conn->execScript('INSERT INTO bag(accountid, id, color_id, status, active_time, create_time, modify_time, num) ' . + ' VALUES(:account_id, :id, 0, :status, :active_time, :create_time, :modify_time, :num) ' . + ' ON DUPLICATE KEY UPDATE accountid=:account_id, id=:id, color_id=0, status=:status, active_time=:active_time, modify_time=:modify_time, num=:num;', array( ':account_id' => $accountid, ':id' => $item_id, ':active_time' => $active_time, ':status' => $status, ':create_time' => time(), - ':modify_time' => time() + ':modify_time' => time(), + ':num' => $item_num )); if(!$ret){ die(); diff --git a/webapp/controller/HangController.class.php b/webapp/controller/HangController.class.php index 71e1aae..feb7682 100644 --- a/webapp/controller/HangController.class.php +++ b/webapp/controller/HangController.class.php @@ -250,12 +250,10 @@ class HangController{ } $rank = $ii; $max_rank_score = $seaPoint['max'] + 1 - $seaPoint['min']; - $rank_score = $row['integral'] - $seaPoint['min']; + $rank_score = $row['integral'] - $seaPoint['min'] + 1; if ($seaPoint['max'] == -1) { $max_rank_score = $seaPoint['min']; $rank_score = $row['integral']; - } else if ($seaPoint['min'] == 0) { - $max_rank_score = $seaPoint['max'] + 1; } } } diff --git a/webapp/controller/PassController.class.php b/webapp/controller/PassController.class.php index 28d5a5e..4da0c5b 100644 --- a/webapp/controller/PassController.class.php +++ b/webapp/controller/PassController.class.php @@ -187,15 +187,14 @@ class PassController{ } $rank = $ii; $max_rank_score = $seaPoint['max'] + 1 - $seaPoint['min']; - $rank_score = $row['integral'] - $seaPoint['min']; + $rank_score = $row['integral'] - $seaPoint['min'] + 1; if ($seaPoint['max'] == -1) { $max_rank_score = $seaPoint['min']; $rank_score = $row['integral']; - } else if ($seaPoint['min'] == 0) { - $max_rank_score = $seaPoint['max'] + 1; } } } + if ($rank == 0) { phpcommon\sendError(ERR_USER_BASE + 3, '未达到段位要求'); return; diff --git a/webapp/controller/PayController.class.php b/webapp/controller/PayController.class.php index 20a1051..df8ce41 100644 --- a/webapp/controller/PayController.class.php +++ b/webapp/controller/PayController.class.php @@ -703,7 +703,7 @@ class PayController{ )); } - public function getVipExp() + public function addADtimes() { $account_id = $_REQUEST['account_id']; //登录校验 @@ -717,7 +717,7 @@ class PayController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - $row = $conn->execQueryOne('SELECT vip_score FROM user WHERE accountid=:accountid;', + $row = $conn->execQueryOne('SELECT vip_score, game_times, newhand FROM user WHERE accountid=:accountid;', array( ':accountid' => $account_id, )); @@ -725,12 +725,21 @@ class PayController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - $ret = $conn->execScript('UPDATE user SET vip_score=:vip_score, modify_time=:modify_time ' . + $newhand = $row['newhand']; + $p1 = $this->getParameter(NEWHAND_NUM1); + $fight_times = $p1['value']; + $p2 = $this->getParameter(NEWHAND_NUM2); + $view_times = $p2['value']; + if ($row['game_times'] >= $fight_times && $row['vip_score'] + 1 == $view_times) { + $newhand = 1; + } + $ret = $conn->execScript('UPDATE user SET vip_score=:vip_score, modify_time=:modify_time, newhand=:newhand ' . ' WHERE accountid=:accountid;', array( ':accountid' => $account_id, ':modify_time' => time(), - ':vip_score' => $row['vip_score'] + 1 + ':vip_score' => $row['vip_score'] + 1, + ':newhand' => $newhand )); if (!$ret) { die(); diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index 3d4e040..80936c8 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -37,7 +37,7 @@ class RoleController{ $p = array( 'id' => $parameter_meta['id'], 'name' => $parameter_meta['param_name'], - 'value' => $parameter_meta['param_value'], + 'param_value' => $parameter_meta['param_value'], ); return $p; } @@ -115,10 +115,11 @@ class RoleController{ array( ':accountid' => $account_id )); + //$newInfo = array(); if (!$row) { - $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) ' . - ' VALUES(:accountid, :user_name, :avatar_url, 0, 0, 0, 0, 0, 0, 0, 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, 0, 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) ' . - ' 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=0, 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;', + $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) ' . + ' VALUES(:accountid, :user_name, :avatar_url, 0, 0, 0, 0, 0, 0, 0, 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, 0, 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) ' . + ' 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=0, 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;', array( ':accountid' => $account_id, ':user_name' => $user_name, @@ -127,6 +128,7 @@ class RoleController{ ':modify_time' => time(), ':daily_time' => 0, ':update_time' => time(), + ':newInfo' => '' )); if (!$ret) { die(); @@ -166,6 +168,10 @@ class RoleController{ 'free_lot_ticket' => 0, 'free_dou_lot_ticket' => 0, 'time' => time(), + 'newhand' => 0, + 'vip_score' => 0, + 'coin_times' => 0, + 'newInfo' => '' )); } else { /*$ret = $conn->execScript('UPDATE user SET first_login=1 ' . @@ -199,8 +205,10 @@ class RoleController{ } $nowTime = phpcommon\getdayseconds(time()); $daily_first_login = $row['daily_first_login']; + $coin_times = $row['coin_times']; + $kefu_status = $row['kefu_status']; if ($row['update_time'] == 0 || ($nowTime - phpcommon\getdayseconds($row['update_time']) > 0)) { - $ret = $conn->execScript('UPDATE user SET daily_first_login=0, ' . + $ret = $conn->execScript('UPDATE user SET daily_first_login=0, kefu_status=0, coin_times=0, ' . 'modify_time=:modify_time WHERE accountid=:accountid;', array( ':accountid' => $account_id, @@ -211,6 +219,8 @@ class RoleController{ return; } $daily_first_login = 0; + $kefu_status = 0; + $coin_times = 0; } echo json_encode(array( 'errcode' => 0, @@ -227,7 +237,7 @@ class RoleController{ 'first_fight' => $row['first_fight'], 'collect_status' => $row['collect_status'], 'keys_num' => $row['keys_num'], - 'kefu_status' => $row['kefu_status'], + 'kefu_status' => $kefu_status, 'box_num' => $row['box_num'], 'diamond_num' => $row['diamond_num'], 'pass_status' => $row['pass_status'], @@ -249,6 +259,9 @@ class RoleController{ 'free_dou_lot_ticket' => $row['free_dou_lot_ticket'], 'free_lot_ticket' => $row['free_lot_ticket'], 'time' => time(), + 'newhand' => $row['newhand'], + 'coin_times' => $coin_times, + 'newInfo' => $row['newInfo'] )); } } @@ -307,6 +320,12 @@ class RoleController{ $coin_num = $_REQUEST['coin_num']; //金币 $integral = $_REQUEST['rank_score']; //排位积分 $score = $_REQUEST['pass_score']; //通行证积分 + + if ($_REQUEST['items'] != '') { + $item_list = $this->getExplode($_REQUEST['items']); + $addreward = new classes\AddReward(); + $addreward->addReward((int)$item_list[0][0], (int)$item_list[0][1], $account_id, 0, 0); + } if (!$map_id) { $map_id = 0; } @@ -406,7 +425,17 @@ class RoleController{ if ($switch == 1) { $daily_first_login = $daily_first_login + 1; }*/ - $ret = $conn->execScript('UPDATE user SET game_times=:game_times, kills=:kills, harm=:harm, add_HP=:add_HP, alive_time=:alive_time, kill_his=:kill_his, alive_time_his=:alive_time_his, harm_his=:harm_his, add_HP_his=:add_HP_his, coin_num=:coin_num, modify_time=:modify_time, first_fight=1, box_num=:box_num, score=:score, daily_time=:daily_time, season_games=:season_games, sea_max_kill=:sea_max_kill, sea_max_hart=:sea_max_hart, sea_avg_kill=:sea_avg_kill ' . + + $newhand = $row['newhand']; + $p1 = $this->getParameter(NEWHAND_NUM1); + $fight_times = $p1['param_value']; + $p2 = $this->getParameter(NEWHAND_NUM2); + $view_times = $p2['param_value']; + if ($row['game_times'] + 1 == $fight_times && $row['vip_score'] >= $view_times) { + $newhand = 1; + } + + $ret = $conn->execScript('UPDATE user SET game_times=:game_times, kills=:kills, harm=:harm, add_HP=:add_HP, alive_time=:alive_time, kill_his=:kill_his, alive_time_his=:alive_time_his, harm_his=:harm_his, add_HP_his=:add_HP_his, coin_num=:coin_num, modify_time=:modify_time, first_fight=1, box_num=:box_num, score=:score, daily_time=:daily_time, season_games=:season_games, sea_max_kill=:sea_max_kill, sea_max_hart=:sea_max_hart, sea_avg_kill=:sea_avg_kill, newhand=:newhand ' . 'WHERE accountid=:accountid;', array( ':game_times' => $row['game_times'] + 1, @@ -428,6 +457,7 @@ class RoleController{ ':sea_max_kill' => $sea_max_kill, ':sea_max_hart' => $sea_max_hart, ':sea_avg_kill' => $row['sea_avg_kill'] + $kills, + ':newhand' => $newhand, )); if (!$ret) { die(); @@ -751,10 +781,15 @@ class RoleController{ return; } $coin_num = $_REQUEST['coin_num']; + $reward_id = $_REQUEST['reward_id']; + $reward_num = $_REQUEST['reward_num']; $addreward = new classes\AddReward(); $p = $this->getParameter(GAMEOVER_REWARD_TIMES); - $times = $p['value'] - 1; + $times = $p['param_value'] - 1; $addreward->addReward(10001, $coin_num * $times, $account_id, 0, 0); + if ($reward_id != 0) { + $addreward->addReward($reward_id, $reward_num * $times, $account_id, 0, 0); + } $coin_num = $addreward->getCoinNum($account_id); echo json_encode(array( 'errcode' => 0, @@ -763,6 +798,79 @@ class RoleController{ )); } + public function getNewHandReward() + { + $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; + } + $row = $conn->execQueryOne('SELECT newhand FROM user WHERE accountid=:account_id;', + array( + ':account_id' => $account_id + )); + if (!$row || $row['newhand'] != 1) { + phpcommon\sendError(ERR_USER_BASE + 2, '未达到领取条件'); + return; + } + $ret = $conn->execScript('UPDATE user SET newhand=2, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':modify_time' => time(), + ':accountid' => $account_id + )); + if (!$ret) { + die(); + return; + } + $d = $this->getDrop(29001); + if (!$d) { + phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励'); + return; + } + $item_list = array(); + $all_item_list = array(); + $item_id_array = $this->getExplode($d['item_id']); + $item_num_array = $this->getExplode($d['num']); + for ($i = 0; $i < count($item_id_array); $i++) { + $item_id = $item_id_array[$i][0]; + $item_num = $item_num_array[$i][0]; + array_push($item_list, array( + 'item_id' => $item_id, + 'item_num' => $item_num, + 'time' => 0 + )); + } + $addreward = new classes\AddReward(); + 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); + $num = $addreward->getDiamondNum($account_id); + echo json_encode(array( + 'errcode' => 0, + 'errmsg'=> '', + 'item_list' => $item_list, + 'coin_num' => $coin_num, + 'diamond_nums' => $num, + 'all_item_list' => $all_item_list + )); + } + public function getSessionId() { $account_id = $_REQUEST['account_id']; @@ -794,5 +902,111 @@ class RoleController{ ); return $session_id; } + + + public function exchangeCoin() + { + $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 coin_times, coin_num FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + )); + + if (!$rowUser) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + + $coin_times = $rowUser['coin_times']; + $p1 = $this->getParameter(DAILYCOIN_TIMES); + $max_times = $p1['param_value']; + $p2 = $this->getParameter(DAILYCOIN_DECAY); + $val = $p2['param_value']; + $p3 = $this->getParameter(DAILYCOIN_NUM); + $num = $p3['param_value']; + if ($coin_times >= $max_times) { + phpcommon\sendError(ERR_USER_BASE + 2, '今日次数达到上限'); + return; + } + $coin_num = round($num * pow($val, $coin_times)); + //error_log($coin_num); + $ret = $conn->execScript('UPDATE user SET coin_times=:coin_times, coin_num=:coin_num, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':coin_times' => $coin_times + 1, + ':coin_num' => $coin_num + $rowUser['coin_num'], + ':modify_time' => time() + )); + if (!$ret) { + die(); + return; + } + $coin = $coin_num + $rowUser['coin_num']; + echo json_encode(array( + 'errcode' => 0, + 'errmsg' => '', + 'coin_nums' => $coin, + 'coin_times' => $coin_times + 1 + )); + } + + public function saveNewbie() + { + $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; + } + //$info = array(); + $id = $_REQUEST['id']; + $rowUser = $conn->execQueryOne('SELECT newInfo FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + )); + + if (!$rowUser) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + $info = json_decode($rowUser['newInfo']); + if (empty($info)) { + $info = array(); + } + array_push($info, (int)$id); + $ret = $conn->execScript('UPDATE user SET newInfo=:newInfo,modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':newInfo' => json_encode($info), + ':modify_time' => time() + )); + if (!$ret) { + die(); + return; + } + echo json_encode(array( + 'errcode' => 0, + 'errmsg' => '', + )); + } } ?> diff --git a/webapp/controller/ShopController.class.php b/webapp/controller/ShopController.class.php index d4b5e4c..06d7b61 100644 --- a/webapp/controller/ShopController.class.php +++ b/webapp/controller/ShopController.class.php @@ -739,7 +739,7 @@ class ShopController{ if ($tips == 1) { //扣除货币 if ($rowCoin['coin_num'] < $coin_num) { - phpcommon\sendError(ERR_USER_BASE + 5, '金币不足'); + phpcommon\sendError(ERR_USER_BASE + 3, '金币不足'); die(); } $ret = $conn->execScript('UPDATE user SET coin_num=:coin_num, modify_time=:modify_time ' . diff --git a/webapp/controller/SignController.class.php b/webapp/controller/SignController.class.php index ae5a8c9..6272d5a 100644 --- a/webapp/controller/SignController.class.php +++ b/webapp/controller/SignController.class.php @@ -73,6 +73,21 @@ class SignController{ return $season; } + protected function getSeasonPoint($seaPoint_id) + { + $seaPoint_meta_table = require('../res/seasomPoint@seasomPoint.php'); + $seaPoint_meta = getSeasonPointConfig($seaPoint_meta_table, $seaPoint_id); + $seaPoint = array( + 'id' => $seaPoint_meta['id'], + 'min' => $seaPoint_meta['min_point'], + 'max' => $seaPoint_meta['max_point'], + 'des' => $seaPoint_meta['des'], + 'topoint' => $seaPoint_meta['topoint'], + //'weekreward' => $seaPoint_meta['week_reward'], + ); + return $seaPoint; + } + protected function getParameter($para_id) { $g_conf_para_cluster = require('../res/parameter@parameter.php'); @@ -153,6 +168,7 @@ class SignController{ array( ':accountid' => $account_id )); + //$this->updateSeasonStatus($account_id); if ($nowTime - phpcommon\getdayseconds($rowuser['update_time']) > 0) { //每日刷新 $this->updateDaily($account_id); @@ -430,7 +446,7 @@ class SignController{ } } //刷新战斗结算奖励次数,商店刷新次数,客服, 每日免费金币钻石 - $battle_ret = $conn->execScript('UPDATE user SET battle_re_times=0, diamond_shop_flush_times=0, shop_flush_times=0, kefu_status=0, free_coin=0, free_diamond=0, daily_order1=0, daily_order2=0, daily_order3=0, modify_time=:modify_time, free_box=0, update_time=:update_time ' . + $battle_ret = $conn->execScript('UPDATE user SET battle_re_times=0, diamond_shop_flush_times=0, shop_flush_times=0, free_coin=0, free_diamond=0, daily_order1=0, daily_order2=0, daily_order3=0, modify_time=:modify_time, free_box=0, update_time=:update_time ' . ' WHERE accountid=:accountid;', array( ':accountid' => $account_id, @@ -450,13 +466,27 @@ class SignController{ die(); } //刷新邀请好友奖励 + $rowShare = $conn->execQueryOne('SELECT status FROM share_achievement WHERE accountid=:accountid AND ach_id=3;', + array( + ':accountid' => $account_id, + )); + $order = 0; + if ($rowShare['status'] == 1) { + $order = 3; + $share1 = $conn->execScript('DELETE from share_achievement ' . + ' WHERE accountid=:accountid AND ach_id<=3;', + array( + ':accountid' => $account_id, + )); + } $share_ret = $conn->execScript('UPDATE share_achievement SET status=0, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', + ' WHERE accountid=:accountid AND ach_id>:ach_id;', array( ':accountid' => $account_id, - ':modify_time' => time() + ':modify_time' => time(), + ':ach_id' => $order )); - if (!$share_ret) { + if (!$share_ret && !$share1) { die(); } } @@ -483,13 +513,23 @@ class SignController{ break; } } - $user_ret = $conn->execScript('UPDATE user SET pass_status=0, score=0, season_status=0, integral=0, season_end_score=:season_end_score, modify_time=:modify_time, season_games=0, sea_max_kill=0, sea_max_hart=0, sea_avg_kill=0, season_win=0, season_time=:season_time ' . + $season_point_table = require('../res/seasomPoint@seasomPoint.php'); + $integral = 0; + for ($j = 1; $j <= count($season_point_table); $j++) { + $seasonpoint = $this->getSeasonPoint($j); + if ($rowUser['integral'] <= $seasonpoint['max']) { + $integral = $seasonpoint['topoint']; + break; + } + } + $user_ret = $conn->execScript('UPDATE user SET pass_status=0, score=0, season_status=0, integral=:integral, season_end_score=:season_end_score, modify_time=:modify_time, season_games=0, sea_max_kill=0, sea_max_hart=0, sea_avg_kill=0, season_win=0, season_time=:season_time ' . ' WHERE accountid=:accountid;', array( ':accountid' => $account_id, ':season_end_score' => $rowUser['integral'], ':modify_time' => time(), - ':season_time' => $end_time + ':season_time' => $end_time, + ':integral' => $integral )); if (!$user_ret) { die();