1
This commit is contained in:
parent
42915d43f3
commit
35c9fd09fe
@ -61,6 +61,7 @@ CREATE TABLE `user` (
|
||||
`collect_status` int(11) NOT NULL COMMENT '收藏状态',
|
||||
`keys_num` int(11) NOT NULL COMMENT '钥匙数量',
|
||||
`battle_re_times` int(11) NOT NULL COMMENT '每日战斗奖励次数',
|
||||
`shop_flush_times` int(11) NOT NULL COMMENT '每日商店刷新次数',
|
||||
PRIMARY KEY (`idx`),
|
||||
UNIQUE KEY `accountid` (`accountid`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||
|
@ -68,6 +68,7 @@ define('DOUBLE_BOX', 25); //抽箱子奖励翻倍率
|
||||
define('FREE_DRESS_MAX_TIME', 30); //免费获取皮肤次数上限
|
||||
define('RAND_SHOP_GOLD', 39); //商店金币刷新价格
|
||||
define('MAX_BATTLE_REWARD', 40); //战斗额外奖励次数
|
||||
define('MAX_SHOP_REFRESH', 41); //每日商店刷新次数
|
||||
require 'config_loader.php';
|
||||
|
||||
|
||||
|
@ -100,9 +100,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) ' .
|
||||
' 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) ' .
|
||||
' 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;',
|
||||
$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) ' .
|
||||
' 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) ' .
|
||||
' 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;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':user_name' => $user_name,
|
||||
|
@ -34,12 +34,12 @@ class ShareController{
|
||||
|
||||
protected function getShare($share_id)
|
||||
{
|
||||
$g_conf_share_cluster = require('../res/share@share.php');
|
||||
$share_conf = getShareConfig($g_conf_share_cluster, $share_id);
|
||||
$share_meta_table = require('../res/share@share.php');
|
||||
$share_meta = getShareConfig($share_meta_table, $share_id);
|
||||
$sh = array(
|
||||
'id' => $share_conf['id'],
|
||||
'rewards' => $share_conf['rewards'],
|
||||
'people' => $share_conf['people'],
|
||||
'id' => $share_meta['id'],
|
||||
'rewards' => $share_meta['rewards'],
|
||||
'people' => $share_meta['people'],
|
||||
);
|
||||
return $sh;
|
||||
}
|
||||
|
@ -124,11 +124,25 @@ class ShopController{
|
||||
));
|
||||
}
|
||||
}
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$row = $conn->execQueryOne('SELECT shop_flush_times FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
if (!$row) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
echo json_encode(array(
|
||||
'errcode' => 0,
|
||||
'errmsg'=> '',
|
||||
'shop_uuid' => $shop_uuid,
|
||||
'shop_list' => $shop_list,
|
||||
'shop_flush_times' => $row['shop_flush_times'],
|
||||
));
|
||||
}
|
||||
|
||||
@ -207,6 +221,35 @@ class ShopController{
|
||||
}
|
||||
$shop_uuid = $_REQUEST['shop_uuid'];
|
||||
$shop_list = array();
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$row = $conn->execQueryOne('SELECT shop_flush_times FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
if (!$row) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
|
||||
return;
|
||||
}
|
||||
$p_flush = $this->getParameter(MAX_SHOP_REFRESH);
|
||||
if ($p_flush['param_value'] <= $row['shop_flush_times']) {
|
||||
phpcommon\sendError(ERR_USER_BASE + 3, '今日刷新次数已满');
|
||||
return;
|
||||
}
|
||||
$ret = $conn->execScript('UPDATE user SET shop_flush_times=:shop_flush_times, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':coin_num' => $row['shop_flush_times'] + 1,
|
||||
':modify_time' => time()
|
||||
));
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
}
|
||||
$r = $this->getRedis($shop_uuid);
|
||||
$user_db_str = $r->get($shop_uuid);
|
||||
if (empty($user_db_str)) {
|
||||
@ -231,6 +274,7 @@ class ShopController{
|
||||
'errmsg'=> '',
|
||||
'shop_uuid' => $shop_uuid,
|
||||
'shop_list' => $shop_list,
|
||||
'shop_flush_times' => $row['shop_flush_times'] + 1
|
||||
));
|
||||
}
|
||||
|
||||
@ -311,7 +355,7 @@ class ShopController{
|
||||
return;
|
||||
}
|
||||
//扣除货币
|
||||
$rowCoin = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;',
|
||||
$rowCoin = $conn->execQueryOne('SELECT coin_num FROM user WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
|
@ -159,8 +159,8 @@ class SignController{
|
||||
$quest = new classes\Quest();
|
||||
$quest->triggerQuest(QUEST_DAY_LOGIN, 1, 1, $account_id);
|
||||
$quest->triggerQuest(QUEST_SUM_LOGIN, 2, 1, $account_id);
|
||||
//刷新战斗结算奖励次数
|
||||
$battle_ret = $conn->execScript('UPDATE user SET battle_re_times=0, modify_time=:modify_time ' .
|
||||
//刷新战斗结算奖励次数和商店刷新次数
|
||||
$battle_ret = $conn->execScript('UPDATE user SET battle_re_times=0, shop_flush_times=0, modify_time=:modify_time ' .
|
||||
' WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
|
Loading…
x
Reference in New Issue
Block a user