1
This commit is contained in:
parent
831bca8455
commit
bbefbf1303
@ -32,24 +32,23 @@ class MarketController extends BaseController {
|
|||||||
const PRESALE_STARTED = 2;
|
const PRESALE_STARTED = 2;
|
||||||
const PRESALE_SOLD_OUT = 3;
|
const PRESALE_SOLD_OUT = 3;
|
||||||
|
|
||||||
private function isTestMode()
|
|
||||||
{
|
|
||||||
return isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443 && SERVER_ENV == _TEST;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getPreSaleInfo()
|
public function getPreSaleInfo()
|
||||||
{
|
{
|
||||||
$account = getReqVal('account', '');
|
$account = getReqVal('account', '');
|
||||||
$currBatchMeta = mt\MarketBatch::getCurrentBatch();
|
$currBatchMeta = mt\MarketBatch::getCurrentBatch();
|
||||||
if (!$currBatchMeta) {
|
if (!$currBatchMeta) {
|
||||||
|
$title = $this->escapeString(
|
||||||
|
mt\Parameter::getVal('pre_sale_not_started_title', ''));
|
||||||
|
$hint = $this->escapeString(
|
||||||
|
mt\Parameter::getVal('pre_sale_not_started_hint', ''));
|
||||||
$presaleInfo = array(
|
$presaleInfo = array(
|
||||||
'batch_id' => 0,
|
'batch_id' => 0,
|
||||||
'countdown' => 0,
|
'countdown' => 0,
|
||||||
'sold_num' => 0,
|
'sold_num' => 0,
|
||||||
'total_num' => 0,
|
'total_num' => 0,
|
||||||
'state' => self::PRESALE_NOT_STARTED,
|
'state' => self::PRESALE_NOT_STARTED,
|
||||||
'title' => $this->escapeString(mt\Parameter::getVal('pre_sale_not_started_title', '')),
|
'title' => $title,
|
||||||
'hint' => $this->escapeString(mt\Parameter::getVal('pre_sale_not_started_hint', '')),
|
'hint' => $hint,
|
||||||
'buyable_list' => array(),
|
'buyable_list' => array(),
|
||||||
//'buyed' => 0
|
//'buyed' => 0
|
||||||
);
|
);
|
||||||
@ -62,7 +61,7 @@ class MarketController extends BaseController {
|
|||||||
$countdown = max(0, $currBatchMeta['start_time'] - myself()->_getNowTime());
|
$countdown = max(0, $currBatchMeta['start_time'] - myself()->_getNowTime());
|
||||||
$soldNum = min(BoxOrder::getSoldNum($currBatchMeta['id']), $currBatchMeta['number_of_props']);
|
$soldNum = min(BoxOrder::getSoldNum($currBatchMeta['id']), $currBatchMeta['number_of_props']);
|
||||||
$totalNum = $currBatchMeta['number_of_props'];
|
$totalNum = $currBatchMeta['number_of_props'];
|
||||||
$buyed = $this->isTestMode() ? 0 : BoxOrder::isBuyed($account, $currBatchMeta['id']);
|
$buyed = MarketService::isTestMode() ? 0 : BoxOrder::isBuyed($account, $currBatchMeta['id']);
|
||||||
$title = '';
|
$title = '';
|
||||||
$state = self::PRESALE_PREPARE;
|
$state = self::PRESALE_PREPARE;
|
||||||
if ($countdown > 0) {
|
if ($countdown > 0) {
|
||||||
@ -287,7 +286,7 @@ class MarketController extends BaseController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*if (!$this->isTestMode() && BoxOrder::isBuyed($buyerAddress, $currBatchMeta['id'])) {
|
/*if (!MarketService::isTestMode() && BoxOrder::isBuyed($buyerAddress, $currBatchMeta['id'])) {
|
||||||
myself()->_rspErr(1, 'account can only choose 1 hero to purchase');
|
myself()->_rspErr(1, 'account can only choose 1 hero to purchase');
|
||||||
return;
|
return;
|
||||||
}*/
|
}*/
|
||||||
|
@ -2,10 +2,17 @@
|
|||||||
|
|
||||||
namespace services;
|
namespace services;
|
||||||
|
|
||||||
|
require_once('mt/Parameter.php');
|
||||||
|
|
||||||
class MarketService extends BaseService {
|
class MarketService extends BaseService {
|
||||||
|
|
||||||
const TOKEN_SALT = 'B8E6BD4F-FD7B-E2B8-6688-80A2D8632064';
|
const TOKEN_SALT = 'B8E6BD4F-FD7B-E2B8-6688-80A2D8632064';
|
||||||
|
|
||||||
|
public static function isTestMode()
|
||||||
|
{
|
||||||
|
return isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == 443 && SERVER_ENV == _TEST;
|
||||||
|
}
|
||||||
|
|
||||||
public static function isValidToken($account, $token)
|
public static function isValidToken($account, $token)
|
||||||
{
|
{
|
||||||
$deToken = base64_decode($token);
|
$deToken = base64_decode($token);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user