diff --git a/sql/gamedb.sql b/sql/gamedb.sql index bb45bc1..c1b88fd 100644 --- a/sql/gamedb.sql +++ b/sql/gamedb.sql @@ -90,11 +90,18 @@ CREATE TABLE `user` ( `share_video_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日分享视频次数', `daily_skin_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日兑换碎片次数', `share_equip_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日武器分享次数', - `daily_diamond_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日兑换钻石次数', `newhand` 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 '字节活动礼包视频场次', + + `daily_ad_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日抽奖活动次数', + `daily_draw_status` int(11) NOT NULL DEFAULT '0' COMMENT '每日抽奖活动状态', + `daily_box_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日宝箱活动次数', + `daily_box_status` int(11) NOT NULL DEFAULT '0' COMMENT '每日宝箱活动状态', + `daily_box2_status` int(11) NOT NULL DEFAULT '0' COMMENT '每日宝箱活动2状态', + `mid_aut_adtimes` int(11) NOT NULL DEFAULT '0' COMMENT '中秋活动广告次数', + `mid_aut_status` 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/gamedb2001_n_migrate_200924_01.sql b/sql/gamedb2001_n_migrate_200924_01.sql new file mode 100644 index 0000000..c5614f1 --- /dev/null +++ b/sql/gamedb2001_n_migrate_200924_01.sql @@ -0,0 +1,13 @@ +begin; + +alter table user add column `daily_ad_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日活动广告次数'; +alter table user add column `mid_aut_adtimes` int(11) NOT NULL DEFAULT '0' COMMENT '中秋活动广告次数'; +alter table user add column `mid_aut_status` int(11) NOT NULL DEFAULT '0' COMMENT '中秋活动奖励状态'; +alter table user add column `daily_draw_status` int(11) NOT NULL DEFAULT '0' COMMENT '每日抽奖活动状态'; +alter table user add column `daily_box_times` int(11) NOT NULL DEFAULT '0' COMMENT '每日宝箱活动次数'; +alter table user add column `daily_box_status` int(11) NOT NULL DEFAULT '0' COMMENT '每日宝箱活动状态'; +alter table user add column `daily_box2_status` int(11) NOT NULL DEFAULT '0' COMMENT '每日宝箱活动2状态'; + +insert into version (version) values(2020092401); + +commit; diff --git a/webapp/bootstrap/init.php b/webapp/bootstrap/init.php index dc15b7b..b6a6d25 100644 --- a/webapp/bootstrap/init.php +++ b/webapp/bootstrap/init.php @@ -90,6 +90,12 @@ define('ZIJIE_DIAMONDREWARD',89); define('ZIJIE_DIAMONDREWARD_TIMES',90); define('ZIJIE_LUCKYLVUP_NUM',92); +define('ZIJIE_DRAWBOX_TIMES',93); +define('ZIJIE_DRAWBOX_DROP',94); +define('ZIJIE_LINEBOX_TIMES',95); +define('ZIJIE_LINEBOX_DROP',96); +define('ZIJIE_ACTIVITY2_ADS',97); +define('ZIJIE_ACTIVITY2_REWARD',98); require 'config_loader.php'; diff --git a/webapp/controller/ActivityController.class.php b/webapp/controller/ActivityController.class.php index baf912e..a83256b 100644 --- a/webapp/controller/ActivityController.class.php +++ b/webapp/controller/ActivityController.class.php @@ -326,6 +326,14 @@ class ActivityController{ return; } } + + //更新每日抽奖宝箱活动状态 + $boxtimes = $this->getboxtimes($account_id); + if ($boxtimes == -1) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + //增加奖励 $addreward = new classes\AddReward(); $addreward->addReward($item_id, $item_num, $account_id); @@ -336,6 +344,10 @@ class ActivityController{ 'item_id' => $item_id, 'item_num' => $item_num, )); + $row = $conn->execQueryOne('SELECT daily_draw_status FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id + )); echo json_encode(array( 'errcode' => 0, 'errmsg'=> '', @@ -343,10 +355,43 @@ class ActivityController{ 'item_num' => $item_num, 'coin_nums' => $coin_num, 'diamond_nums' => $diamond_num, - 'item_list' => $item_list + 'item_list' => $item_list, + 'times' => $boxtimes, + 'status' => $row['daily_draw_status'], )); } + protected function getboxtimes($account_id) + { + $p1 = $this->getParameter(ZIJIE_DRAWBOX_TIMES); + $times = $p1['value']; + $conn = $this->getMysql($account_id); + $row = $conn->execQueryOne('SELECT daily_ad_times, daily_draw_status FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id + )); + if (!$row) { + return -1; + } + $draw_times = $row['daily_ad_times'] + 1; + $status = $row['daily_draw_status']; + if ($draw_times >= $times && $status == 0) { + $status = 1; + } + $ret = $conn->execScript('UPDATE user SET daily_draw_status=:daily_draw_status, daily_ad_times=:daily_ad_times, ' . + 'modify_time=:modify_time WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':modify_time' => time(), + ':daily_ad_times' => $draw_times, + ':daily_draw_status' => $status, + )); + if (!$ret) { + die(); + } + return $draw_times; + } + public function doubleLuckDraw() { $account_id = $_REQUEST['account_id']; @@ -590,7 +635,8 @@ class ActivityController{ $user_db_str = $r->get($airReward_uuid); $airReward_num = 0; $last_time = 0; - if (empty($user_db_str)) { + // if (phpcommon\extractChannel($account_id) == 6006 || + // phpcommon\extractChannel($account_id) == 6000) { $airReward_list = $this->getRandomAirReward(24106); $airReward_db = array( 'airReward_uuid' => $airReward_uuid, @@ -598,17 +644,27 @@ class ActivityController{ ); $r -> set($airReward_uuid, json_encode($airReward_db)); $r -> pexpire($airReward_uuid, 1000 * 7200); - } else { - $user_db = json_decode($user_db_str, true); - unset($user_db['airReward_list']); - $airReward_list = $this->getRandomAirReward(24106); - $airReward_db = array( - 'airReward_uuid' => $airReward_uuid, - 'airReward_list' => $airReward_list, - ); - $r -> set($airReward_uuid, json_encode($airReward_db)); - $r -> pexpire($airReward_uuid, 1000 * 7200); - } + // } else { + // if (empty($user_db_str)) { + // $airReward_list = $this->getRandomAirReward(24106); + // $airReward_db = array( + // 'airReward_uuid' => $airReward_uuid, + // 'airReward_list' => $airReward_list, + // ); + // $r -> set($airReward_uuid, json_encode($airReward_db)); + // $r -> pexpire($airReward_uuid, 1000 * 7200); + // } else { + // $user_db = json_decode($user_db_str, true); + // unset($user_db['airReward_list']); + // $airReward_list = $this->getRandomAirReward(24106); + // $airReward_db = array( + // 'airReward_uuid' => $airReward_uuid, + // 'airReward_list' => $airReward_list, + // ); + // $r -> set($airReward_uuid, json_encode($airReward_db)); + // $r -> pexpire($airReward_uuid, 1000 * 7200); + // } + // } $ret = $conn->execScript('UPDATE user SET box_num=:box_num, modify_time=:modify_time ' . ' WHERE accountid=:accountid;', array( @@ -632,7 +688,6 @@ class ActivityController{ )); } - public function airDoubleReward() { $account_id = $_REQUEST['account_id']; @@ -673,6 +728,105 @@ class ActivityController{ )); } + public function getDailyExtraBox() + { + $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 daily_draw_status, daily_box_status, daily_box2_status FROM user WHERE accountid=:account_id;', + array( + ':account_id' => $account_id + )); + if (!$row) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + + $type = 0; + $daily_draw_status = $row['daily_draw_status']; + $daily_box_status = $row['daily_box_status']; + $daily_box2_status = $row['daily_box2_status']; + if (isset($_REQUEST['type'])) { + $type = $_REQUEST['type']; + } + $item_list = array(); + $drop_id = 0; + if ($type == 0) { + if ($row['daily_draw_status'] != 1) { + phpcommon\sendError(ERR_USER_BASE + 2, '未达到要求'); + return; + } + $p = $this->getParameter(ZIJIE_DRAWBOX_DROP); + $drop_id = $p['value']; + $daily_draw_status = 2; + } + + if ($type == 1) { + if ($row['daily_box_status'] != 1) { + phpcommon\sendError(ERR_USER_BASE + 2, '未达到要求'); + return; + } + $p = $this->getParameter(ZIJIE_LINEBOX_DROP); + $delim = "|"; + $drop_multiply = explode($delim, $p['value']); + $drop_id = $drop_multiply[0]; + $daily_box_status = 2; + } + + if ($type == 2) { + if ($row['daily_box2_status'] != 1) { + phpcommon\sendError(ERR_USER_BASE + 2, '未达到要求'); + return; + } + $p = $this->getParameter(ZIJIE_LINEBOX_DROP); + $delim = "|"; + $drop_multiply = explode($delim, $p['value']); + $drop_id = $drop_multiply[1]; + $daily_box2_status = 2; + } + + $ret = $conn->execScript('UPDATE user SET daily_draw_status=:daily_draw_status, daily_box_status=:daily_box_status, daily_box2_status=:daily_box2_status, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':modify_time' => time(), + ':accountid' => $account_id, + ':daily_draw_status'=> $daily_draw_status, + ':daily_box_status'=>$daily_box_status, + ':daily_box2_status'=>$daily_box2_status + )); + if (!$ret) { + die(); + return; + } + + $item_list = $this->getRandomAirReward($drop_id); + foreach ($item_list as $i) { + //增加奖励 + $addreward = new classes\AddReward(); + $addreward->addReward($i['item_id'], $i['item_num'], $account_id); + } + $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, + 'daily_draw_status'=> $daily_draw_status, + 'daily_box_status'=>$daily_box_status, + 'daily_box2_status'=>$daily_box2_status + )); + } protected function getRandomAirReward($drop_id) { diff --git a/webapp/controller/EmojiController.class.php b/webapp/controller/EmojiController.class.php index 0bc68a2..ed74991 100644 --- a/webapp/controller/EmojiController.class.php +++ b/webapp/controller/EmojiController.class.php @@ -229,34 +229,36 @@ class EmojiController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个表情'); return; } - if ($emoji['get_type'] != 2) { + if ($emoji['get_type'] != 2 && $emoji['get_type'] != 4) { phpcommon\sendError(ERR_USER_BASE + 1, '不能用钻石购买'); return; } - //扣除钻石 - $row = $conn->execQueryOne('SELECT diamond_num FROM user WHERE accountid=:accountid;', - array( - ':accountid' => $account_id - )); - if (!$row) { - phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家'); - return; - } - if ($row['diamond_num'] < $emoji['number']) { - phpcommon\sendError(ERR_USER_BASE + 3, '钻石不足'); - return; - } - $ret = $conn->execScript('UPDATE user SET diamond_num=:diamond_num, modify_time=:modify_time ' . - ' WHERE accountid=:accountid;', - array( - ':accountid' => $account_id, - ':diamond_num' => $row['diamond_num'] - $emoji['number'], - ':modify_time' => time() - )); - if (!$ret) { - die(); - return; + if ($emoji['get_type'] == 2) { + //扣除钻石 + $row = $conn->execQueryOne('SELECT diamond_num FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id + )); + if (!$row) { + phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家'); + return; + } + if ($row['diamond_num'] < $emoji['number']) { + phpcommon\sendError(ERR_USER_BASE + 3, '钻石不足'); + return; + } + $ret = $conn->execScript('UPDATE user SET diamond_num=:diamond_num, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':diamond_num' => $row['diamond_num'] - $emoji['number'], + ':modify_time' => time() + )); + if (!$ret) { + die(); + return; + } } //修改状态 diff --git a/webapp/controller/HangController.class.php b/webapp/controller/HangController.class.php index b8ce195..b331f0c 100644 --- a/webapp/controller/HangController.class.php +++ b/webapp/controller/HangController.class.php @@ -303,5 +303,56 @@ class HangController{ 'diamond_nums' => $num, )); } + + public function getMidAutReward() + { + $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 mid_aut_status FROM user WHERE accountid=:account_id;', + array( + ':account_id' => $account_id + )); + if (!$row || $row['mid_aut_status'] != 1) { + phpcommon\sendError(ERR_USER_BASE + 2, '未达到领取条件'); + return; + } + $ret = $conn->execScript('UPDATE user SET mid_aut_status=2, modify_time=:modify_time ' . + ' WHERE accountid=:accountid;', + array( + ':modify_time' => time(), + ':accountid' => $account_id + )); + if (!$ret) { + die(); + return; + } + $p_num = $this->getParameter(ZIJIE_ACTIVITY2_REWARD); + $item_list = array(); + array_push($item_list, array( + 'item_id' => $p_num['param_value'], + 'item_num' => 1, + )); + $addreward = new classes\AddReward(); + $item_list = $addreward->addReward($p_num['param_value'], 1, $account_id); + $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, + )); + } } ?> diff --git a/webapp/controller/PayController.class.php b/webapp/controller/PayController.class.php index 5f91948..19933c5 100644 --- a/webapp/controller/PayController.class.php +++ b/webapp/controller/PayController.class.php @@ -762,7 +762,7 @@ class PayController{ phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); return; } - $row = $conn->execQueryOne('SELECT vip_score, game_times2, newhand, view_times2 FROM user WHERE accountid=:accountid;', + $row = $conn->execQueryOne('SELECT vip_score, game_times2, newhand, view_times2, mid_aut_adtimes, mid_aut_status FROM user WHERE accountid=:accountid;', array( ':accountid' => $account_id, )); @@ -772,16 +772,22 @@ class PayController{ } $newhand = $row['newhand']; + $mid_aut_status = $row['mid_aut_status']; $rview_times2 = $row['view_times2']; $p3 = $this->getParameter(ZIJIE_ACTIVITY_FIGHT); $fight_times2 = $p3['value']; $p4 = $this->getParameter(ZIJIE_ACTIVITY_ADS); $view_times2 = $p4['value']; + $p5 = $this->getParameter(ZIJIE_ACTIVITY2_ADS); + $aut_times = $p5['value']; if ($row['game_times2'] >= $fight_times2 && $row['view_times2'] + 1 == $view_times2 && $newhand == 0) { $newhand = 1; } + if ($row['mid_aut_adtimes'] + 1 >= $aut_times && $mid_aut_status == 0) { + $mid_aut_status = 1; + } $rview_times2++; - $ret = $conn->execScript('UPDATE user SET vip_score=:vip_score, newhand=:newhand, view_times2=:view_times2, modify_time=:modify_time ' . + $ret = $conn->execScript('UPDATE user SET vip_score=:vip_score, newhand=:newhand, view_times2=:view_times2, mid_aut_adtimes=:mid_aut_adtimes, mid_aut_status=:mid_aut_status, modify_time=:modify_time ' . ' WHERE accountid=:accountid;', array( ':accountid' => $account_id, @@ -789,6 +795,8 @@ class PayController{ ':vip_score' => $row['vip_score'] + 1, ':newhand' => $newhand, ':view_times2' => $rview_times2, + ':mid_aut_adtimes' => $row['mid_aut_adtimes'] + 1, + ':mid_aut_status' => $mid_aut_status )); if (!$ret) { die(); @@ -799,6 +807,8 @@ class PayController{ 'errmsg'=> '', 'view_times' => $rview_times2, 'newhand' => $newhand, + 'mid_aut_status' => $mid_aut_status, + 'mid_aut_adtimes' => $row['mid_aut_adtimes'] + 1 )); } diff --git a/webapp/controller/RoleController.class.php b/webapp/controller/RoleController.class.php index ce47d77..7a219d2 100644 --- a/webapp/controller/RoleController.class.php +++ b/webapp/controller/RoleController.class.php @@ -115,9 +115,9 @@ class RoleController{ ':accountid' => $account_id )); 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, chapingcount, aderrormaxcount, share_video_times, daily_skin_times, share_equip_times, daily_diamond_times, newhand, game_times2, view_times2) ' . - ' 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, 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, chapingcount=0, aderrormaxcount=0, share_video_times=0, daily_skin_times=0, share_equip_times=0, daily_diamond_times=0, newhand=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, chapingcount, aderrormaxcount, share_video_times, daily_skin_times, share_equip_times, daily_diamond_times, newhand, game_times2, view_times2, daily_ad_times, mid_aut_adtimes, mid_aut_status, daily_draw_status, daily_box_times, daily_box_status, daily_box2_status) ' . + ' 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, 0, 0, 0, 0, 0, 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, chapingcount=0, aderrormaxcount=0, share_video_times=0, daily_skin_times=0, share_equip_times=0, daily_diamond_times=0, newhand=0, game_times2=0, view_times2=0, daily_ad_times=0, mid_aut_adtimes=0, mid_aut_status=0, daily_draw_status=0, daily_box_times=0, daily_box_status=0, daily_box2_status=0;', array( ':accountid' => $account_id, ':user_name' => $user_name, @@ -165,6 +165,13 @@ class RoleController{ 'newhand' => 0, 'game_times2' => 0, 'view_times2' => 0, + 'daily_ad_times' => 0, + 'mid_aut_adtimes' => 0, + 'mid_aut_status' => 0, + 'daily_draw_status' => 0, + 'daily_box_times' => 0, + 'daily_box_status' => 0, + 'daily_box2_status' => 0, )); } else { $ret = $conn->execScript('UPDATE user SET first_login=1 ' . @@ -205,9 +212,14 @@ class RoleController{ $box_num = $row['box_num']; $share_equip_times = $row['share_equip_times']; $daily_diamond_times = $row['daily_diamond_times']; + $daily_ad_times = $row['daily_ad_times']; + $daily_draw_status = $row['daily_draw_status']; + $daily_box_times = $row['daily_box_times']; + $daily_box_status = $row['daily_box_status']; + $daily_box2_status = $row['daily_box2_status']; if ($row['daily_time'] == 0 || ($nowTime - phpcommon\getdayseconds($row['daily_time']) > 0)) { $ret = $conn->execScript('UPDATE user SET daily_first_login=0, share_video_times=0, daily_skin_times=0, box_num=0, daily_time=:daily_time, share_equip_times=0, daily_diamond_times=0,' . - 'modify_time=:modify_time WHERE accountid=:accountid;', + 'modify_time=:modify_time, daily_ad_times=0, daily_draw_status=0, daily_box_times=0, daily_box_status=0, daily_box2_status=0 WHERE accountid=:accountid;', array( ':accountid' => $account_id, ':modify_time' => time(), @@ -223,10 +235,17 @@ class RoleController{ $box_num = 0; $share_equip_times = 0; $daily_diamond_times = 0; + $daily_ad_times = 0; + $daily_draw_status = 0; + $daily_box_times = 0; + $daily_box_status = 0; + $daily_box2_status = 0; } //更新新手礼 $newhand = $this->getnewhandinfo($row['newhand'], $row['game_times2'], $row['view_times2'], $account_id); + //更新中秋活动礼 + $mid_aut_status = $this->getmidautinfo($row['mid_aut_status'], $row['mid_aut_adtimes'], $account_id); echo json_encode(array( 'errcode' => 0, 'errmsg' => '', @@ -265,6 +284,13 @@ class RoleController{ 'newhand' => $newhand, 'game_times2' => $row['game_times2'], 'view_times2' => $row['view_times2'], + 'daily_ad_times' => $daily_ad_times, + 'mid_aut_adtimes' => $row['mid_aut_adtimes'], + 'mid_aut_status' => $row['mid_aut_status'], + 'daily_draw_status' => $daily_draw_status, + 'daily_box_times' => $daily_box_times, + 'daily_box_status' => $daily_box_status, + 'daily_box2_status' => $daily_box2_status, )); } } @@ -291,6 +317,26 @@ class RoleController{ return $status; } + protected function getmidautinfo($status, $num, $account_id) + { + $p3 = $this->getParameter(ZIJIE_ACTIVITY2_ADS); + $fight_times2 = $p3['param_value']; + $conn = $this->getMysql($account_id); + if ($num >= $fight_times2 && $status == 0) { + $ret = $conn->execScript('UPDATE user SET mid_aut_status=1, ' . + 'modify_time=:modify_time WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':modify_time' => time(), + )); + if (!$ret) { + die(); + } + return 1; + } + return $status; + } + protected function updateDaily($account_id, $daily_time) { $nowTime = phpcommon\getdayseconds(time()); diff --git a/webapp/controller/ShareController.class.php b/webapp/controller/ShareController.class.php index 953122c..45c141d 100644 --- a/webapp/controller/ShareController.class.php +++ b/webapp/controller/ShareController.class.php @@ -227,14 +227,68 @@ class ShareController{ $addreward = new classes\AddReward(); $addreward->addReward($item['item_id'], $item['item_num'], $account_id); } + + //更新每日抽奖宝箱活动状态 + $boxtimes = $this->getboxtimes($account_id); + if ($boxtimes == -1) { + phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家'); + return; + } + $row = $conn->execQueryOne('SELECT daily_box_status, daily_box2_status FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id + )); + echo json_encode(array( 'errcode' => 0, 'errmsg' => '', 'item_list' => $item_list, 'diamond_nums' => $num, + 'times' => $boxtimes, + 'status1' => $row['daily_box_status'], + 'status2' => $row['daily_box2_status'], )); } + protected function getboxtimes($account_id) + { + $p1 = $this->getParameter(ZIJIE_LINEBOX_TIMES); + $delim = "|"; + $drop_multiply = explode($delim, $p1['param_value']); + $times1 = $drop_multiply[0]; + $times2 = $drop_multiply[1]; + $conn = $this->getMysql($account_id); + $row = $conn->execQueryOne('SELECT daily_box_times, daily_box_status, daily_box2_status FROM user WHERE accountid=:accountid;', + array( + ':accountid' => $account_id + )); + if (!$row) { + return -1; + } + $daily_box_times = $row['daily_box_times'] + 1; + $status1 = $row['daily_box_status']; + $status2 = $row['daily_box2_status']; + if ($daily_box_times >= $times1 && $status1 == 0) { + $status1 = 1; + } + if ($daily_box_times >= $times2 && $status2 == 0) { + $status2 = 1; + } + $ret = $conn->execScript('UPDATE user SET daily_box_status=:daily_box_status, daily_box2_status=:daily_box2_status, daily_box_times=:daily_box_times, ' . + 'modify_time=:modify_time WHERE accountid=:accountid;', + array( + ':accountid' => $account_id, + ':modify_time' => time(), + ':daily_box_times' => $daily_box_times, + ':daily_box_status' => $status1, + ':daily_box2_status' => $status2, + )); + if (!$ret) { + die(); + } + return $daily_box_times; + } + public function keyBoxDoubleReward() { $account_id = $_REQUEST['account_id']; diff --git a/webapp/controller/SkinController.class.php b/webapp/controller/SkinController.class.php index 6a7128c..67bbb79 100644 --- a/webapp/controller/SkinController.class.php +++ b/webapp/controller/SkinController.class.php @@ -1,5 +1,5 @@ '', )); } + + public function getFreeSkin() + { + $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, '没有这个玩家'); + return; + } + $skin_id = $_REQUEST['skin_id']; + $s = $this->getSkin($skin_id); + if (!$s['skin_id']) { + phpcommon\sendError(ERR_USER_BASE + 3, '没有这个皮肤'); + return; + } + $item_list = array(); + array_push($item_list, array( + 'item_id' => $skin_id, + 'item_num' => 1, + )); + $addreward = new classes\AddReward(); + $item_list = $addreward->addReward($skin_id, 1, $account_id); + $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, + )); + } } ?>