From 68cd3da5242e7cf160f7f2973105f82a16aaaa2d Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 29 Jul 2020 10:35:15 +0800 Subject: [PATCH] 1 --- sql/gamedb.sql | 10 +- sql/gamedb2004_n_migrate_200729_01.sql | 9 + .../controller/ActivityController.class.php | 19 +- webapp/controller/PayController.class.php | 13 +- webapp/controller/RoleController.class.php | 236 +++++++++++++++++- 5 files changed, 270 insertions(+), 17 deletions(-) create mode 100644 sql/gamedb2004_n_migrate_200729_01.sql diff --git a/sql/gamedb.sql b/sql/gamedb.sql index a8d576c..2c11b91 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -75,28 +75,26 @@ CREATE TABLE `user` ( `daily_time` int(11) NOT NULL DEFAULT '0' COMMENT '每日刷新时间', `free_box` int(11) NOT NULL DEFAULT '0' COMMENT '每日免费宝箱', `update_time` int(11) NOT NULL DEFAULT '0' COMMENT '刷新活动时间', - - `season_games` int(11) NOT NULL DEFAULT '0' COMMENT '赛季场次总数', `season_win` int(11) NOT NULL DEFAULT '0' COMMENT '赛季胜利场次', `sea_max_kill` int(11) NOT NULL DEFAULT '0' COMMENT '赛季最高击杀', `sea_max_hart` int(11) NOT NULL DEFAULT '0' COMMENT '赛季最高伤害', `sea_avg_kill` int(11) NOT NULL DEFAULT '0' COMMENT '赛季场均淘汰', - `free_lot_ticket` int(11) NOT NULL DEFAULT '0' COMMENT '免费抽奖券', `free_dou_lot_ticket` int(11) NOT NULL DEFAULT '0' COMMENT '免费十倍抽奖券', - `daily_order1` int(11) NOT NULL DEFAULT '0' COMMENT '每日免费宝箱1', `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 '新手引导信息', - `first_day_ad` int(11) NOT NULL DEFAULT '0' COMMENT '每日看广告次数', `share_video_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日分享视频次数', + + `act_video_status` int(11) NOT NULL DEFAULT '0' COMMENT '分享录频奖励领取状态', + `act_ad_status` int(11) NOT NULL DEFAULT '0' COMMENT '观看广告奖励领取状态', + `share_video_sums` 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; diff --git a/sql/gamedb2004_n_migrate_200729_01.sql b/sql/gamedb2004_n_migrate_200729_01.sql new file mode 100644 index 0000000..f07fa22 --- /dev/null +++ b/sql/gamedb2004_n_migrate_200729_01.sql @@ -0,0 +1,9 @@ +begin; + +alter table user add column `act_video_status` int(11) NOT NULL DEFAULT '0' COMMENT '分享录频奖励领取状态'; +alter table user add column `act_ad_status` int(11) NOT NULL DEFAULT '0' COMMENT '观看广告奖励领取状态'; +alter table user add column `share_video_sums` int(11) NOT NULL DEFAULT '0' COMMENT '分享录频次数'; + +insert into version (version) values(2020072901); + +commit; diff --git a/webapp/controller/ActivityController.class.php b/webapp/controller/ActivityController.class.php index d1e3dbd..6ae5c94 100644 --- a/webapp/controller/ActivityController.class.php +++ b/webapp/controller/ActivityController.class.php @@ -97,6 +97,7 @@ class ActivityController{ 'quailty' => $lot_conf['quailty'], 'jilv' => $lot_conf['jilv'], 'time' => $lot_conf['time'], + 'day' => $lot_conf['day'], ); return $l; } @@ -185,7 +186,7 @@ class ActivityController{ //道具物品 //$user_db_str = $r->get($drawtable_uuid); - $drawtable_list = $this->randomReward(2); + $drawtable_list = $this->randomReward(2,$account_id); $drawtable_db = array( 'drawtable_uuid' => $drawtable_uuid, 'drawtable_list' => $drawtable_list, @@ -255,7 +256,7 @@ class ActivityController{ //道具物品 $user_db_str = $r->get($draw_uuid); if (empty($user_db_str)) { - $draw_list = $this->randomReward(1); + $draw_list = $this->randomReward(1,$account_id); $draw_db = array( 'draw_uuid' => $draw_uuid, 'draw_list' => $draw_list, @@ -271,7 +272,7 @@ class ActivityController{ if (phpcommon\getdayseconds(time()) - phpcommon\getdayseconds($rowTime['modify_time']) > 0) { $user_db_str = $r->get($draw_uuid); - $draw_list = $this->randomReward(1); + $draw_list = $this->randomReward(1,$account_id); $draw_db = json_decode($user_db_str, true); $draw_db = array( 'draw_uuid' => $draw_uuid, @@ -640,7 +641,7 @@ class ActivityController{ )); } - protected function randomReward($type) + protected function randomReward($type,$accountid) { $draw_list = array(); $g_conf_lot_cluster = array(); @@ -649,6 +650,11 @@ class ActivityController{ } else { $g_conf_lot_cluster = require('../res/lotterydraw@lotterydraw.php'); } + $day = 1; + if ($type == 1 && phpcommon\extractChannel($accountid) == 6006) { + $day = date('w', time()); + } + for ($i = 1; $i <= count($g_conf_lot_cluster); $i++) { $item_id = 0; $item_num = 0; @@ -662,6 +668,11 @@ class ActivityController{ //确定商品id和数量 $weight_sum = 0; $weight_array = $this->getExplode($l['weight']); + if ($type == 1) { + if ($l['day'] != $day) { + continue; + } + } for ($ii = 0; $ii < count($weight_array); $ii++) { $weight_sum += $weight_array[$ii][0]; } diff --git a/webapp/controller/PayController.class.php b/webapp/controller/PayController.class.php index df8ce41..bddce2d 100644 --- a/webapp/controller/PayController.class.php +++ b/webapp/controller/PayController.class.php @@ -717,7 +717,7 @@ class PayController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - $row = $conn->execQueryOne('SELECT vip_score, game_times, newhand FROM user WHERE accountid=:accountid;', + $row = $conn->execQueryOne('SELECT vip_score, game_times, newhand, act_ad_status FROM user WHERE accountid=:accountid;', array( ':accountid' => $account_id, )); @@ -730,16 +730,21 @@ class PayController{ $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) { + if ($row['game_times'] >= $fight_times && $row['vip_score'] + 1 == $view_times && $newhand == 0) { $newhand = 1; } - $ret = $conn->execScript('UPDATE user SET vip_score=:vip_score, modify_time=:modify_time, newhand=:newhand ' . + $status = $row['act_ad_status']; + if ($row['vip_score'] + 1 >= 5 && $row['act_ad_status'] < 1){ + $status = 1; + } + $ret = $conn->execScript('UPDATE user SET vip_score=:vip_score, modify_time=:modify_time, newhand=:newhand, act_ad_status=:act_ad_status ' . ' WHERE accountid=:accountid;', array( ':accountid' => $account_id, ':modify_time' => time(), ':vip_score' => $row['vip_score'] + 1, - ':newhand' => $newhand + ':newhand' => $newhand, + ':act_ad_status' => $status, )); if (!$ret) { die(); diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index b489460..1230f4e 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -167,9 +167,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) ' . - ' VALUES(:accountid, :user_name, :avatar_url, 0, 0, 0, 0, 0, 0, 200, 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) ' . - ' 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;', + $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) ' . + ' VALUES(:accountid, :user_name, :avatar_url, 0, 0, 0, 0, 0, 0, 200, 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) ' . + ' 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;', array( ':accountid' => $account_id, ':user_name' => $user_name, @@ -226,6 +226,9 @@ class RoleController{ 'first_day_ad' => 0, 'integral' => 0, 'share_video_times' => 0, + 'share_video_sums' => 0, + 'act_video_status' => 0, + 'act_ad_status' => 0 )); } else { if ($avatar_url != '') { @@ -254,6 +257,19 @@ class RoleController{ $kefu_status = $row['kefu_status']; $first_day_ad = $row['first_day_ad']; $share_video_times = $row['share_video_times']; + $act_ad_status = $row['act_ad_status']; + 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;', + array( + ':accountid' => $account_id, + ':act_ad_status' => $act_ad_status + )); + if (!$ret) { + die(); + return; + } + } if ($row['update_time'] == 0 || ($nowTime - phpcommon\getdayseconds($row['update_time']) > 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;', @@ -321,6 +337,9 @@ class RoleController{ 'first_day_ad' => 0, 'integral' => $row['integral'], 'share_video_times' => $share_video_times, + 'share_video_sums' => $row['share_video_sums'], + 'act_video_status' => $row['act_video_status'], + 'act_ad_status' => $act_ad_status )); } } @@ -1488,5 +1507,216 @@ class RoleController{ 'flag' => 1, )); } + + public function getShareVideoReward() + { + $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 act_video_status FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + )); + + if (!$rowUser) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + if ($rowUser['act_video_status'] != 1){ + phpcommon\sendError(ERR_USER_BASE + 2, '奖励不可领取'); + return; + } + + $ret = $conn->execScript('UPDATE user SET act_video_status=2, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':modify_time' => time() + )); + if (!$ret) { + die(); + return; + } + + $addreward = new classes\AddReward(); + $item_list = array(); + $all_item_list = array(); + array_push($item_list,array( + 'item_id' => 13018, + 'item_num' => 1, + 'time' => 0 + )); + $items = $addreward->addReward(13018, 1, $account_id, 0, 0); + foreach($items as $i) { + array_push($all_item_list, array( + 'item_id' => $i['item_id'], + 'item_num' => $i['item_num'], + 'time' => $i['time'], + )); + } + + array_push($item_list,array( + 'item_id' => 15018, + 'item_num' => 1, + 'time' => 0 + )); + $items = $addreward->addReward(15018, 1, $account_id, 0, 0); + foreach($items as $i) { + array_push($all_item_list, array( + 'item_id' => $i['item_id'], + 'item_num' => $i['item_num'], + 'time' => $i['time'], + )); + } + $diamond_num = $addreward->getDiamondNum($account_id); + echo json_encode(array( + 'errcode' => 0, + 'errmsg'=> '', + 'diamond_nums' => $diamond_num, + 'item_list' => $item_list, + 'all_item_list' => $all_item_list, + 'status' => 2, + )); + } + + public function getWatchAdReward() + { + $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 act_ad_status FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + )); + + if (!$rowUser) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + if ($rowUser['act_ad_status'] != 1){ + phpcommon\sendError(ERR_USER_BASE + 2, '奖励不可领取'); + return; + } + + $ret = $conn->execScript('UPDATE user SET act_ad_status=2, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':modify_time' => time() + )); + if (!$ret) { + die(); + return; + } + + $addreward = new classes\AddReward(); + $item_list = array(); + $all_item_list = array(); + array_push($item_list,array( + 'item_id' => 13003, + 'item_num' => 1, + 'time' => 0 + )); + $items = $addreward->addReward(13003, 1, $account_id, 0, 0); + foreach($items as $i) { + array_push($all_item_list, array( + 'item_id' => $i['item_id'], + 'item_num' => $i['item_num'], + 'time' => $i['time'], + )); + } + + array_push($item_list,array( + 'item_id' => 15003, + 'item_num' => 1, + 'time' => 0 + )); + $items = $addreward->addReward(15003, 1, $account_id, 0, 0); + foreach($items as $i) { + array_push($all_item_list, array( + 'item_id' => $i['item_id'], + 'item_num' => $i['item_num'], + 'time' => $i['time'], + )); + } + + $diamond_num = $addreward->getDiamondNum($account_id); + echo json_encode(array( + 'errcode' => 0, + 'errmsg'=> '', + 'diamond_nums' => $diamond_num, + 'item_list' => $item_list, + 'all_item_list' => $all_item_list, + 'status' => 2, + )); + } + + public function addVideotimes() + { + $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 share_video_sums, act_video_status FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + + )); + if (!$row) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + + } + $status = $row['act_video_status']; + if ($row['share_video_sums'] + 1 >= 3 && $row['act_video_status'] < 1){ + $status = 1; + } + $ret = $conn->execScript('UPDATE user SET share_video_sums=:share_video_sums, modify_time=:modify_time, act_video_status=:act_video_status ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':modify_time' => time(), + ':share_video_sums' => $row['share_video_sums'] + 1, + ':act_video_status' => $status, + )); + if (!$ret) { + die(); + return; + } + echo json_encode(array( + 'errcode' => 0, + 'errmsg'=> '', + )); + } } ?>