1
This commit is contained in:
parent
e3e8e95072
commit
5a7739def1
@ -161,6 +161,37 @@ class BlockChainController extends BaseAuthedController {
|
|||||||
'item_uniid' => $itemUniId,
|
'item_uniid' => $itemUniId,
|
||||||
'item_id' => $itemId
|
'item_id' => $itemId
|
||||||
);
|
);
|
||||||
|
{
|
||||||
|
$url = self::getWeb3ServiceUrl();
|
||||||
|
$response = '';
|
||||||
|
if (!phpcommon\HttpClient::get
|
||||||
|
($url,
|
||||||
|
$params,
|
||||||
|
$response)) {
|
||||||
|
phpcommon\sendError(500, 'server internal error');
|
||||||
|
die();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$rspObj = json_decode($response, true);
|
||||||
|
if ($rspObj['errcode'] == 0) {
|
||||||
|
$transId = $rspObj['trans_id'];
|
||||||
|
Transaction::add(
|
||||||
|
$transId,
|
||||||
|
Transaction::MINT_721_ACTION_TYPE,
|
||||||
|
$tokenId,
|
||||||
|
$tokenType,
|
||||||
|
$itemUniId,
|
||||||
|
$itemId
|
||||||
|
);
|
||||||
|
myself()->_rspData(array(
|
||||||
|
'trans_id' => $transId,
|
||||||
|
'params' => $rspObj['params']
|
||||||
|
));
|
||||||
|
} else {
|
||||||
|
phpcommon\sendError(500, 'server internal error');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ namespace models;
|
|||||||
use mt;
|
use mt;
|
||||||
use phpcommon\SqlHelper;
|
use phpcommon\SqlHelper;
|
||||||
|
|
||||||
class Transaction extends BaseModel {
|
class Transactionxo extends BaseModel {
|
||||||
|
|
||||||
const MINT_721_ACTION_TYPE = 1;
|
const MINT_721_ACTION_TYPE = 1;
|
||||||
const MINT_1155_ACTION_TYPE = 2;
|
const MINT_1155_ACTION_TYPE = 2;
|
||||||
@ -43,6 +43,22 @@ class Transaction extends BaseModel {
|
|||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function add($transId, $action, $tokenId, $tokenType, $itemUniId, $itemId)
|
||||||
|
{
|
||||||
|
SqlHelper::insert(
|
||||||
|
't_transaction',
|
||||||
|
array(
|
||||||
|
'account_id' => myself()->_getAccountId(),
|
||||||
|
'trans_id' => $transId,
|
||||||
|
'action' => $action,
|
||||||
|
'token_id' => $tokenId,
|
||||||
|
'token_type' => $tokenType,
|
||||||
|
'item_uniid' => $itemUniId,
|
||||||
|
'item_id' => $itemId,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public static function getActionDesc($transDb)
|
public static function getActionDesc($transDb)
|
||||||
{
|
{
|
||||||
switch ($transDb['action']) {
|
switch ($transDb['action']) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user