This commit is contained in:
aozhiwei 2022-01-26 10:37:29 +08:00
parent 6e4d821a30
commit 02e54ce0a2
4 changed files with 31 additions and 35 deletions

View File

@ -19,35 +19,6 @@ CREATE TABLE `version` (
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `t_box`
--
DROP TABLE IF EXISTS `t_box`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `t_box` (
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`box_id` varchar(60) NOT NULL DEFAULT '' COMMENT '箱子唯一id',
`goods_id` int(11) NOT NULL DEFAULT '0' COMMENT 'goods id',
`goods_idx` int(11) NOT NULL DEFAULT '0' COMMENT 'goods idx',
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
`state` int(11) NOT NULL DEFAULT '0' COMMENT 'state 0:待支付 1支付成功',
`order_id` varchar(60) NOT NULL DEFAULT '' COMMENT '订单id(订单过期后设置为空)',
`order_valid` int(11) NOT NULL DEFAULT '0' COMMENT '订单是否有效',
`owner_address` varchar(60) NOT NULL DEFAULT '' COMMENT '所有者',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`),
UNIQUE KEY `box_id` (`box_id`),
UNIQUE KEY `order_id` (`order_id`),
KEY `state` (`state`),
KEY `owner_address` (`owner_address`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `t_box_order`
--
@ -57,6 +28,7 @@ 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',
`box_id` varchar(60) NOT NULL DEFAULT '' COMMENT '箱子唯一id',
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
@ -68,6 +40,7 @@ CREATE TABLE `t_box_order` (
`bc_block_number` varchar(60) NOT NULL DEFAULT '' COMMENT '块id',
`bc_fail_reason` varchar(255) NOT NULL DEFAULT '' COMMENT '原因',
`buyer_address` varchar(60) NOT NULL DEFAULT '' COMMENT '购买者',
`token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id',
`price` bigint NOT NULL DEFAULT '0' COMMENT '价格',
`payment_token_address` varchar(60) NOT NULL DEFAULT '' COMMENT '货币地址',
`nonce` varchar(60) NOT NULL DEFAULT '' COMMENT 'nonce',
@ -79,6 +52,7 @@ CREATE TABLE `t_box_order` (
PRIMARY KEY (`idx`),
UNIQUE KEY `order_id` (`order_id`),
UNIQUE KEY `signature` (`signature`),
KEY `batch_id` (`batch_id`),
KEY `state` (`state`),
KEY `done` (`done`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
@ -94,12 +68,14 @@ DROP TABLE IF EXISTS `t_nft`;
CREATE TABLE `t_nft` (
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
`token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id',
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
`owner_id` varchar(255) NOT NULL DEFAULT '' COMMENT 'owner_id',
`owner_address` varchar(255) NOT NULL DEFAULT '' COMMENT 'owner_address',
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`modifytime` int(11) NOT NULL DEFAULT '0' COMMENT '修改时间',
PRIMARY KEY (`idx`),
UNIQUE KEY `token_id` (`token_id`)
UNIQUE KEY `token_id` (`token_id`),
KEY `owner_address` (`owner_address`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
/*!40101 SET character_set_client = @saved_cs_client */;

View File

@ -7,10 +7,10 @@ require_once('mt/WhiteList.php');
require_once('mt/Currency.php');
require_once('mt/Hero.php');
require_once('models/Box.php');
require_once('models/BoxOrder.php');
use phpcommon\SqlHelper;
use models\Box;
use models\BoxOrder;
class NewMarketController extends BaseController {
@ -39,10 +39,10 @@ class NewMarketController extends BaseController {
$presaleInfo = array(
'batch_id' => $currBatchMeta['batch_id'],
'countdown' => max(0, $currBatchMeta['_start_time_utc'] - myself()->_getNowTime()),
'sold_num' => min(Box::getSoldNum($currBatchMeta['batch_id']), $currBatchMeta['number_of_props']),
'sold_num' => min(BoxOrder::getSoldNum($currBatchMeta['batch_id']), $currBatchMeta['number_of_props']),
'inventory_num' => $currBatchMeta['number_of_props'],
'hint' => str_replace("\n", '\n', $currBatchMeta['hint']),
'buyed' => Box::isBuyed($account, $currBatchMeta['batch_id'])
'buyed' => BoxOrder::isBuyed($account, $currBatchMeta['batch_id'])
);
$batchMetas = mt\MarketGoods::getBatchMetas($currBatchMeta['batch_id']);

View File

@ -5,7 +5,7 @@ namespace models;
use mt;
use phpcommon\SqlHelper;
class Box extends BaseModel {
class BoxOrder extends BaseModel {
public function getSoldNum($batchId)
{

View File

@ -0,0 +1,20 @@
<?php
namespace models;
use mt;
use phpcommon\SqlHelper;
class Box extends BaseModel {
public function getSoldNum($batchId)
{
return 0;
}
public function isBuyed($buyerAddress, $batchId)
{
return 0;
}
}