1
This commit is contained in:
parent
a4e8ec8ba7
commit
d1f09230d6
@ -800,6 +800,7 @@ CREATE TABLE `t_transaction` (
|
||||
`item_uniid` bigint NOT NULL DEFAULT '0' COMMENT '道具uniid',
|
||||
`item_id` int(11) NOT NULL DEFAULT '0' COMMENT '道具id',
|
||||
`status` int(11) NOT NULL DEFAULT '0' COMMENT 'status',
|
||||
`result` int(11) NOT NULL DEFAULT '0' COMMENT 'result 0:失败 1:成功',
|
||||
`client_confirmed` int(11) NOT NULL DEFAULT '0' COMMENT 'client_confirmed',
|
||||
`client_result` mediumblob COMMENT 'client_result',
|
||||
`createtime` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
|
@ -191,6 +191,14 @@ class BlockChainController extends BaseAuthedController {
|
||||
}
|
||||
};
|
||||
}
|
||||
//英雄进阶概率
|
||||
$rnd = rand(1, 100);
|
||||
$probability = \services\FormulaService::Hero_Advanced_Probability($nft1['quality'] + 1)*100;
|
||||
if ($rnd > $probability) {
|
||||
$result = 0;
|
||||
}else{
|
||||
$result = 1;
|
||||
}
|
||||
$this->internalBcCall(
|
||||
array(
|
||||
'c' => 'BcService',
|
||||
@ -207,7 +215,8 @@ class BlockChainController extends BaseAuthedController {
|
||||
'tokenId' => $nft1['token_id'],
|
||||
'tokenType' => Nft::HERO_TYPE,
|
||||
'itemUniId' => $nft1['hero_uniid'],
|
||||
'itemId' => $nft1['hero_id']
|
||||
'itemId' => $nft1['hero_id'],
|
||||
'result' => $result,
|
||||
),
|
||||
$decFeeCb
|
||||
);
|
||||
@ -246,6 +255,14 @@ class BlockChainController extends BaseAuthedController {
|
||||
}
|
||||
};
|
||||
}
|
||||
//武器进阶概率
|
||||
$rnd = rand(1, 100);
|
||||
$probability = \services\FormulaService::Weapon_Advanced_Probability($nft1['quality'] + 1)*100;
|
||||
if ($rnd > $probability) {
|
||||
$result = 0;
|
||||
}else{
|
||||
$result = 1;
|
||||
}
|
||||
|
||||
$this->internalBcCall(
|
||||
array(
|
||||
@ -263,7 +280,8 @@ class BlockChainController extends BaseAuthedController {
|
||||
'tokenId' => $nft1['token_id'],
|
||||
'tokenType' => Nft::EQUIP_TYPE,
|
||||
'itemUniId' => $nft1['gun_uniid'],
|
||||
'itemId' => $nft1['gun_id']
|
||||
'itemId' => $nft1['gun_id'],
|
||||
'result' => $result,
|
||||
),
|
||||
$decFeeCb
|
||||
);
|
||||
@ -292,6 +310,24 @@ class BlockChainController extends BaseAuthedController {
|
||||
myself()->_rspErr(1, 'token_id1 paramater error');
|
||||
return;
|
||||
}
|
||||
//芯片进阶概率
|
||||
$upgrade_cost = \services\FormulaService::getChipUpgradeCost($nftDb['chip_grade']+1);
|
||||
if ($upgrade_cost==0){
|
||||
$this->_rspErr(1, 'token_id1 Error in calculation formula');
|
||||
return;
|
||||
}
|
||||
$cumulative_cost = 0;
|
||||
foreach ($tokenIds as $val){
|
||||
$chip_param = Chip::findByTokenId($val);
|
||||
$cumulative_cost += \services\FormulaService::getChipCumulativeCost($chip_param['chip_grade']);
|
||||
}
|
||||
$rnd = rand(1,100);
|
||||
$probability = $cumulative_cost/$upgrade_cost * 100;
|
||||
if ($rnd > $probability) {
|
||||
$result = 0;
|
||||
}else{
|
||||
$result = 1;
|
||||
}
|
||||
|
||||
$this->internalBcCall(
|
||||
array(
|
||||
@ -308,7 +344,8 @@ class BlockChainController extends BaseAuthedController {
|
||||
'tokenId' => $tokenId1,
|
||||
'tokenType' => 0,
|
||||
'itemUniId' => $nftDb['chip_uniid'],
|
||||
'itemId' => $nftDb['item_id']
|
||||
'itemId' => $nftDb['item_id'],
|
||||
'result' => $result,
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -488,7 +525,8 @@ class BlockChainController extends BaseAuthedController {
|
||||
$tokenId,
|
||||
$tokenType,
|
||||
0,
|
||||
$itemId
|
||||
$itemId,
|
||||
1
|
||||
);
|
||||
$propertyChgService = new services\PropertyChgService();
|
||||
$propertyChgService->addUserChg();
|
||||
@ -554,7 +592,8 @@ class BlockChainController extends BaseAuthedController {
|
||||
'tokenId' => $tokenId,
|
||||
'tokenType' => Nft::HERO_TYPE,
|
||||
'itemUniId' => $heroDb['hero_uniid'],
|
||||
'itemId' => $heroDb['hero_id']
|
||||
'itemId' => $heroDb['hero_id'],
|
||||
'result' => 1,
|
||||
)
|
||||
);
|
||||
|
||||
@ -592,7 +631,8 @@ class BlockChainController extends BaseAuthedController {
|
||||
'tokenId' => $tokenId,
|
||||
'tokenType' => Nft::EQUIP_TYPE,
|
||||
'itemUniId' => $gunDb['gun_uniid'],
|
||||
'itemId' => $gunDb['gun_id']
|
||||
'itemId' => $gunDb['gun_id'],
|
||||
'result' => 1,
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -690,7 +730,8 @@ class BlockChainController extends BaseAuthedController {
|
||||
'tokenId' => $tokenId,
|
||||
'tokenType' => Nft::HERO_TYPE,
|
||||
'itemUniId' => $heroDb['hero_uniid'],
|
||||
'itemId' => $heroDb['hero_id']
|
||||
'itemId' => $heroDb['hero_id'],
|
||||
'result' => 1,
|
||||
),
|
||||
$decFeeCb
|
||||
);
|
||||
@ -722,7 +763,8 @@ class BlockChainController extends BaseAuthedController {
|
||||
'tokenId' => $tokenId,
|
||||
'tokenType' => Nft::EQUIP_TYPE,
|
||||
'itemUniId' => $gunDb['gun_uniid'],
|
||||
'itemId' => $gunDb['gun_id']
|
||||
'itemId' => $gunDb['gun_id'],
|
||||
'result' => 1,
|
||||
),
|
||||
$decFeeCb
|
||||
);
|
||||
@ -804,7 +846,8 @@ class BlockChainController extends BaseAuthedController {
|
||||
$tokenId,
|
||||
$tokenType,
|
||||
$itemUniId,
|
||||
$itemId
|
||||
$itemId,
|
||||
1
|
||||
);
|
||||
myself()->_rspData(array(
|
||||
'trans_id' => $transId,
|
||||
@ -858,7 +901,8 @@ class BlockChainController extends BaseAuthedController {
|
||||
$tokenId,
|
||||
Nft::CHIP_TYPE,
|
||||
$itemDb['item_uniid'],
|
||||
$itemDb['item_id']
|
||||
$itemDb['item_id'],
|
||||
1
|
||||
);
|
||||
Bag::decItemByUnIid($itemDb['item_uniid'], $num);
|
||||
TransactionPrefee::add($transId, array(
|
||||
@ -913,7 +957,8 @@ class BlockChainController extends BaseAuthedController {
|
||||
$tokenId,
|
||||
$tokenType,
|
||||
$itemDb['item_uniid'],
|
||||
$itemId
|
||||
$itemId,
|
||||
1
|
||||
);
|
||||
Bag::decItemByUnIid($itemDb['item_uniid'], $num);
|
||||
TransactionPrefee::add($transId, array(
|
||||
@ -955,7 +1000,8 @@ class BlockChainController extends BaseAuthedController {
|
||||
$transParams['tokenId'],
|
||||
$transParams['tokenType'],
|
||||
$transParams['itemUniId'],
|
||||
$transParams['itemId']
|
||||
$transParams['itemId'],
|
||||
$transParams['result']
|
||||
);
|
||||
if ($cb) {
|
||||
$cb($transId);
|
||||
|
@ -46,7 +46,7 @@ class Transaction extends BaseModel {
|
||||
return $row;
|
||||
}
|
||||
|
||||
public static function add($transId, $action, $tokenId, $tokenType, $itemUniId, $itemId)
|
||||
public static function add($transId, $action, $tokenId, $tokenType, $itemUniId, $itemId, $result)
|
||||
{
|
||||
SqlHelper::insert(
|
||||
myself()->_getSelfMysql(),
|
||||
@ -59,6 +59,7 @@ class Transaction extends BaseModel {
|
||||
'token_type' => $tokenType,
|
||||
'item_uniid' => $itemUniId,
|
||||
'item_id' => $itemId,
|
||||
'result' => $result,
|
||||
'status' => self::CREATED_STATUS,
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user