This commit is contained in:
aozhiwei 2022-01-26 16:53:07 +08:00
parent 4e3b199c2d
commit 299e0c7e84
2 changed files with 5 additions and 4 deletions

View File

@ -28,8 +28,8 @@ DROP TABLE IF EXISTS `t_box_order`;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t_box_order` (
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`batch_id` int(11) NOT NULL DEFAULT '0' COMMENT '批次号',
`order_id` varchar(60) NOT NULL DEFAULT '' COMMENT '订单id',
`batch_id` int(11) NOT NULL DEFAULT '0' COMMENT '批次号',
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
`state` int(11) NOT NULL DEFAULT '0' COMMENT 'state 0:待支付 1支付成功',
`bc_synced` int(11) NOT NULL DEFAULT '0' COMMENT '0:未上链 1:已上链',
@ -44,7 +44,6 @@ CREATE TABLE `t_box_order` (
`payment_token_address` varchar(60) NOT NULL DEFAULT '' COMMENT '货币地址',
`nonce` varchar(60) NOT NULL DEFAULT '' COMMENT 'nonce',
`signature` varchar(255) NOT NULL DEFAULT '' COMMENT '签名',
`expired` int(11) NOT NULL DEFAULT '0' COMMENT '是否过期',
`done` int(11) NOT NULL DEFAULT '0' COMMENT '是否已完成',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',

View File

@ -10,7 +10,8 @@ class BoxOrder extends BaseModel {
public function getSoldNum($batchId)
{
$row = myself()->_getMarketMysql()->execQueryOne
('SELECT COUNT(*) AS sold_num FROM t_box_order WHERE batch_id=:batch_id;',
('SELECT COUNT(*) AS sold_num FROM t_box_order WHERE batch_id=:batch_id AND ' .
' (state = 1 OR done <> 1);',
array(
':batch_id' => $batchId
));
@ -20,7 +21,8 @@ class BoxOrder extends BaseModel {
public function isBuyed($buyerAddress, $batchId)
{
$row = myself()->_getMarketMysql()->execQueryOne
('SELECT COUNT(*) AS buy_count FROM t_box_order WHERE batch_id=:batch_id AND buyer_address=:buyer_address;',
('SELECT COUNT(*) AS buy_count FROM t_box_order WHERE batch_id=:batch_id AND ' .
' buyer_address=:buyer_address AND (state = 1 OR done <> 1);',
array(
':buyer_address' => $buyerAddress,
':batch_id' => $batchId