diff --git a/webapp/controller/BlockChainController.class.php b/webapp/controller/BlockChainController.class.php index dc2c1e83..9447279e 100644 --- a/webapp/controller/BlockChainController.class.php +++ b/webapp/controller/BlockChainController.class.php @@ -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)]; + } + } diff --git a/webapp/models/Transaction.php b/webapp/models/Transaction.php index 4c883c74..7aa1f4af 100644 --- a/webapp/models/Transaction.php +++ b/webapp/models/Transaction.php @@ -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(),