$nft['idx'], "owner_address" => $nft['owner_address'], "item_id" => $nft['item_id'], "token_id" => $nft['token_id'], "token_type" => $nft['token_type'], "contract_address" => $nft['contract_address'], 'image' => $image, 'full_image' => $full_image, "details" => array(), ); array_push($listInfo,$info); } } $this->_rspData(array( 'nfts' => $listInfo, )); } public function getWebInfo(){ $channel = getReqVal('channel', ''); $openId = getReqVal('openId', ''); $accountId = BC_POLY_CHANNEL.'_'.$this->_getGameId().'_'.$channel.'_'.$openId; // $userDb = User::find($accountId); // if (!$userDb){ // $this->_rspErr(1, 'user not found'); // return; // } $info = array( 'loginVal' => 0, 'battleTimes' => 0, 'winTimes' => 0, 'kills' => 0, 'getGoldVal' => 0, ); $accountBindDb = SqlHelper::ormSelectOne( myself()->_getMysql($openId), 't_sub_user_bind', array( 'org_account_id' => $accountId, ) ); $accountId = $accountBindDb ? $accountBindDb['cur_account_id'] : $accountId ; $redis = $this->_getRedis($accountId); $lastActiveTime = $redis->get(LAST_ACTIVE_TIME . $accountId); if (!empty($lastActiveTime) && $lastActiveTime > myself()->_getNowDaySeconds()){ $info['loginVal'] = 1; } // $loginDyn = SqlHelper::ormSelectOne( // myself()->_getMysql($openId), // 't_dyndata', // array( // 'account_id' => $accountId, // 'x' => TN_DAILY_LOGINS, // 'y' => 0, // ) // ); // if ($loginDyn){ // $info['loginVal'] = $loginDyn['val']; // if (myself()->_getDaySeconds($loginDyn['modifytime']) < myself()->_getNowDaySeconds()) { // $info['loginVal'] = 0; // } // } $battleDb = SqlHelper::ormSelectOne( myself()->_getMysql($openId), 't_battle', array( 'account_id' => $accountId, ) ); if ($battleDb){ $hisBattleData = json_decode($battleDb['battle_data'], true); $todayBattleData = getXVal($hisBattleData, 'today_data', array()); if (myself()->_getDaySeconds(getXVal($todayBattleData, 'modifytime', 0)) == myself()->_getNowDaySeconds()) { $info['battleTimes'] = getXVal($todayBattleData, "total_battle_times", 0); $info['winTimes'] = getXVal($todayBattleData, "total_special_win_times", 0); $info['kills'] = getXVal($todayBattleData, "total_kills_times", 0); } } $getGoldDyn = SqlHelper::ormSelectOne( myself()->_getMysql($openId), 't_dyndata', array( 'account_id' => $accountId, 'x' => TN_DAILY_GATHER_GOLD, 'y' => 0, ) ); if ($getGoldDyn){ $info['getGoldVal'] = $getGoldDyn['val']; if (myself()->_getDaySeconds($getGoldDyn['modifytime']) < myself()->_getNowDaySeconds()) { $info['getGoldVal'] = 0; } } $this->_rspData(array( 'info' => $info, )); } public function nftMetaView() { $nftType = getReqVal('nft_type', ''); $netId = getReqVal('net_id', ''); $tokenId = getReqVal('token_id', ''); $info = array( "name" => "", "description" => "", "image" => "", "attributes" => array(), ); switch ($nftType) { case 'hero': { $heroDb = Hero::findByTokenId2($tokenId); if (!$heroDb){ echo json_encode($info); die; } $heroMeta = \mt\Hero::get($heroDb['hero_id']); $NftMeta = \mt\NftDesc::getByItemId($heroDb['hero_id']); //https://www.cebg.games/res/nfts/30100.png $info['name'] = $heroMeta['name']; $info['description'] = $NftMeta['desc']; $info['image'] = "https://www.cebg.games/res/nfts/".$heroDb['hero_id'].".png"; array_push($info['attributes'],array( "trait_type" => "level", "value" => intval($heroDb['hero_lv']), "max_value" => 15, )); $randAttr = emptyReplace(json_decode($heroDb['rand_attr'], true), array()); foreach ($randAttr as $attr){ switch ($attr['quality']){ case 1 : $quality = "D";break; case 2 : $quality = "C";break; case 3 : $quality = "B";break; case 4 : $quality = "A";break; case 5 : $quality = "S";break; default : $quality = ""; } switch ($attr['attr_id']){ case kHAT_Hp : { array_push($info['attributes'],array( "trait_type" => "Hp", "value" => $quality, )); } break; case kHAT_Atk : { array_push($info['attributes'],array( "trait_type" => "Atk", "value" => $quality, )); } break; case kHAT_Def : { array_push($info['attributes'],array( "trait_type" => "Def", "value" => $quality, )); } } } } break; } myself()->_rspData($info); } }