1
This commit is contained in:
parent
d805e9b3c4
commit
088d2f0d0a
@ -803,6 +803,8 @@ CREATE TABLE `t_transaction_prefee` (
|
|||||||
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
`idx` bigint NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||||
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
|
`account_id` varchar(60) NOT NULL DEFAULT '' COMMENT '账号id(channel + "_" + gameid + "_" + openid)',
|
||||||
`trans_id` varchar(255) NOT NULL DEFAULT '' COMMENT '事务id',
|
`trans_id` varchar(255) NOT NULL DEFAULT '' COMMENT '事务id',
|
||||||
|
`target_token_id` bigint NOT NULL DEFAULT '0' COMMENT 'target_token_id',
|
||||||
|
`target_token_type` bigint NOT NULL DEFAULT '0' COMMENT 'target_token_type',
|
||||||
`item_uniid` bigint NOT NULL DEFAULT '0' COMMENT '道具uniid',
|
`item_uniid` bigint NOT NULL DEFAULT '0' COMMENT '道具uniid',
|
||||||
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
|
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
|
||||||
`item_num` int(11) NOT NULL DEFAULT '0' COMMENT '道具数量',
|
`item_num` int(11) NOT NULL DEFAULT '0' COMMENT '道具数量',
|
||||||
|
@ -13,6 +13,7 @@ require_once('models/Chip.php');
|
|||||||
require_once('models/Transaction.php');
|
require_once('models/Transaction.php');
|
||||||
require_once('models/BuyRecord.php');
|
require_once('models/BuyRecord.php');
|
||||||
require_once('models/Chip.php');
|
require_once('models/Chip.php');
|
||||||
|
require_once('models/TransactionPrefee.php');
|
||||||
|
|
||||||
require_once('services/AwardService.php');
|
require_once('services/AwardService.php');
|
||||||
require_once('services/PropertyChgService.php');
|
require_once('services/PropertyChgService.php');
|
||||||
@ -27,6 +28,7 @@ use models\Nft;
|
|||||||
use models\Transaction;
|
use models\Transaction;
|
||||||
use models\BuyRecord;
|
use models\BuyRecord;
|
||||||
use models\Chip;
|
use models\Chip;
|
||||||
|
use models\TransactionPrefee;
|
||||||
|
|
||||||
class BlockChainController extends BaseAuthedController {
|
class BlockChainController extends BaseAuthedController {
|
||||||
|
|
||||||
@ -181,7 +183,12 @@ class BlockChainController extends BaseAuthedController {
|
|||||||
$this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
|
$this->_rspErr(3, $this->_getLackItemErrMsg($lackItem));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->_decItems($costItems);
|
$decFeeCb = function ($transId) use ($costItems){
|
||||||
|
myself()->_decItems($costItems);
|
||||||
|
foreach ($costItems as $costItem){
|
||||||
|
TransactionPrefee::add($transId,$costItem);
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
$this->internalBcCall(
|
$this->internalBcCall(
|
||||||
array(
|
array(
|
||||||
@ -200,7 +207,8 @@ class BlockChainController extends BaseAuthedController {
|
|||||||
'tokenType' => Nft::HERO_TYPE,
|
'tokenType' => Nft::HERO_TYPE,
|
||||||
'itemUniId' => $nft1['hero_uniid'],
|
'itemUniId' => $nft1['hero_uniid'],
|
||||||
'itemId' => $nft1['hero_id']
|
'itemId' => $nft1['hero_id']
|
||||||
)
|
),
|
||||||
|
$decFeeCb
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -810,7 +818,7 @@ class BlockChainController extends BaseAuthedController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function internalBcCall($params, $transParams) {
|
private function internalBcCall($params, $transParams, $cb = null) {
|
||||||
$url = self::getWeb3ServiceUrl();
|
$url = self::getWeb3ServiceUrl();
|
||||||
$response = '';
|
$response = '';
|
||||||
if (!phpcommon\HttpClient::get
|
if (!phpcommon\HttpClient::get
|
||||||
@ -833,6 +841,9 @@ class BlockChainController extends BaseAuthedController {
|
|||||||
$transParams['itemUniId'],
|
$transParams['itemUniId'],
|
||||||
$transParams['itemId']
|
$transParams['itemId']
|
||||||
);
|
);
|
||||||
|
if ($cb) {
|
||||||
|
$cb($transId);
|
||||||
|
}
|
||||||
myself()->_rspData(array(
|
myself()->_rspData(array(
|
||||||
'trans_id' => $transId,
|
'trans_id' => $transId,
|
||||||
'params' => $rspObj['params']
|
'params' => $rspObj['params']
|
||||||
|
29
webapp/models/TransactionPrefee.php
Normal file
29
webapp/models/TransactionPrefee.php
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
|
||||||
|
namespace models;
|
||||||
|
|
||||||
|
use mt;
|
||||||
|
use phpcommon\SqlHelper;
|
||||||
|
class TransactionPrefee extends BaseModel
|
||||||
|
{
|
||||||
|
public static function add($transId,$param)
|
||||||
|
{
|
||||||
|
SqlHelper::insert(
|
||||||
|
myself()->_getSelfMysql(),
|
||||||
|
't_transaction_prefee',
|
||||||
|
array(
|
||||||
|
'account_id' => myself()->_getAccountId(),
|
||||||
|
'trans_id' => $transId,
|
||||||
|
'target_token_id' => isset($param['token_id']) ? $param['token_id']:0,
|
||||||
|
'target_token_type' => isset($param['token_type']) ? $param['token_type']:0,
|
||||||
|
// 'item_uniid' => $transId,
|
||||||
|
'item_id' => $param['item_id'],
|
||||||
|
'item_num' => $param['item_num'],
|
||||||
|
'done' => 0,
|
||||||
|
'createtime' => myself()->_getNowTime(),
|
||||||
|
'modifytime' => myself()->_getNowTime(),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user