1
This commit is contained in:
parent
4ebbb35763
commit
8d220716db
@ -102,6 +102,9 @@ 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看视频次数',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `accountid` (`accountid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
8
sql/gamedb2004_n_migrate_210119_01.sql
Normal file
8
sql/gamedb2004_n_migrate_210119_01.sql
Normal file
@ -0,0 +1,8 @@
|
||||
begin;
|
||||
|
||||
alter table user add column `blobdata` mediumblob NOT NULL DEFAULT '' COMMENT 'cpa数据json';
|
||||
alter table user add column `cpa_times` int(11) NOT NULL DEFAULT '0' COMMENT 'cpa看视频次数';
|
||||
|
||||
insert into version (version) values(20210119);
|
||||
|
||||
commit;
|
@ -123,12 +123,14 @@ class FesActivityController{
|
||||
$this->getfesActInfo($account_id);
|
||||
$user_db = $this->readFesActDB($account_id);
|
||||
//metatable\getRewardInfo(1,1,1);
|
||||
$act = metatable\getNowActivity();
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
'isopen' => $user_db['isopen'],
|
||||
'id' => $user_db['act_id'],
|
||||
'info_list' => $user_db['info_list'],
|
||||
'act' => $act,
|
||||
));
|
||||
}
|
||||
|
||||
@ -396,19 +398,35 @@ class FesActivityController{
|
||||
//假日活动信息
|
||||
$this->getHolidayInfo($account_id);
|
||||
$user_db = $this->readHolidayDB($account_id);
|
||||
$quest_list = $user_db['quest_list'];
|
||||
$exc_list = $user_db['exchange_list'];
|
||||
foreach ($quest_list as &$q) {
|
||||
if ($q['id']) {
|
||||
$act = metatable\getActPlusById($q['id']);
|
||||
if ($act) {
|
||||
$q['act'] = $act;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach ($exc_list as &$e) {
|
||||
if ($e['id']) {
|
||||
$act = metatable\getActPlusById($e['id']);
|
||||
if ($act) {
|
||||
$e['act'] = $act;
|
||||
}
|
||||
}
|
||||
}
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
'quest_list' => $user_db['quest_list'],
|
||||
'exchange_list' => $user_db['exchange_list'],
|
||||
'quest_list' => $quest_list,
|
||||
'exchange_list' => $exc_list,
|
||||
));
|
||||
}
|
||||
|
||||
protected function getHolidayInfo($account_id)
|
||||
{
|
||||
$user_db = $this->readHolidayDB($account_id);
|
||||
//$quest_list = $this->getActQuestInfo(3, array(), $account_id);
|
||||
//$exchange_list = $this->getActExchangeInfo(9, array(), $account_id);
|
||||
$quest_list = $this->getActQuestInfo(3, $user_db['quest_list'], $account_id);
|
||||
$exchange_list = $this->getActExchangeInfo(9, $user_db['exchange_list'], $account_id);
|
||||
$hol_db = array(
|
||||
@ -418,9 +436,8 @@ class FesActivityController{
|
||||
$this->saveHolidayDB($account_id, $hol_db);
|
||||
}
|
||||
|
||||
protected function insertQuestInfo($act, $id, $num, $account_id)
|
||||
protected function insertQuestInfo($act, $id, $num, $account_id, $info_list)
|
||||
{
|
||||
$info_list = array();
|
||||
$reward = array();
|
||||
$quest_list = $this->actQuestList($act['condition'], $account_id);
|
||||
$reward = $this->actQuestRewardList($act['reward']);
|
||||
@ -430,7 +447,7 @@ class FesActivityController{
|
||||
'quest_list' => $quest_list,
|
||||
'reward' => $reward,
|
||||
'time' => time(),
|
||||
'act' => $act,
|
||||
'act' => array(),
|
||||
));
|
||||
return $info_list;
|
||||
}
|
||||
@ -441,17 +458,16 @@ class FesActivityController{
|
||||
$temp_list = array();
|
||||
$quest_list = $this->actQuestList($act['condition'], $account_id);
|
||||
$reward = $this->actQuestRewardList($act['reward']);
|
||||
//$info_list[$num] = $temp_list;
|
||||
array_push($temp_list, array(
|
||||
$temp_list = array(
|
||||
'id' => $id,
|
||||
'idx' => $num,
|
||||
'quest_list' => $quest_list,
|
||||
'reward' => $reward,
|
||||
'time' => time(),
|
||||
'act' => $act,
|
||||
));
|
||||
$info_list = $temp_list;
|
||||
return $info_list;
|
||||
'act' => array(),
|
||||
);
|
||||
//$info_list = $temp_list;
|
||||
return $temp_list;
|
||||
}
|
||||
|
||||
|
||||
@ -514,7 +530,7 @@ class FesActivityController{
|
||||
$num++;
|
||||
continue;
|
||||
}
|
||||
$info_list = $this->insertQuestInfo($act, $i['id'], $num, $account_id);
|
||||
$info_list = $this->insertQuestInfo($act, $i['id'], $num, $account_id, $info_list);
|
||||
$num++;
|
||||
}
|
||||
} else {
|
||||
@ -529,7 +545,7 @@ class FesActivityController{
|
||||
}
|
||||
} else {
|
||||
if (empty($info_list[$num]) || !$info_list[$num]) {
|
||||
$info_list = $this->updateQuestInfo($act, $info_list, $i['id'], $num, $account_id);
|
||||
$info_list[$num] = $this->updateQuestInfo($act, $info_list, $i['id'], $num, $account_id);
|
||||
} else {
|
||||
if (phpcommon\getdayseconds(time()) - phpcommon\getdayseconds($info_list[$num]['time']) > 0) {
|
||||
if ($act['isreset'] == 1) {
|
||||
@ -569,9 +585,8 @@ class FesActivityController{
|
||||
return $exc_list;
|
||||
}
|
||||
|
||||
protected function insertExchangeInfo($act, $id, $num)
|
||||
protected function insertExchangeInfo($act, $id, $num, $info_list)
|
||||
{
|
||||
$info_list = array();
|
||||
$exc_list = $this->actExchangeList($act['condition']);
|
||||
$reward = $this->actExchangeRewardList($act['reward']);
|
||||
$times_list = explode('|', $act['exchange_times']);
|
||||
@ -581,7 +596,7 @@ class FesActivityController{
|
||||
'exc_list' => $exc_list,
|
||||
'reward' => $reward,
|
||||
'time' => time(),
|
||||
'act' => $act,
|
||||
'act' => array(),
|
||||
'times_list' => $times_list,
|
||||
));
|
||||
return $info_list;
|
||||
@ -593,17 +608,16 @@ class FesActivityController{
|
||||
$exc_list = $this->actExchangeList($act['condition']);
|
||||
$reward = $this->actExchangeRewardList($act['reward']);
|
||||
$times_list = explode('|', $act['exchange_times']);
|
||||
array_push($temp_list, array(
|
||||
$temp_list = array(
|
||||
'id' => $id,
|
||||
'idx' => $num,
|
||||
'exc_list' => $exc_list,
|
||||
'reward' => $reward,
|
||||
'time' => time(),
|
||||
'act' => $act,
|
||||
'act' => array(),
|
||||
'times_list' => $times_list,
|
||||
));
|
||||
$info_list = $temp_list;
|
||||
return $info_list;
|
||||
);
|
||||
return $temp_list;
|
||||
}
|
||||
|
||||
public function getActExchangeInfo($type, $info_list, $account_id)
|
||||
@ -622,7 +636,7 @@ class FesActivityController{
|
||||
$num++;
|
||||
continue;
|
||||
}
|
||||
$info_list = $this->insertExchangeInfo($act, $i['id'], $num);
|
||||
$info_list = $this->insertExchangeInfo($act, $i['id'], $num, $info_list);
|
||||
$num++;
|
||||
}
|
||||
} else {
|
||||
@ -637,7 +651,7 @@ class FesActivityController{
|
||||
}
|
||||
} else {
|
||||
if (empty($info_list[$num]) || !$info_list[$num]) {
|
||||
$info_list = $this->updateExchangeInfo($act, $info_list, $i['id'], $num);
|
||||
$info_list[$num] = $this->updateExchangeInfo($act, $info_list, $i['id'], $num);
|
||||
}
|
||||
}
|
||||
$num++;
|
||||
|
@ -717,7 +717,7 @@ class PayController{
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$row = $conn->execQueryOne('SELECT vip_score, shop_view_times, game_times, newhand, newhand2, view_times2, act_ad_status, game_times2, first_day_ad FROM user WHERE accountid=:accountid;',
|
||||
$row = $conn->execQueryOne('SELECT vip_score, shop_view_times, game_times, newhand, newhand2, view_times2, act_ad_status, game_times2, first_day_ad, cpa_times, blobdata FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
));
|
||||
@ -749,7 +749,23 @@ class PayController{
|
||||
if ($row['vip_score'] + 1 >= 5 && $row['act_ad_status'] < 1){
|
||||
$status = 1;
|
||||
}
|
||||
$ret = $conn->execScript('UPDATE user SET vip_score=:vip_score, shop_view_times=:shop_view_times, modify_time=:modify_time, newhand=:newhand, act_ad_status=:act_ad_status, newhand2=:newhand2, view_times2=:view_times2, first_day_ad=:first_day_ad ' .
|
||||
$cpa_db = json_decode($row['blobdata'], true);
|
||||
if (!is_array($cpa_db)) {
|
||||
$cpa_db = array();
|
||||
array_push($cpa_db, array(
|
||||
'cpatime' => time(),
|
||||
'isview' => true,
|
||||
));
|
||||
} else {
|
||||
foreach ($cpa_db as &$c) {
|
||||
if (phpcommon\getdayseconds(time()) - phpcommon\getdayseconds($c['cpatime']) == 0) {
|
||||
$c['isview'] = true;
|
||||
//break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$blobdata = json_encode($cpa_db);
|
||||
$ret = $conn->execScript('UPDATE user SET vip_score=:vip_score, shop_view_times=:shop_view_times, modify_time=:modify_time, newhand=:newhand, act_ad_status=:act_ad_status, newhand2=:newhand2, view_times2=:view_times2, first_day_ad=:first_day_ad, cpa_times=:cpa_times, blobdata=:blobdata ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
@ -760,7 +776,9 @@ class PayController{
|
||||
':shop_view_times' => $row['shop_view_times'] + 1,
|
||||
':newhand2' => $newhand2,
|
||||
':view_times2' => $rview_times2,
|
||||
':first_day_ad' => $row['first_day_ad'] + 1
|
||||
':first_day_ad' => $row['first_day_ad'] + 1,
|
||||
':cpa_times' => $row['cpa_times'] + 1,
|
||||
':blobdata' => $blobdata,
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
require 'classes/Quest.php';
|
||||
require 'classes/AddReward.php';
|
||||
|
||||
require_once 'metatable/parameter.php';
|
||||
class RoleController{
|
||||
|
||||
protected function getMysql($account_id)
|
||||
@ -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) ' .
|
||||
' 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;',
|
||||
$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;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':user_name' => $user_name,
|
||||
@ -211,7 +211,8 @@ class RoleController{
|
||||
':daily_time' => 0,
|
||||
':update_time' => time(),
|
||||
':newInfo' => '',
|
||||
':season_time' => $season_time
|
||||
':season_time' => $season_time,
|
||||
':blobdata' => '',
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
@ -273,6 +274,8 @@ class RoleController{
|
||||
'view_times2'=>0,
|
||||
'guildcoin_num' => 0,
|
||||
'new_second_equip' => 2,
|
||||
'blobdata' => '',
|
||||
'cpa_times' => 0,
|
||||
));
|
||||
} else {
|
||||
if ($avatar_url != '') {
|
||||
@ -303,6 +306,11 @@ class RoleController{
|
||||
$share_video_times = $row['share_video_times'];
|
||||
$act_ad_status = $row['act_ad_status'];
|
||||
$new_second_equip = $row['new_second_equip'];
|
||||
$blobdata = $row['blobdata'];
|
||||
$cpa_times = $row['cpa_times'];
|
||||
if (!$blobdata) {
|
||||
$blobdata = '';
|
||||
}
|
||||
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;',
|
||||
@ -319,12 +327,17 @@ class RoleController{
|
||||
if ($new_second_equip == 2 && $row['new_first_equip'] == 1) {
|
||||
$new_second_equip = 0;
|
||||
}
|
||||
$cpa_list = $this->getCpa($row['blobdata'], $cpa_times);
|
||||
$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 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 WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':modify_time' => time(),
|
||||
':new_second_equip' => $new_second_equip,
|
||||
':blobdata' => $blobdata,
|
||||
':cpa_times' => $cpa_times,
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
@ -397,10 +410,54 @@ class RoleController{
|
||||
'view_times2'=>$row['view_times2'],
|
||||
'guildcoin_num'=> $row['guildcoin_num'],
|
||||
'new_second_equip' => $new_second_equip,
|
||||
'login_day' => floor(($nowTime - phpcommon\getdayseconds($row['create_time'])) / 3600 / 24),
|
||||
'blobdata' => $blobdata,
|
||||
'cpa_times' => $cpa_times,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
protected function getCpa($cpastr, $cpa_times)
|
||||
{
|
||||
$cpa_db = json_decode($cpastr, true);
|
||||
if (!is_array($cpa_db)) {
|
||||
$cpa_db = array();
|
||||
}
|
||||
if (count($cpa_db) < metatable\getParameterByName('showcpa_noad_day')) {
|
||||
array_push($cpa_db, array(
|
||||
'cpatime' => time(),
|
||||
'isview' => false,
|
||||
));
|
||||
} else {
|
||||
$flag = false;
|
||||
foreach ($cpa_db as $c) {
|
||||
if ($c['isview']) {
|
||||
$flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$flag) {
|
||||
$cpa_db = array();
|
||||
$cpa_times = 0;
|
||||
array_push($cpa_db, array(
|
||||
'cpatime' => time(),
|
||||
'isview' => false,
|
||||
));
|
||||
} else {
|
||||
array_splice($cpa_db, 0, 1);
|
||||
array_push($cpa_db, array(
|
||||
'cpatime' => time(),
|
||||
'isview' => false,
|
||||
));
|
||||
}
|
||||
}
|
||||
$cpa_list = array(
|
||||
'cpastr' => json_encode($cpa_db),
|
||||
'cpa_times' => $cpa_times,
|
||||
);
|
||||
return $cpa_list;
|
||||
}
|
||||
|
||||
protected function newPlayerReward($account_id)
|
||||
{
|
||||
$conn = $this->getMysql($account_id);
|
||||
@ -677,7 +734,6 @@ class RoleController{
|
||||
$quest->triggerQuest(QUEST_DAY_ALIVE, 1, (int)($alive_time / 1000 / 60), $account_id);
|
||||
$quest->triggerQuest(QUEST_DAY_HARM, 1, $harm, $account_id);
|
||||
$quest->triggerQuest(QUEST_DAY_KILL, 1, $kills, $account_id);
|
||||
|
||||
$quest->flushHolidayQuest(72003, 1, $account_id);
|
||||
$quest->flushHolidayQuest(72006, $harm, $account_id);
|
||||
$quest->flushHolidayQuest(72007, $kills, $account_id);
|
||||
|
Loading…
x
Reference in New Issue
Block a user