This commit is contained in:
aozhiwei 2023-08-31 14:46:13 +08:00
parent c64e930a6d
commit f47c300e8c
2 changed files with 26 additions and 1 deletions

View File

@ -1,7 +1,14 @@
<?php <?php
require_once('models/Transaction.php');
require_once('services/BlockChainService.php');
use phpcommon\SqlHelper; use phpcommon\SqlHelper;
use models\Transaction;
use services\BlockChainService;
class OutAppPlanetController extends BaseController { class OutAppPlanetController extends BaseController {
public function buy() public function buy()
@ -9,6 +16,24 @@ class OutAppPlanetController extends BaseController {
$netId = getReqVal('net_id', ''); $netId = getReqVal('net_id', '');
$address = getReqVal('address', ''); $address = getReqVal('address', '');
$num = getReqVal('num', ''); $num = getReqVal('num', '');
$decimals = BlockChainService::getCurrencyDecimals(BlockChainService::CURRENCY_USDT);
if ($decimals === false) {
myself()->_rspErr(1, 'deciamls error');
returna;
}
$price = BlockChainService::formatCurrencyEx(1, $decimals);
$rspObj = BlockChainService::beNftMallTransBuyPlanet(
Transaction::BUY_OUTAPP_PLANET_ACTION_TYPE,
$address,
array(
'280001'
),
BlockChainService::CURRENCY_USDT,
$price
);
} }
} }

View File

@ -166,7 +166,7 @@ class BlockChainService {
} }
} }
public static function beNftMallTransBuyPlanet($address, $ids, $currency, $price) public static function beNftMallTransBuyPlanet($actionType, $address, $ids, $currency, $price)
{ {
if (!($actionType > Transaction::BUY_BEGIN_ACTION_TYPE && if (!($actionType > Transaction::BUY_BEGIN_ACTION_TYPE &&
$actionType < Transaction::BUY_END_ACTION_TYPE)) { $actionType < Transaction::BUY_END_ACTION_TYPE)) {