1
This commit is contained in:
parent
95482b20dc
commit
f5674ae728
@ -390,7 +390,7 @@ DROP TABLE IF EXISTS `t_phase3_box`;
|
||||
CREATE TABLE `t_phase3_box` (
|
||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`account` varchar(60) NOT NULL DEFAULT '' COMMENT 'account',
|
||||
`token_id` varchar(60) NOT NULL DEFAULT '' COMMENT 'token_id',
|
||||
`token_id` varchar(60) COMMENT 'token_id',
|
||||
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT 'item_id',
|
||||
`cec` int(11) NOT NULL DEFAULT '0' COMMENT 'cec',
|
||||
`state` int(11) NOT NULL DEFAULT '0' COMMENT 'state',
|
||||
|
@ -15,7 +15,7 @@ require_once('models/BuyRecord.php');
|
||||
require_once('services/MarketService.php');
|
||||
require_once('services/LuckyBoxService.php');
|
||||
require_once('services/ActivateNftService.php');
|
||||
require_once('services/Phase3Service.php');
|
||||
require_once('services/Phase3BoxService.php');
|
||||
|
||||
require_once('phpcommon/bchelper.php');
|
||||
|
||||
@ -26,7 +26,7 @@ use models\BuyRecord;
|
||||
use services\MarketService;
|
||||
use services\LuckyBoxService;
|
||||
use services\ActivateNftService;
|
||||
use services\Phase3Service;
|
||||
use services\Phase3BoxService;
|
||||
|
||||
class MarketController extends BaseController {
|
||||
|
||||
@ -496,9 +496,11 @@ class MarketController extends BaseController {
|
||||
$tokenId = getReqVal('token_id', '');
|
||||
$netId = getReqVal('net_id', '');
|
||||
$account = strtolower(getReqVal('account', ''));
|
||||
if (!MarketService::isValidToken($account, $token)) {
|
||||
myself()->_rspErr(1, 'invalid token');
|
||||
return;
|
||||
if (SERVER_ENV == _ONLINE) {
|
||||
if (!MarketService::isValidToken($account, $token)) {
|
||||
myself()->_rspErr(1, 'invalid token');
|
||||
return;
|
||||
}
|
||||
}
|
||||
Phase3BoxService::getPhase3Box($account);
|
||||
}
|
||||
@ -511,9 +513,11 @@ class MarketController extends BaseController {
|
||||
$netId = getReqVal('net_id', '');
|
||||
$boxId = getReqVal('box_id', '');
|
||||
$account = strtolower(getReqVal('account', ''));
|
||||
if (!MarketService::isValidToken($account, $token)) {
|
||||
myself()->_rspErr(1, 'invalid token');
|
||||
return;
|
||||
if (SERVER_ENV == _ONLINE) {
|
||||
if (!MarketService::isValidToken($account, $token)) {
|
||||
myself()->_rspErr(1, 'invalid token');
|
||||
return;
|
||||
}
|
||||
}
|
||||
Phase3BoxService::openPhase3Box($account, $boxId);
|
||||
}
|
||||
@ -526,11 +530,46 @@ class MarketController extends BaseController {
|
||||
$netId = getReqVal('net_id', '');
|
||||
$boxId = getReqVal('box_id', '');
|
||||
$account = strtolower(getReqVal('account', ''));
|
||||
if (!MarketService::isValidToken($account, $token)) {
|
||||
myself()->_rspErr(1, 'invalid token');
|
||||
return;
|
||||
if (SERVER_ENV == _ONLINE) {
|
||||
if (!MarketService::isValidToken($account, $token)) {
|
||||
myself()->_rspErr(1, 'invalid token');
|
||||
return;
|
||||
}
|
||||
}
|
||||
Phase3BoxService::queryPhase3Box($account, $boxId);
|
||||
}
|
||||
|
||||
public function genTestData()
|
||||
{
|
||||
$gameId = 2006;
|
||||
$funcId = phpcommon\BC_FUNC_OPEN_BOX;
|
||||
if (SERVER_ENV == _TEST) {
|
||||
$rows = SqlHelper::ormSelect(
|
||||
myself()->_getMarketMysql(),
|
||||
't_phase3_box',
|
||||
array(
|
||||
)
|
||||
);
|
||||
foreach ($rows as $row) {
|
||||
if (empty($row['token_id'])) {
|
||||
$orderId = BuyRecord::genOrderId($gameId,
|
||||
$funcId,
|
||||
myself()->_getNowTime(),
|
||||
$row['account']);
|
||||
SqlHelper::update(
|
||||
myself()->_getMarketMysql(),
|
||||
't_phase3_box',
|
||||
array(
|
||||
'account' => $row['account']
|
||||
),
|
||||
array(
|
||||
'token_id' => $orderId
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
myself()->_rspOk();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ namespace models;
|
||||
require_once('models/Nft.php');
|
||||
|
||||
use mt;
|
||||
use phpcommon;
|
||||
use phpcommon\SqlHelper;
|
||||
|
||||
class Phase3Box extends BaseModel {
|
||||
@ -88,9 +89,16 @@ class Phase3Box extends BaseModel {
|
||||
for ($i = 0; $i < count($randArr); ++$i) {
|
||||
if ($rnd <= $randArr[$i]) {
|
||||
$rewardIdx = $i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
self::internalGive($rewardIdx);
|
||||
self::internalGive(
|
||||
$account,
|
||||
$row['token_id'],
|
||||
$rewardIdx,
|
||||
$heros,
|
||||
$guns,
|
||||
$chips);
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,6 +114,7 @@ class Phase3Box extends BaseModel {
|
||||
$tokenType = 0;
|
||||
$tags = '';
|
||||
$cec = 0;
|
||||
$rewardIdx = 0;
|
||||
switch ($rewardIdx) {
|
||||
case 0:
|
||||
{
|
||||
|
@ -22,9 +22,9 @@ class Phase3BoxService {
|
||||
public static function getPhase3Box($account)
|
||||
{
|
||||
$rows = array();
|
||||
$boxDb = Phase3Box::all($account);
|
||||
if ($boxDb) {
|
||||
array_push(array(
|
||||
$boxDb = Phase3Box::find($account);
|
||||
if ($boxDb && $boxDb['state'] == Phase3Box::INIT_STATE) {
|
||||
array_push($rows, array(
|
||||
'box_id' => $boxDb['token_id'],
|
||||
'image_box_1' => 'https://www.cebg.games/res/nfts/box_1.png',
|
||||
'image_box_2' => 'https://www.cebg.games/res/nfts/box_2.png',
|
||||
@ -38,7 +38,7 @@ class Phase3BoxService {
|
||||
|
||||
public static function openPhase3Box($account, $boxId)
|
||||
{
|
||||
$boxDb = Phase3Box::all($account);
|
||||
$boxDb = Phase3Box::find($account);
|
||||
if (!$boxDb) {
|
||||
myself()->_rspErr(100, 'box not exists');
|
||||
return;
|
||||
@ -51,7 +51,7 @@ class Phase3BoxService {
|
||||
|
||||
public static function queryPhase3Box($account, $boxId)
|
||||
{
|
||||
$boxDb = Phase3Box::all($account);
|
||||
$boxDb = Phase3Box::find($account);
|
||||
if (!$boxDb) {
|
||||
myself()->_rspErr(100, 'box not exists');
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user