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) { switch ($type) {
case 1: case 1:
{ {
$heroDb = Hero::find($uuid); $heroDb = Hero::find($uniid);
if (!$heroDb) { if (!$heroDb) {
myself()->_rspErr(1, 'hero not found'); myself()->_rspErr(1, 'hero not found');
return; return;
@ -154,8 +154,11 @@ class BlockChainController extends BaseAuthedController {
private function internalActivate721Nft($tokenId, $tokenType, $itemUniId, $itemId) private function internalActivate721Nft($tokenId, $tokenType, $itemUniId, $itemId)
{ {
$params = array( $params = array(
'c' => 'BcService',
'a' => 'activate721Nft',
'account_id' => myself()->_getAccountId(), 'account_id' => myself()->_getAccountId(),
'session_id' => myself()->_getSessionId(), 'session_id' => myself()->_getSessionId(),
'account' => myself()->_getOpenId(),
'token_id' => $tokenId, 'token_id' => $tokenId,
'token_type' => $tokenType, 'token_type' => $tokenType,
'item_uniid' => $itemUniId, 'item_uniid' => $itemUniId,
@ -168,10 +171,11 @@ class BlockChainController extends BaseAuthedController {
($url, ($url,
$params, $params,
$response)) { $response)) {
phpcommon\sendError(500, 'server internal error'); myself()->_rspErr(500, 'server internal error');
die(); die();
return; return;
} }
error_log($response);
$rspObj = json_decode($response, true); $rspObj = json_decode($response, true);
if ($rspObj['errcode'] == 0) { if ($rspObj['errcode'] == 0) {
$transId = $rspObj['trans_id']; $transId = $rspObj['trans_id'];
@ -188,10 +192,19 @@ class BlockChainController extends BaseAuthedController {
'params' => $rspObj['params'] 'params' => $rspObj['params']
)); ));
} else { } else {
phpcommon\sendError(500, 'server internal error'); myself()->_rspErr(500, 'server internal error');
return; 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) public static function find($transId)
{ {
$row = SqlHelper::ormSelectOne( $row = SqlHelper::ormSelectOne(
myself()->_getMarketMysql(), myself()->_getSelfMysql(),
't_transaction', 't_transaction',
array( array(
'account_id' => myself()->_getAccountId(), 'account_id' => myself()->_getAccountId(),
@ -46,6 +46,7 @@ class Transaction extends BaseModel {
public static function add($transId, $action, $tokenId, $tokenType, $itemUniId, $itemId) public static function add($transId, $action, $tokenId, $tokenType, $itemUniId, $itemId)
{ {
SqlHelper::insert( SqlHelper::insert(
myself()->_getSelfMysql(),
't_transaction', 't_transaction',
array( array(
'account_id' => myself()->_getAccountId(), 'account_id' => myself()->_getAccountId(),