1
This commit is contained in:
parent
ba05e4cf08
commit
bf38c34c4f
@ -82,6 +82,9 @@ CREATE TABLE `user` (
|
||||
`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 '免费十倍抽奖券',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `accountid` (`accountid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
@ -215,4 +218,21 @@ CREATE TABLE `shop` (
|
||||
UNIQUE KEY `accountid` (`accountid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS `additem_log`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `additem_log` (
|
||||
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`accountid` varchar(60) DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
|
||||
`add_id` varchar(60) DEFAULT '' COMMENT '道具id',
|
||||
`add_time` int(11) NOT NULL DEFAULT '0' COMMENT '添加时间',
|
||||
`add_num` int(11) NOT NULL DEFAULT '0' COMMENT '道具数量',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `account_add_id_add_time` (`accountid`, `add_id` , `add_time`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
||||
|
||||
-- Dump completed on 2015-08-19 18:51:22
|
||||
|
11
sql/gamedb2004_n_migrate_200426_01.sql
Normal file
11
sql/gamedb2004_n_migrate_200426_01.sql
Normal file
@ -0,0 +1,11 @@
|
||||
begin;
|
||||
|
||||
alter table user add column `free_lot_ticket` int(11) NOT NULL DEFAULT '0' COMMENT '免费抽奖券';
|
||||
alter table user add column `free_dou_lot_ticket` int(11) NOT NULL DEFAULT '0' COMMENT '免费十倍抽奖券';
|
||||
UPDATE user set sign_sum=7 WHERE sign_sum >= 7;
|
||||
UPDATE actitity set free_times=0, video_times=0;
|
||||
|
||||
|
||||
insert into version (version) values(20200426);
|
||||
|
||||
commit;
|
@ -81,6 +81,10 @@ class AddReward {
|
||||
$this->addCoin($item['item_id'], $item['item_num'], $account_id);
|
||||
} else if ($i['type'] == 2) {
|
||||
$this->addDiamond($item['item_id'], $item['item_num'], $account_id);
|
||||
} else if ($i['type'] == 8){
|
||||
$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 {
|
||||
$price = $i['diamond'];
|
||||
if ($time != 0) {
|
||||
@ -171,6 +175,52 @@ class AddReward {
|
||||
}
|
||||
}
|
||||
|
||||
protected function addticket($item_id, $item_num, $accountid)
|
||||
{
|
||||
$conn = $this->getMysql($accountid);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$row = $conn->execQueryOne('SELECT free_lot_ticket FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid
|
||||
));
|
||||
$ret = $conn->execScript('UPDATE user SET free_lot_ticket=:free_lot_ticket, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
':free_lot_ticket' => $item_num + $row['free_lot_ticket'],
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
protected function addtenticket($item_id, $item_num, $accountid)
|
||||
{
|
||||
$conn = $this->getMysql($accountid);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
||||
die();
|
||||
}
|
||||
$row = $conn->execQueryOne('SELECT free_dou_lot_ticket FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid
|
||||
));
|
||||
$ret = $conn->execScript('UPDATE user SET free_dou_lot_ticket=:free_dou_lot_ticket, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $accountid,
|
||||
':free_dou_lot_ticket' => $item_num + $row['free_dou_lot_ticket'],
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
//添加道具
|
||||
protected function addItem($item_id, $time, $accountid, $price, $t)
|
||||
{
|
||||
|
@ -247,7 +247,7 @@ class ActivityController{
|
||||
return;
|
||||
}
|
||||
|
||||
$draw_uuid = 'game2004api_draw_uuid:' . md5($_REQUEST['account_id']);
|
||||
$draw_uuid = 'game2004api_lot_uuid:' . md5($_REQUEST['account_id']);
|
||||
$draw_list = array();
|
||||
$r = $this->getRedis($draw_uuid);
|
||||
if (!$r) {
|
||||
@ -299,8 +299,11 @@ class ActivityController{
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
|
||||
if (phpcommon\getdayseconds(time()) - phpcommon\getdayseconds($rowTime['modify_time']) > 0) {
|
||||
$user_db_str = $r->get($draw_uuid);
|
||||
$draw_list = $this->randomReward(1);
|
||||
$draw_db = json_decode($user_db_str, true);
|
||||
$draw_db = array(
|
||||
'draw_uuid' => $draw_uuid,
|
||||
'draw_list' => $draw_list,
|
||||
@ -308,22 +311,28 @@ class ActivityController{
|
||||
$r -> set($draw_uuid, json_encode($draw_db));
|
||||
$r -> pexpire($draw_uuid, 1000 * 3600 * 24);
|
||||
} else {
|
||||
$user_db_str = $r->get($draw_uuid);
|
||||
$user_db = json_decode($user_db_str, true);
|
||||
if (empty($user_db)) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 1,'session失效');
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($user_db['draw_list'] as $draw) {
|
||||
$status = 0;
|
||||
if (isset($draw['status'])) {
|
||||
$status = $draw['status'];
|
||||
}
|
||||
array_push($draw_list, array(
|
||||
'item_id' => $draw['item_id'],
|
||||
'item_num' => $draw['item_num'],
|
||||
'quailty' => $draw['quailty'],
|
||||
'time' => $draw['time'],
|
||||
'status' => $status,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
@ -382,7 +391,6 @@ class ActivityController{
|
||||
phpcommon\sendError(ERR_USER_BASE + 1,'session失效');
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($user_db['drawtable_list'] as $draw) {
|
||||
if ($draw['key'] == $key - 1) {
|
||||
$item_id = $draw['item_id'];
|
||||
@ -454,25 +462,13 @@ class ActivityController{
|
||||
//随机确认奖励
|
||||
$weight_sum = 0;
|
||||
$g_conf_lot_cluster = require('../res/lottery@lottery.php');
|
||||
for ($i = 1; $i <= count($g_conf_lot_cluster); $i++) {
|
||||
$l = $this->getLottery($i);
|
||||
$weight_sum += $l['jilv'];
|
||||
}
|
||||
$random = Rand(0, $weight_sum);
|
||||
$weight = 0;
|
||||
$key = 0;
|
||||
for ($ii = 1; $ii <= count($g_conf_lot_cluster); $ii++) {
|
||||
$l = $this->getLottery($ii);
|
||||
$weight += $l['jilv'];
|
||||
if ($weight > $random) {
|
||||
$key = $ii;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$lot_array = array();
|
||||
$draw_uuid = $_REQUEST['draw_uuid'];
|
||||
$item_id = 0;
|
||||
$item_num = 0;
|
||||
$flag = 0;
|
||||
$weight = 0;
|
||||
$key = 0;
|
||||
$r = $this->getRedis($draw_uuid);
|
||||
$user_db_str = $r->get($draw_uuid);
|
||||
if (empty($user_db_str)) {
|
||||
@ -484,20 +480,102 @@ class ActivityController{
|
||||
phpcommon\sendError(ERR_USER_BASE + 1,'session失效');
|
||||
return;
|
||||
}
|
||||
|
||||
if ($row['free_times'] + $row['video_times'] + 1 == 6) {
|
||||
$g_conf_lot_cluster = require('../res/lottery@lottery.php');
|
||||
for($g = 1; $g <= count($g_conf_lot_cluster); $g++) {
|
||||
$l = $this->getLottery($g);
|
||||
if ($l['jilv'] == 0) {
|
||||
array_push($lot_array, array(
|
||||
'key' => $g
|
||||
));
|
||||
}
|
||||
}
|
||||
for ($i1 = 0; $i1 < count($lot_array); $i1++) {
|
||||
$l = $this->getLottery($lot_array[$i1]['key']);
|
||||
$weight_sum += $l['jilv'];
|
||||
}
|
||||
$random = Rand(0, 100);
|
||||
if ($random >= 50) {
|
||||
$key = $lot_array[0]['key'];
|
||||
} else {
|
||||
$key = $lot_array[1]['key'];
|
||||
}
|
||||
} else if ($row['free_times'] + $row['video_times'] + 1 == 10) {
|
||||
foreach ($user_db['draw_list'] as $draw) {
|
||||
if ($draw['key'] == $key - 1) {
|
||||
if (isset($draw['status']) && $draw['status'] != 0) {
|
||||
continue;
|
||||
}
|
||||
$key = $draw['key'] + 1;
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
foreach ($user_db['draw_list'] as $draw) {
|
||||
if (isset($draw['status']) && $draw['status'] != 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
array_push($lot_array,array(
|
||||
'key' => $draw['key'] + 1,
|
||||
));
|
||||
}
|
||||
|
||||
for ($i = 0; $i < count($lot_array); $i++) {
|
||||
$l = $this->getLottery($lot_array[$i]['key']);
|
||||
|
||||
$weight_sum += $l['jilv'];
|
||||
}
|
||||
$random = Rand(1, $weight_sum);
|
||||
error_log($random);
|
||||
for ($ii = 0; $ii < count($lot_array); $ii++) {
|
||||
$l = $this->getLottery($lot_array[$ii]['key']);
|
||||
$weight += $l['jilv'];
|
||||
|
||||
if ($weight >= $random) {
|
||||
$key = $lot_array[$ii]['key'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($user_db['draw_list'] as &$draw) {
|
||||
if ($draw['key'] + 1 == $key) {
|
||||
$item_id = $draw['item_id'];
|
||||
$item_num = $draw['item_num'];
|
||||
$time = $draw['time'];
|
||||
$flag = 1;
|
||||
$status = 1;
|
||||
if (isset($draw['status'])) {
|
||||
$draw['status'] = 1;
|
||||
} else {
|
||||
array_push($draw, array(
|
||||
'status' => 1,
|
||||
));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$r->set($draw_uuid, json_encode($user_db));
|
||||
$r -> pexpire($draw_uuid, 1000 * 3600 * 24);
|
||||
if ($flag == 0) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个物品');
|
||||
return;
|
||||
}
|
||||
|
||||
//增加奖励
|
||||
$addreward = new classes\AddReward();
|
||||
$all_item_list = $addreward->addReward($item_id, $item_num, $account_id, $time, 0);
|
||||
$coin_num = $addreward->getCoinNum($account_id);
|
||||
$diamond_num = $addreward->getDiamondNum($account_id);
|
||||
$item_list = array();
|
||||
array_push($item_list,array(
|
||||
'item_id' => $item_id,
|
||||
'item_num' => $item_num,
|
||||
'time' => $time
|
||||
));
|
||||
|
||||
if ($_REQUEST['type'] == 0) {
|
||||
$p_flush = $this->getParameter(FREELOTTERY_TIME);
|
||||
if ($p_flush['value'] <= $row['free_times']) {
|
||||
@ -538,17 +616,7 @@ class ActivityController{
|
||||
return;
|
||||
}
|
||||
}
|
||||
//增加奖励
|
||||
$addreward = new classes\AddReward();
|
||||
$all_item_list = $addreward->addReward($item_id, $item_num, $account_id, $time, 0);
|
||||
$coin_num = $addreward->getCoinNum($account_id);
|
||||
$diamond_num = $addreward->getDiamondNum($account_id);
|
||||
$item_list = array();
|
||||
array_push($item_list,array(
|
||||
'item_id' => $item_id,
|
||||
'item_num' => $item_num,
|
||||
'time' => $time
|
||||
));
|
||||
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
@ -557,7 +625,8 @@ class ActivityController{
|
||||
'coin_nums' => $coin_num,
|
||||
'diamond_nums' => $diamond_num,
|
||||
'item_list' => $item_list,
|
||||
'all_item_list' => $all_item_list
|
||||
'all_item_list' => $all_item_list,
|
||||
'status' => $status
|
||||
));
|
||||
}
|
||||
|
||||
@ -645,6 +714,7 @@ class ActivityController{
|
||||
'item_num' => $item_num,
|
||||
'quailty' => $quailty,
|
||||
'time' => $time,
|
||||
'status' => 0,
|
||||
));
|
||||
}
|
||||
return $draw_list;
|
||||
|
@ -81,7 +81,7 @@ class AdditemController{
|
||||
));
|
||||
$status = 1;
|
||||
$active_time = 0;
|
||||
if (!$row && $item_id != 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;',
|
||||
@ -98,6 +98,7 @@ class AdditemController{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//添加钻石
|
||||
|
@ -116,9 +116,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, update_time, season_games, season_win, sea_max_kill, sea_max_hart, sea_avg_kill) ' .
|
||||
' 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) ' .
|
||||
' 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;',
|
||||
$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) ' .
|
||||
' 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) ' .
|
||||
' 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;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':user_name' => $user_name,
|
||||
@ -162,7 +162,9 @@ class RoleController{
|
||||
'season_win' => 0,
|
||||
'sea_max_kill' => 0,
|
||||
'sea_max_hart' => 0,
|
||||
'sea_avg_kill' => 0
|
||||
'sea_avg_kill' => 0,
|
||||
'free_lot_ticket' => 0,
|
||||
'free_dou_lot_ticket' => 0
|
||||
));
|
||||
} else {
|
||||
$ret = $conn->execScript('UPDATE user SET first_login=1 ' .
|
||||
@ -242,7 +244,9 @@ class RoleController{
|
||||
'season_win' => $row['season_win'],
|
||||
'sea_max_kill' => $row['sea_max_kill'],
|
||||
'sea_max_hart' => $row['sea_max_hart'],
|
||||
'sea_avg_kill' => $row['sea_avg_kill']
|
||||
'sea_avg_kill' => $row['sea_avg_kill'],
|
||||
'free_dou_lot_ticket' => $row['free_dou_lot_ticket'],
|
||||
'free_lot_ticket' => $row['free_lot_ticket'],
|
||||
));
|
||||
}
|
||||
}
|
||||
@ -757,5 +761,37 @@ class RoleController{
|
||||
'coin_nums' => $coin_num,
|
||||
));
|
||||
}
|
||||
|
||||
public function getSessionId()
|
||||
{
|
||||
$account_id = $_REQUEST['account_id'];
|
||||
$registertime = $_REQUEST['registertime'];
|
||||
$session_key = $_REQUEST['session_key'];
|
||||
$session_id = $this->createSessionId($account_id, $registertime, $session_key);
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
'session_id' => $session_id,
|
||||
));
|
||||
}
|
||||
|
||||
protected function createSessionId($accountid, $registertime, $session_key)
|
||||
{
|
||||
$nowtime = time();
|
||||
error_log($accountid . 'f3a6a9a5-217a-4079-ab99-b5d69b8212be' . $registertime . $nowtime);
|
||||
$session_id = $nowtime
|
||||
. '_'
|
||||
. $registertime
|
||||
. '_'
|
||||
. md5($accountid . 'f3a6a9a5-217a-4079-ab99-b5d69b8212be' . $registertime . $nowtime)
|
||||
. '_'
|
||||
. md5('f3a6a9a5-217a-4079-ab99-b5d69b8212be'
|
||||
. $accountid
|
||||
. $session_key
|
||||
. time()
|
||||
. rand()
|
||||
);
|
||||
return $session_id;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -182,18 +182,30 @@ class ShareController{
|
||||
$free = $_REQUEST['free'];
|
||||
$drop_id = 0;
|
||||
//随机奖励
|
||||
$row = $conn->execQueryOne('SELECT free_lot_ticket, free_dou_lot_ticket, free_box FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
$item_list = array();
|
||||
$diamond_num = 0;
|
||||
if ($free != 0) {
|
||||
if ($row['free_dou_lot_ticket'] <= 0) {
|
||||
$p = $this->getParameter(DIAMONDBOX10);
|
||||
$diamond_num = $p['param_value'];
|
||||
} else {
|
||||
$ret = $conn->execScript('UPDATE user SET free_dou_lot_ticket=:free_dou_lot_ticket, ' .
|
||||
'modify_time=:modify_time WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':modify_time' => time(),
|
||||
':free_dou_lot_ticket' => $row['free_dou_lot_ticket'] - 1,
|
||||
));
|
||||
}
|
||||
$item_list = $this->randBoxReward(2, 10);
|
||||
} else {
|
||||
$diamond_num = 0;
|
||||
$item_list = $this->randBoxReward(1, 1);
|
||||
$row = $conn->execQueryOne('SELECT free_box FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
if ($row['free_lot_ticket'] <= 0) {
|
||||
if ($row['free_box'] >= 5) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '今日免费次数已达上限');
|
||||
die();
|
||||
@ -206,6 +218,15 @@ class ShareController{
|
||||
':modify_time' => time(),
|
||||
':free_box' => $row['free_box'] + 1,
|
||||
));
|
||||
} else {
|
||||
$ret = $conn->execScript('UPDATE user SET free_lot_ticket=:free_lot_ticket, ' .
|
||||
'modify_time=:modify_time WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':modify_time' => time(),
|
||||
':free_lot_ticket' => $row['free_lot_ticket'] - 1,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
$row = $conn->execQueryOne('SELECT diamond_num FROM user WHERE accountid=:accountid;',
|
||||
|
@ -107,7 +107,7 @@ class SignController{
|
||||
return;
|
||||
}
|
||||
|
||||
$rows = $conn->execQuery('SELECT sign_id, sign_time FROM sign WHERE accountid=:accountid;',
|
||||
$rows = $conn->execQuery('SELECT sign_id, sign_time, signable FROM sign WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
@ -123,11 +123,15 @@ class SignController{
|
||||
$quest->triggerQuest(QUEST_DAY_LOGIN, 1, 1, $account_id);
|
||||
} else {
|
||||
$last_sign_time = 0;
|
||||
$flag = 0;
|
||||
foreach ($rows as $row) {
|
||||
if ($row['sign_id'] > $last_sign_id) {
|
||||
$last_sign_time = $row['sign_time'];
|
||||
$last_sign_id = $row['sign_id'];
|
||||
}
|
||||
if ($row['signable'] != 1) {
|
||||
$flag = 1;
|
||||
}
|
||||
}
|
||||
$rowuser = $conn->execQueryOne('SELECT update_time FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
@ -143,11 +147,11 @@ class SignController{
|
||||
}
|
||||
if ($nowTime - phpcommon\getdayseconds($last_sign_time) > 0) {
|
||||
$passed_days = floor(($nowTime - phpcommon\getdayseconds($last_sign_time)) / (3600 * 24));
|
||||
if ($passed_days > 7 - $last_sign_id) {
|
||||
if ($passed_days > 7 - $last_sign_id && $flag == 0 && count($rows) >= 7) {
|
||||
//跨周时删除老数据
|
||||
$num = 0;
|
||||
$sum = 0;
|
||||
/*$ret = $conn->execScript('DELETE from sign WHERE accountid=:accountid;',
|
||||
$ret = $conn->execScript('DELETE from sign WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
));
|
||||
@ -155,28 +159,26 @@ class SignController{
|
||||
die();
|
||||
return;
|
||||
}
|
||||
if ($passed_days > 7) {
|
||||
$num = ($passed_days + $last_sign_id) % 7;
|
||||
} else {
|
||||
$num = $last_sign_id + $passed_days - 7;
|
||||
}
|
||||
if ($num == 0) {
|
||||
$sum = 7;
|
||||
} else {
|
||||
$sum = $num;
|
||||
}*/
|
||||
for ($i = $last_sign_id + 1; $i < 7 + 1; $i++) {
|
||||
//$last_sign_id = 1;
|
||||
//插入签到列表
|
||||
$this->insertSign($account_id, 1);
|
||||
//更新签到总天数
|
||||
$this->updateSignSum($account_id, 1);
|
||||
|
||||
} else if ($passed_days > 7 - $last_sign_id){
|
||||
for ($i = $last_sign_id + 1; $i < 8; $i++) {
|
||||
//插入补签列表
|
||||
$this->insertSign($account_id, $i);
|
||||
}
|
||||
} else {
|
||||
$this->updateSignSum($account_id, 7 - $last_sign_id);
|
||||
}else if ($passed_days <= 7 - $last_sign_id){
|
||||
for ($i = $last_sign_id + 1; $i < $passed_days + $last_sign_id + 1; $i++) {
|
||||
//插入补签列表
|
||||
$this->insertSign($account_id, $i);
|
||||
}
|
||||
}
|
||||
//更新签到总天数
|
||||
$this->updateSignSum($account_id, $passed_days);
|
||||
}
|
||||
//完成签到任务
|
||||
$quest = new classes\Quest();
|
||||
$quest->triggerQuest(QUEST_DAY_LOGIN, 1, 1, $account_id);
|
||||
@ -200,14 +202,15 @@ class SignController{
|
||||
));
|
||||
//判断当前第几周
|
||||
$item_list = array();
|
||||
/*$week = ceil($rowUser['sign_sum'] / 7);
|
||||
$week = ceil($rowUser['sign_sum'] / 7);
|
||||
$dayid = ($week - 1) * 7;
|
||||
//如果大于配置表最后一周,按最后一周奖励
|
||||
$g_conf_sign_cluster = require('../res/signDaily@signDaily.php');
|
||||
if ($dayid > count($g_conf_sign_cluster)) {
|
||||
if ($dayid + 1 > count($g_conf_sign_cluster)) {
|
||||
$dayid = count($g_conf_sign_cluster) - 7;
|
||||
}*/
|
||||
for ($day = 1; $day <= 7; $day++)
|
||||
}
|
||||
//error_log($dayid);
|
||||
for ($day = $dayid + 1; $day <= $dayid + 7; $day++)
|
||||
{
|
||||
$s = $this->getSign($day + 90000);
|
||||
array_push($item_list, array(
|
||||
@ -267,14 +270,14 @@ class SignController{
|
||||
//获得奖励
|
||||
//判断当前第几周
|
||||
$item_list = array();
|
||||
/*$week = ceil($rowUser['sign_sum'] / 7);
|
||||
$week = ceil($rowUser['sign_sum'] / 7);
|
||||
$dayid = ($week - 1) * 7 + $_REQUEST['sign_id'];
|
||||
//如果大于配置表最后一周,按最后一周奖励
|
||||
$g_conf_sign_cluster = require('../res/signDaily@signDaily.php');
|
||||
if ($dayid > count($g_conf_sign_cluster)) {
|
||||
$dayid = count($g_conf_sign_cluster) - 7;
|
||||
}*/
|
||||
$dayid = $_REQUEST['sign_id'];
|
||||
}
|
||||
//$dayid = $_REQUEST['sign_id'];
|
||||
$s = $this->getSign($dayid + 90000);
|
||||
$item_id_array = $this->getExplode($s['item_id']);
|
||||
$num_array = $this->getExplode($s['num']);
|
||||
@ -336,7 +339,7 @@ class SignController{
|
||||
//获得奖励
|
||||
//判断当前第几周
|
||||
$item_list = array();
|
||||
$dayid = $_REQUEST['sign_id'];
|
||||
//$dayid = $_REQUEST['sign_id'];
|
||||
$s = $this->getSign($dayid + 90000);
|
||||
$item_id_array = $this->getExplode($s['item_id']);
|
||||
$num_array = $this->getExplode($s['num']);
|
||||
@ -422,11 +425,10 @@ class SignController{
|
||||
die();
|
||||
}
|
||||
//刷新抽奖活动奖励
|
||||
$lottery_ret = $conn->execScript('UPDATE activity SET free_times=0, video_times=0, modify_time=:modify_time ' .
|
||||
$lottery_ret = $conn->execScript('UPDATE activity SET free_times=0, video_times=0 ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$lottery_ret) {
|
||||
die();
|
||||
|
Loading…
x
Reference in New Issue
Block a user