This commit is contained in:
aozhiwei 2022-11-02 11:09:41 +08:00
parent 6291d44f70
commit 8ca3847914
2 changed files with 18 additions and 4 deletions

View File

@ -54,7 +54,7 @@ class BlockChainController extends BaseAuthedController {
switch ($type) {
case 1:
{
$heroDb = Hero::find($uuid);
$heroDb = Hero::find($uniid);
if (!$heroDb) {
myself()->_rspErr(1, 'hero not found');
return;
@ -154,8 +154,11 @@ class BlockChainController extends BaseAuthedController {
private function internalActivate721Nft($tokenId, $tokenType, $itemUniId, $itemId)
{
$params = array(
'c' => 'BcService',
'a' => 'activate721Nft',
'account_id' => myself()->_getAccountId(),
'session_id' => myself()->_getSessionId(),
'account' => myself()->_getOpenId(),
'token_id' => $tokenId,
'token_type' => $tokenType,
'item_uniid' => $itemUniId,
@ -168,10 +171,11 @@ class BlockChainController extends BaseAuthedController {
($url,
$params,
$response)) {
phpcommon\sendError(500, 'server internal error');
myself()->_rspErr(500, 'server internal error');
die();
return;
}
error_log($response);
$rspObj = json_decode($response, true);
if ($rspObj['errcode'] == 0) {
$transId = $rspObj['trans_id'];
@ -188,10 +192,19 @@ class BlockChainController extends BaseAuthedController {
'params' => $rspObj['params']
));
} else {
phpcommon\sendError(500, 'server internal error');
myself()->_rspErr(500, 'server internal error');
return;
}
}
}
private static function getWeb3ServiceUrl()
{
if (SERVER_ENV == _TEST) {
return 'http://127.0.0.1:7672/webapp/index.php';
}
$web3ServiceCluster = require_once('../config/web3service.cluster.php');
return $web3ServiceCluster[rand() % count($web3ServiceCluster)];
}
}

View File

@ -33,7 +33,7 @@ class Transaction extends BaseModel {
public static function find($transId)
{
$row = SqlHelper::ormSelectOne(
myself()->_getMarketMysql(),
myself()->_getSelfMysql(),
't_transaction',
array(
'account_id' => myself()->_getAccountId(),
@ -46,6 +46,7 @@ class Transaction extends BaseModel {
public static function add($transId, $action, $tokenId, $tokenType, $itemUniId, $itemId)
{
SqlHelper::insert(
myself()->_getSelfMysql(),
't_transaction',
array(
'account_id' => myself()->_getAccountId(),