1
This commit is contained in:
parent
b119b63415
commit
935b5c3fd7
@ -791,6 +791,7 @@ CREATE TABLE `t_transaction` (
|
|||||||
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
|
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
|
||||||
`trans_id` varchar(255) NOT NULL DEFAULT '' COMMENT '事务id',
|
`trans_id` varchar(255) NOT NULL DEFAULT '' COMMENT '事务id',
|
||||||
`action` int(11) NOT NULL DEFAULT '0' COMMENT 'action',
|
`action` int(11) NOT NULL DEFAULT '0' COMMENT 'action',
|
||||||
|
`item_uniid` int(11) NOT NULL DEFAULT '0' COMMENT '道具uniid',
|
||||||
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
|
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
|
||||||
`status` int(11) NOT NULL DEFAULT '0' COMMENT 'status',
|
`status` int(11) NOT NULL DEFAULT '0' COMMENT 'status',
|
||||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||||
|
@ -47,7 +47,39 @@ class BlockChainController extends BaseAuthedController {
|
|||||||
|
|
||||||
public function active721Nft()
|
public function active721Nft()
|
||||||
{
|
{
|
||||||
|
$type = getReqVal('type', 0);
|
||||||
|
$uniid = getReqVal('uniid', 0);
|
||||||
|
switch ($type) {
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
$heroDb = Hero::find($uuid);
|
||||||
|
if (!$heroDb) {
|
||||||
|
myself()->_rspErr(1, 'hero not found');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($heroDb['token_id']) {
|
||||||
|
myself()->_rspErr(1, 'already activated');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
$gunDb = Gun::find($uuid);
|
||||||
|
if (!$gunDb) {
|
||||||
|
myself()->_rspErr(1, 'gun not found');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
myself()->_rspErr(1, 'type param error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function active1155Nft()
|
public function active1155Nft()
|
||||||
|
@ -38,6 +38,11 @@ class ShopController extends BaseAuthedController {
|
|||||||
const TOKEN_TYPE_MATIC = '101';
|
const TOKEN_TYPE_MATIC = '101';
|
||||||
const TOKEN_TYPE_BNB = '102';
|
const TOKEN_TYPE_BNB = '102';
|
||||||
|
|
||||||
|
// 限购类型
|
||||||
|
const DAILY_BUY_LIMIT = 1;
|
||||||
|
const WEEKLY_BUY_LIMIT = 2;
|
||||||
|
const TOTAL_BUY_LIMIT = 3;
|
||||||
|
|
||||||
public function getGoodsList()
|
public function getGoodsList()
|
||||||
{
|
{
|
||||||
$row = SqlHelper::ormSelect(
|
$row = SqlHelper::ormSelect(
|
||||||
@ -89,6 +94,59 @@ class ShopController extends BaseAuthedController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$buyRecordHash = ShopBuyRecord::allToHash();
|
||||||
|
$boughtTimes = 1;
|
||||||
|
switch ($row['limit_type']) {
|
||||||
|
case ShopController::DAILY_BUY_LIMIT:
|
||||||
|
{
|
||||||
|
|
||||||
|
$buyRecord = getXVal($buyRecordHash, $id);
|
||||||
|
echo "===========".json_encode($buyRecord)."-------".$row['limit_num']."..".getXVal($buyRecord, 'this_day_buy_times', 0);
|
||||||
|
$boughtTimes = $buyRecord ? $buyRecord['this_day_buy_times'] + 1: 1;
|
||||||
|
if ($buyRecord && getXVal($buyRecord, 'this_day_buy_times', 0) >= $row['limit_num']) {
|
||||||
|
$this->_rspErr(2, 'Has reached the maximum number of purchase restrictions today');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($row['limit_num'] <= 0) {
|
||||||
|
$this->_rspErr(2, 'The maximum number of purchase restrictions has been reached');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ShopController::WEEKLY_BUY_LIMIT:
|
||||||
|
{
|
||||||
|
$buyRecord = getXVal($buyRecordHash, $id);
|
||||||
|
$boughtTimes = $buyRecord ? $buyRecord['this_week_buy_times'] + 1: 1;
|
||||||
|
if ($buyRecord && getXVal($buyRecord, 'this_week_buy_times', 0) >= $row['limit_num']) {
|
||||||
|
$this->_rspErr(2, 'The maximum number of purchase restrictions this week has been reached');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($row['limit_num'] <= 0) {
|
||||||
|
$this->_rspErr(2, 'The maximum number of purchase restrictions has been reached');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case ShopController::TOTAL_BUY_LIMIT:
|
||||||
|
{
|
||||||
|
$buyRecord = getXVal($buyRecordHash, $id);
|
||||||
|
$boughtTimes = $buyRecord ? $buyRecord['total_buy_times'] + 1: 1;
|
||||||
|
if ($buyRecord && getXVal($buyRecord, 'total_buy_times', 0) >= $row['limit_num']) {
|
||||||
|
$this->_rspErr(2, 'The maximum number of purchase restrictions has been reached');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($row['limit_num'] <= 0) {
|
||||||
|
$this->_rspErr(2, 'he maximum number of purchase restrictions has been reached');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
$price_array = splitStr1($row['price']);
|
$price_array = splitStr1($row['price']);
|
||||||
$discount_array = splitStr1($row['discount']);
|
$discount_array = splitStr1($row['discount']);
|
||||||
|
|
||||||
@ -111,21 +169,21 @@ class ShopController extends BaseAuthedController {
|
|||||||
$this->internalAddItem($propertyChgService, $itemMeta);
|
$this->internalAddItem($propertyChgService, $itemMeta);
|
||||||
$awardService = new services\AwardService();
|
$awardService = new services\AwardService();
|
||||||
$awardService->addItem($row['goods_id'], $goods_num);
|
$awardService->addItem($row['goods_id'], $goods_num);
|
||||||
ShopBuyRecord::add($row['goods_id'], $itemNum);
|
ShopBuyRecord::add($id, $goods_num);
|
||||||
$this->_decItems($costItems);
|
$this->_decItems($costItems);
|
||||||
$goodsDto = array(
|
$goodsDto = array(
|
||||||
'goods_id' => $itemMeta['id'],
|
'goods_id' => $id,
|
||||||
'item_id' => $itemMeta['id'],
|
'item_id' => $row['goods_id'],
|
||||||
'price_info' => array(
|
'price_info' => array(
|
||||||
'item_id' => $itemMeta['id'],
|
'item_id' => $row['goods_id'],
|
||||||
'cost_list' => array(),
|
'cost_list' => array(),
|
||||||
'discount_begin_time' => phpcommon\datetimeToTimestamp($itemMeta['discount_begin']),
|
'discount_begin_time' => phpcommon\datetimeToTimestamp($row['discount_begin']),
|
||||||
'discount_end_time' => phpcommon\datetimeToTimestamp($itemMeta['discount_end'])
|
'discount_end_time' => phpcommon\datetimeToTimestamp($row['discount_end'])
|
||||||
),
|
),
|
||||||
'flag_icon' => $goodsMeta['tag'],
|
'flag_icon' => $row['tag'],
|
||||||
'limit_type' => $itemMeta['limit_type'],
|
'limit_type' => $row['limit_type'],
|
||||||
'bought_times' => $boughtTimes,
|
'bought_times' => $boughtTimes,
|
||||||
'total_buy_times' => $itemMeta['limit_num'],
|
'total_buy_times' => $row['limit_num'],
|
||||||
);
|
);
|
||||||
{
|
{
|
||||||
$priceInfo = mt\Item::getPriceInfo($itemMeta);
|
$priceInfo = mt\Item::getPriceInfo($itemMeta);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user