diff --git a/webapp/controller/RestApiController.class.php b/webapp/controller/RestApiController.class.php index a4376bbe..25e83803 100644 --- a/webapp/controller/RestApiController.class.php +++ b/webapp/controller/RestApiController.class.php @@ -58,7 +58,7 @@ class RestApiController extends BaseController { ); array_push($info['attributes'],array( "trait_type" => "level", - "value" => $heroDb['hero_lv'], + "value" => intval($heroDb['hero_lv']), "max_value" => 15, )); $randAttr = emptyReplace(json_decode($heroDb['rand_attr'], true), array()); @@ -67,21 +67,21 @@ class RestApiController extends BaseController { case kHAT_Hp : { array_push($info['attributes'],array( "trait_type" => "Hp", - "value" => $attr['val'], + "value" => intval($attr['val']), )); } break; case kHAT_Atk : { array_push($info['attributes'],array( "trait_type" => "Atk", - "value" => $attr['val'], + "value" => intval($attr['val']), )); } break; case kHAT_Def : { array_push($info['attributes'],array( "trait_type" => "Def", - "value" => $attr['val'], + "value" => intval($attr['val']), )); } } diff --git a/webapp/services/FormulaService.php b/webapp/services/FormulaService.php index 57578681..17a796f5 100644 --- a/webapp/services/FormulaService.php +++ b/webapp/services/FormulaService.php @@ -339,7 +339,7 @@ class FormulaService extends BaseService { public static function calcBattleAfterRankScore($userDb,$params,$winningPro){ /**一个玩家的赛后积分 = 赛前积分+K*(胜负率-总胜率)+2K*(表现分-段位要求的及格分)*/ //胜负率=1-(排名-1)/(最大排名-1) - $ranked = getXVal($params, 'ranked'); + $ranked = getXVal($params, 'pvp_personal_rank'); $teamRank = getXVal($params, 'pvp_team_rank'); $meta1 = mt\Parameter::getByName('rank_order_max'); $maxRanked = $meta1 ? $meta1['param_value'] : 40; //************** parameter 参数表获取 ************ diff --git a/webapp/services/callback/MintNftHero.php b/webapp/services/callback/MintNftHero.php index 6bd5dbe8..5d58c324 100644 --- a/webapp/services/callback/MintNftHero.php +++ b/webapp/services/callback/MintNftHero.php @@ -28,7 +28,7 @@ class MintNftHero $tokenId = getReqVal('tokenId', ''); if (!$tokenId){ echo json_encode(array( - 'errcode' => 1, + 'errcode' => 2, 'errmsg' => "tokenId empty", )); die; @@ -37,7 +37,7 @@ class MintNftHero $itemMeta = Item::get($itemId); if (!$itemMeta || $itemMeta['type'] != Item::HERO_TYPE){ echo json_encode(array( - 'errcode' => 1, + 'errcode' => 2, 'errmsg' => "itemId error", )); die; @@ -51,19 +51,65 @@ class MintNftHero self::TYPE_5, ))){ echo json_encode(array( - 'errcode' => 1, + 'errcode' => 2, 'errmsg' => "quality error", )); die; } error_log("MintNftHero-------------------".json_encode($_REQUEST)); - $this->internalAddHero($tokenId,$itemId,$quality); + if (!$this->verifyNftTokenId($tokenId)){ + error_log("The token id does not exist"); + echo json_encode(array( + 'errcode' => 2, + 'errmsg' => "tokenId error", + )); + die; + } + if ($this->verifyHeroTokenId($tokenId)){ + error_log("An existing token"); + echo json_encode(array( + 'errcode' => 1, + 'errmsg' => "tokenId error", + )); + die; + } + + + // // $this->internalAddHero($tokenId,$itemId,$quality); echo json_encode(array( 'errcode' => 0, 'errmsg' => "callback success", )); } + private function verifyNftTokenId($tokenId){ + $row = SqlHelper::ormSelectOne( + myself()->_getMarketMysql(''), + 't_nft', + array( + 'token_id' => $tokenId + ) + ); + if ($row){ + return true; + } + return false; + } + + private function verifyHeroTokenId($tokenId){ + $row = SqlHelper::ormSelectOne( + myself()->_getMysql(''), + 't_hero', + array( + 'token_id' => $tokenId + ) + ); + if ($row){ + return true; + } + return false; + } + private function internalAddHero($tokenId,$itemId,$quality) { @@ -135,4 +181,4 @@ class MintNftHero return $attr; } -} \ No newline at end of file +}