1
This commit is contained in:
parent
d1f09230d6
commit
4d8abbc997
@ -199,6 +199,16 @@ class BlockChainController extends BaseAuthedController {
|
||||
}else{
|
||||
$result = 1;
|
||||
}
|
||||
error_log(
|
||||
json_encode(
|
||||
array(
|
||||
'NftEvent'=> 'Hero',
|
||||
'nft' => $nft1,
|
||||
'probability' => $probability,
|
||||
'result' => $result
|
||||
)
|
||||
)
|
||||
);
|
||||
$this->internalBcCall(
|
||||
array(
|
||||
'c' => 'BcService',
|
||||
@ -263,6 +273,16 @@ class BlockChainController extends BaseAuthedController {
|
||||
}else{
|
||||
$result = 1;
|
||||
}
|
||||
error_log(
|
||||
json_encode(
|
||||
array(
|
||||
'NftEvent'=> 'Gun',
|
||||
'nft' => $nft1,
|
||||
'probability' => $probability,
|
||||
'result' => $result
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$this->internalBcCall(
|
||||
array(
|
||||
@ -328,6 +348,18 @@ class BlockChainController extends BaseAuthedController {
|
||||
}else{
|
||||
$result = 1;
|
||||
}
|
||||
error_log(
|
||||
json_encode(
|
||||
array(
|
||||
'NftEvent'=> 'Chip',
|
||||
'nft' => $nftDb,
|
||||
'upgrade_cost' => $upgrade_cost,
|
||||
'cumulative_cost' => $cumulative_cost,
|
||||
'probability' => $probability,
|
||||
'result' => $result
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$this->internalBcCall(
|
||||
array(
|
||||
|
@ -15,6 +15,7 @@ require_once('models/Gun.php');
|
||||
require_once('models/Chip.php');
|
||||
require_once('models/DynData.php');
|
||||
require_once('models/NftUpReceive.php');
|
||||
require_once('models/Transaction.php');
|
||||
|
||||
require_once('phpcommon/bchelper.php');
|
||||
|
||||
@ -29,6 +30,7 @@ use models\Gun;
|
||||
use models\Chip;
|
||||
use models\DynData;
|
||||
use models\NftUpReceive;
|
||||
use models\Transaction;
|
||||
|
||||
class CallbackController extends BaseController {
|
||||
private $accountId;
|
||||
@ -158,10 +160,28 @@ class CallbackController extends BaseController {
|
||||
myself()->_rspErr(1, 'param error');
|
||||
return;
|
||||
}
|
||||
$tranDb= Transaction::find($transId);
|
||||
if (!$tranDb){
|
||||
myself()->_rspErr(1, 'param error');
|
||||
return;
|
||||
}
|
||||
if (NftUpEvent::find($this->accountId,$transId)){
|
||||
myself()->_rspOk();
|
||||
return;
|
||||
}
|
||||
if (! $tranDb['result']){
|
||||
NftUpEvent::add($this->accountId,
|
||||
array(
|
||||
'trans_id' => $transId,
|
||||
'token_id' => $tokenId1,
|
||||
'value' => 1,
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
)
|
||||
);
|
||||
myself()->_rspOk();
|
||||
return;
|
||||
}
|
||||
$heroDb = SqlHelper::ormSelectOne(
|
||||
myself()->_getMysql($this->accountId),
|
||||
't_hero',
|
||||
@ -222,8 +242,6 @@ class CallbackController extends BaseController {
|
||||
myself()->_rspOk();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function gunUpgradeQuality(){
|
||||
$transId = getReqVal('trans_id', '0');
|
||||
$tokenId1 = getReqVal('token_id1', '0');
|
||||
@ -232,10 +250,28 @@ class CallbackController extends BaseController {
|
||||
myself()->_rspErr(1, 'param error');
|
||||
return;
|
||||
}
|
||||
$tranDb= Transaction::find($transId);
|
||||
if (!$tranDb){
|
||||
myself()->_rspErr(1, 'param error');
|
||||
return;
|
||||
}
|
||||
if (NftUpEvent::find($this->accountId,$transId)){
|
||||
myself()->_rspOk();
|
||||
return;
|
||||
}
|
||||
if (! $tranDb['result']){
|
||||
NftUpEvent::add($this->accountId,
|
||||
array(
|
||||
'trans_id' => $transId,
|
||||
'token_id' => $tokenId1,
|
||||
'value' => 1,
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
)
|
||||
);
|
||||
myself()->_rspOk();
|
||||
return;
|
||||
}
|
||||
$gunDb =SqlHelper::ormSelectOne(
|
||||
myself()->_getMysql($this->accountId),
|
||||
't_gun',
|
||||
@ -300,10 +336,30 @@ class CallbackController extends BaseController {
|
||||
myself()->_rspErr(1, 'param error');
|
||||
return;
|
||||
}
|
||||
|
||||
$tranDb= Transaction::find($transId);
|
||||
if (!$tranDb){
|
||||
myself()->_rspErr(1, 'param error');
|
||||
return;
|
||||
}
|
||||
if (NftUpEvent::find($this->accountId,$transId)){
|
||||
myself()->_rspOk();
|
||||
return;
|
||||
}
|
||||
if (! $tranDb['result']){
|
||||
NftUpEvent::add($this->accountId,
|
||||
array(
|
||||
'trans_id' => $transId,
|
||||
'token_id' => $tokenId,
|
||||
'value' => 1,
|
||||
'createtime' => myself()->_getNowTime(),
|
||||
'modifytime' => myself()->_getNowTime(),
|
||||
)
|
||||
);
|
||||
myself()->_rspOk();
|
||||
return;
|
||||
}
|
||||
|
||||
$chipDb = SqlHelper::ormSelectOne(
|
||||
myself()->_getMysql($this->accountId),
|
||||
't_chip',
|
||||
|
@ -12,6 +12,7 @@ require_once('models/Gun.php');
|
||||
require_once('models/Bag.php');
|
||||
require_once('models/Chip.php');
|
||||
require_once('models/NftUpReceive.php');
|
||||
require_once('models/Transaction.php');
|
||||
|
||||
require_once('services/AwardService.php');
|
||||
require_once('services/PropertyChgService.php');
|
||||
@ -26,6 +27,7 @@ use models\Gun;
|
||||
use models\Bag;
|
||||
use models\Chip;
|
||||
use models\NftUpReceive;
|
||||
use models\Transaction;
|
||||
use services\LogService;
|
||||
|
||||
class GunController extends BaseAuthedController {
|
||||
@ -730,6 +732,11 @@ class GunController extends BaseAuthedController {
|
||||
$this->_rspErr(1, ' error param');
|
||||
return;
|
||||
}
|
||||
$tranDb= Transaction::find($transId);
|
||||
if (!$tranDb){
|
||||
myself()->_rspErr(1, 'param error');
|
||||
return;
|
||||
}
|
||||
Gun::updateByTokenId($tokenId,
|
||||
array(
|
||||
'lock_type' => Gun::NO_LOCK,
|
||||
@ -737,16 +744,23 @@ class GunController extends BaseAuthedController {
|
||||
)
|
||||
);
|
||||
$newGunDb = Gun::findByTokenId2($tokenId);
|
||||
if (! $tranDb['result']){
|
||||
$newGun = Gun::toDto($newGunDb);
|
||||
$oldGun = $newGun;
|
||||
}else{
|
||||
$newGun = Gun::toDto($newGunDb);
|
||||
$newGunDb['quality'] -= 1;
|
||||
$oldGun = Gun::toDto($newGunDb);
|
||||
}
|
||||
|
||||
NftUpReceive::setAccountIdNull(myself()->_getAccountId(),$transId);
|
||||
$propertyChgService = new services\PropertyChgService();
|
||||
$propertyChgService->addGunChg();
|
||||
$this->_rspData(array(
|
||||
'property_chg' => $propertyChgService->toDto(),
|
||||
'new_gun' =>$newGun,
|
||||
'old_gun'=>$oldGun
|
||||
'old_gun'=>$oldGun,
|
||||
'result'=>$tranDb['result']
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ require_once('models/Bag.php');
|
||||
require_once('models/HeroSkin.php');
|
||||
require_once('models/Chip.php');
|
||||
require_once('models/NftUpReceive.php');
|
||||
require_once('models/Transaction.php');
|
||||
|
||||
require_once('services/AwardService.php');
|
||||
require_once('services/PropertyChgService.php');
|
||||
@ -30,6 +31,7 @@ use models\Bag;
|
||||
use models\HeroSkin;
|
||||
use models\Chip;
|
||||
use models\NftUpReceive;
|
||||
use models\Transaction;
|
||||
use services\LogService;
|
||||
|
||||
class HeroController extends BaseAuthedController {
|
||||
@ -893,6 +895,11 @@ class HeroController extends BaseAuthedController {
|
||||
$this->_rspErr(1, ' error param');
|
||||
return;
|
||||
}
|
||||
$tranDb= Transaction::find($transId);
|
||||
if (!$tranDb){
|
||||
myself()->_rspErr(1, 'param error');
|
||||
return;
|
||||
}
|
||||
Hero::updateByTokenId($tokenId,
|
||||
array(
|
||||
'lock_type' => Hero::NO_LOCK,
|
||||
@ -900,9 +907,15 @@ class HeroController extends BaseAuthedController {
|
||||
)
|
||||
);
|
||||
$newHeroDb = Hero::findByTokenId2($tokenId);
|
||||
if (! $tranDb['result']){
|
||||
$newHero = Hero::toDto($newHeroDb);
|
||||
$oldHero = $newHero;
|
||||
}else{
|
||||
$newHero = Hero::toDto($newHeroDb);
|
||||
$newHeroDb['quality'] -= 1;
|
||||
$oldHero = Hero::toDto($newHeroDb);
|
||||
}
|
||||
|
||||
NftUpReceive::setAccountIdNull(myself()->_getAccountId(),$transId);
|
||||
|
||||
$propertyChgService = new services\PropertyChgService();
|
||||
@ -910,7 +923,8 @@ class HeroController extends BaseAuthedController {
|
||||
$this->_rspData(array(
|
||||
'property_chg' => $propertyChgService->toDto(),
|
||||
'new_hero' =>$newHero,
|
||||
'old_hero'=>$oldHero
|
||||
'old_hero'=>$oldHero,
|
||||
'result'=>$tranDb['result']
|
||||
));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user