This commit is contained in:
aozhiwei 2019-08-29 13:48:51 +08:00
parent 14f45aab6d
commit 7d38cb3509
4 changed files with 69 additions and 8 deletions

View File

@ -394,6 +394,24 @@ CREATE TABLE `redpack` (
PRIMARY KEY (`idx`),
UNIQUE KEY `red_type_red_date` (`red_type`, `red_date`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
DROP TABLE IF EXISTS `redpack_log`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `redpack_log` (
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
`accountid` varchar(60) DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
`order_id` varchar(60) DEFAULT '' COMMENT '订单id',
`get_time` int(11) NOT NULL DEFAULT '0' COMMENT '领取时间',
`coin_num` int(11) NOT NULL DEFAULT '0' COMMENT '金钱数量',
`custom_data` mediumblob COMMENT '其他字段',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`),
UNIQUE KEY `account_order_id_get_time` (`accountid`, `order_id` , `get_time`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;

View File

@ -703,10 +703,19 @@ class ActivityController{
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
return;
}
$p = $this->getParameter(REDLIMIT);
$limit = $p['value'];
$p = array();
$type = $_REQUEST['type'];
$item_list = array();
//随机奖励
$item_list = $this->getRandomAirReward(24006);
if ($type == 1) {
$item_list = $this->getRandomAirReward(24006);
$p = $this->getParameter(REDLIMIT);
}
if ($type == 2) {
$item_list = $this->getRandomAirReward(24007);
$p = $this->getParameter(73);
}
$limit = $p['value'];
foreach ($item_list as $item) {
if ($item['item_id'] != 10004 ) {
//增加奖励
@ -718,7 +727,7 @@ class ActivityController{
$row = $red_conn->execQueryOne('SELECT red_sum FROM redpack ' .
' WHERE red_type=:red_type AND red_date=:red_date;',
array(
':red_type' => $_REQUEST['type'],
':red_type' => $type,
':red_date' => phpcommon\getdayseconds(time())
));
if ($row['red_sum'] + $item['item_num'] > $limit) {
@ -728,7 +737,7 @@ class ActivityController{
//红包领取现金
$this->getRedPack($item['item_num'] * 100, $account_id);
//更新红包数据
$this->updateRedPack($item['item_num'], $_REQUEST['type']);
$this->updateRedPack($item['item_num'], $type);
}
}
echo json_encode(array(
@ -866,6 +875,18 @@ class ActivityController{
phpcommon\sendError(ERR_USER_BASE + 2, '领取失败');
die();
}
//插入日志信息
$ret = $conn->execScript('INSERT INTO redpack_log(accountid, order_id, get_time, custom_data, createtime, modifytime, coin_num) ' .
' VALUES(:accountid, :order_id, :get_time, :custom_data, :createtime, :modifytime, :coin_num);',
array(
':accountid' => $account_id,
':order_id' => $partner_trade_no,
':get_time' => time(),
':custom_data' => $res,
':coin_num' => $amount,
':createtime' => time(),
':modifytime' => time()
));
}
//更新今日红包数据

View File

@ -2,6 +2,19 @@
class ServerSwitchController {
protected function getMysql($account_id)
{
$mysql_conf = getMysqlConfig(crc32($account_id));
$conn = new phpcommon\Mysql(array(
'host' => $mysql_conf['host'],
'port' => $mysql_conf['port'],
'user' => $mysql_conf['user'],
'passwd' => $mysql_conf['passwd'],
'dbname' => 'gamedb2001_' . $mysql_conf['instance_id']
));
return $conn;
}
private function isForbidCity()
{
if (in_array(strtolower($_REQUEST['province']),
@ -36,8 +49,8 @@ class ServerSwitchController {
));
die();
}*/
error_log(json_encode($_REQUEST));
$payable = 0;
$recharge_times = isset($_REQUEST['recharge_times']) ? $_REQUEST['recharge_times'] : 0;
/*
1玩家进入第一天战斗7次开放充值除北上广深成
2玩家进入第二天战斗7次已充值玩家战斗2次除北上广深成
@ -45,6 +58,15 @@ class ServerSwitchController {
*/
if (phpcommon\isValidSessionId($_REQUEST['account_id'],
$_REQUEST['session_id'])) {
$recharge_times = 0;
$conn = $this->getMysql($_REQUEST['account_id']);
$row = $conn->execQueryOne('SELECT recharge_times_total FROM user WHERE accountid=:accountid;',
array(
':accountid' => $_REQUEST['account_id']
));
if ($row) {
$recharge_times = $row['recharge_times_total'];
}
$register_time = phpcommon\extractRegisterTimeFromSessionId($_REQUEST['session_id']);
$nowtime = time();

View File

@ -380,10 +380,10 @@ class ShareController{
$data = json_decode($response, true);
$peo_num = $data['invitee_num'];
$sh = $this->getShare($ach_id);
/*if ($peo_num < $sh['people']) {
if ($peo_num < $sh['people']) {
phpcommon\sendError(ERR_USER_BASE + 4, '未达到人数要求');
return;
}*/
}
$item_list = array();
if ($ach_id != 6) {
$array = $this->getExplode($sh['rewards']);