1
This commit is contained in:
parent
cb87921598
commit
21475decb1
@ -412,6 +412,15 @@ CREATE TABLE `redpack_log` (
|
|||||||
UNIQUE KEY `account_order_id_get_time` (`accountid`, `order_id` , `get_time`)
|
UNIQUE KEY `account_order_id_get_time` (`accountid`, `order_id` , `get_time`)
|
||||||
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `orderidx`;
|
||||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
|
/*!40101 SET character_set_client = utf8 */;
|
||||||
|
CREATE TABLE `orderidx` (
|
||||||
|
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||||
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
|
PRIMARY KEY (`idx`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
|
|
||||||
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
|
||||||
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
|
||||||
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
|
||||||
|
15
sql/gamedb2001_n_migrate_190902_01.sql
Normal file
15
sql/gamedb2001_n_migrate_190902_01.sql
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
begin;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `orderidx`;
|
||||||
|
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||||
|
/*!40101 SET character_set_client = utf8 */;
|
||||||
|
CREATE TABLE `orderidx` (
|
||||||
|
`idx` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||||
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
|
PRIMARY KEY (`idx`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
|
||||||
|
|
||||||
|
|
||||||
|
insert into version (version) values(20190902);
|
||||||
|
|
||||||
|
commit;
|
@ -694,6 +694,12 @@ class ActivityController{
|
|||||||
return $airReward_list;
|
return $airReward_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function tempRedPack()
|
||||||
|
{
|
||||||
|
$this->getRedPack($_REQUEST['amount'], $_REQUEST['account_id']);
|
||||||
|
error_log('success');
|
||||||
|
}
|
||||||
|
|
||||||
public function getRedBag()
|
public function getRedBag()
|
||||||
{
|
{
|
||||||
$account_id = $_REQUEST['account_id'];
|
$account_id = $_REQUEST['account_id'];
|
||||||
@ -760,23 +766,10 @@ class ActivityController{
|
|||||||
return $conn;
|
return $conn;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getPayMysql($accountid)
|
|
||||||
{
|
|
||||||
$mysql_conf = getMysqlConfig(crc32($accountid));
|
|
||||||
$conn = new phpcommon\Mysql(array(
|
|
||||||
'host' => $mysql_conf['host'],
|
|
||||||
'port' => $mysql_conf['port'],
|
|
||||||
'user' => $mysql_conf['user'],
|
|
||||||
'passwd' => $mysql_conf['passwd'],
|
|
||||||
'dbname' => 'paydb'
|
|
||||||
));
|
|
||||||
return $conn;
|
|
||||||
}
|
|
||||||
|
|
||||||
//redpack201908191405_xxxxx
|
//redpack201908191405_xxxxx
|
||||||
protected function getOrderId($accountid)
|
protected function getOrderId($accountid)
|
||||||
{
|
{
|
||||||
$conn = $this->getPayMysql($accountid);
|
$conn = $this->getMysql($accountid);
|
||||||
$orderid_pre = 'redpack' . strftime('%y%m%d%H%M%S');
|
$orderid_pre = 'redpack' . strftime('%y%m%d%H%M%S');
|
||||||
$ret = $conn->execScript("INSERT INTO orderidx(createtime) VALUES(:createtime);",
|
$ret = $conn->execScript("INSERT INTO orderidx(createtime) VALUES(:createtime);",
|
||||||
array(
|
array(
|
||||||
|
@ -22,18 +22,21 @@ class TempController{
|
|||||||
{
|
{
|
||||||
$type = $_REQUEST['type'];
|
$type = $_REQUEST['type'];
|
||||||
$red_conn = $this->getRedMysql();
|
$red_conn = $this->getRedMysql();
|
||||||
$rows = $red_conn->execQuery('SELECT * FROM redpack ' .
|
$rows = $red_conn->execQueryOne('SELECT * FROM redpack ' .
|
||||||
' WHERE red_type=:red_type;',
|
' WHERE red_type=:red_type AND red_date=:red_date;',
|
||||||
//AND red_date=:red_date;',
|
|
||||||
array(
|
array(
|
||||||
':red_type' => $type,
|
':red_type' => $type,
|
||||||
//':red_date' => phpcommon\getdayseconds(time())
|
':red_date' => phpcommon\getdayseconds(time())
|
||||||
));
|
));
|
||||||
error_log(json_encode($rows));
|
error_log(json_encode($rows));
|
||||||
|
if ($rows['red_sum'] + 0.3 > 100) {
|
||||||
|
phpcommon\sendError(ERR_USER_BASE + 3, '今日红包已领完');
|
||||||
|
return;
|
||||||
|
}
|
||||||
echo json_encode(array(
|
echo json_encode(array(
|
||||||
'errcode' => 0,
|
'errcode' => 0,
|
||||||
'errmsg' => '',
|
'errmsg' => '',
|
||||||
//'sum' => $row['red_sum']
|
'sum' => $rows['red_sum']
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user