Merge branch 'james_bc' of git.kingsome.cn:server/game2006api into james_bc

This commit is contained in:
hujiabin 2022-12-12 14:26:00 +08:00
commit 77bbc62d11
2 changed files with 52 additions and 23 deletions

View File

@ -542,23 +542,31 @@ class MarketController extends BaseController {
myself()->_rspOk(); myself()->_rspOk();
} }
private function getNftListByAccountAndType($account, $type, $order_method, $order_asc) private function getNftListByAccountAndType($account, $type, $order_method, $order_asc, $job, $search, $lv)
{ {
$sortByLevel = function ($a, $b) use ($order_asc) { $sortByLevel = function ($a, $b) use ($order_asc) {
return ($order_asc == 1 ? 1 : -1) * ($b['detail']['hero_lv'] - $a['detail']['hero_lv']);
};
$sortByGunLv = function ($a, $b) use($order_asc) {
return ($order_asc == 1 ? 1 : -1) * ($b['detail']['gun_lv'] - $a['detail']['gun_lv']);
};
$sortByTili = function ($a, $b) use($order_asc) {
return ($order_asc == 1 ? 1 : -1) * ($b['detail']['hero_tili'] - $a['detail']['hero_tili']);
}; };
$sortByStar = function ($a, $b) use($order_asc) { $sortByStar = function ($a, $b) use($order_asc) {
return ($order_asc == 1 ? 1 : -1) * ($b['detail']['quality'] - $a['detail']['quality']);
};
$sortByDurability = function ($a, $b) use($order_asc) {
return ($order_asc == 1 ? 1 : -1) * ($b['detail']['durability_max'] - $a['detail']['durability_max']);
}; };
$sortByPower = function ($a, $b) use($order_asc) { $sortByPower = function ($a, $b) use($order_asc) {
return ($order_asc == 1 ? 1 : -1) * ($b['detail']['strength'] - $a['detail']['strength']);
};
$sortByGrade = function ($a, $b) use($order_asc) {
return ($order_asc == 1 ? 1 : -1) * ($b['detail']['chip_grade'] - $a['detail']['chip_grade']);
}; };
$sortByTokenId = function ($a, $b) use ($order_asc) { $sortByTokenId = function ($a, $b) use ($order_asc) {
if ($order_asc == 1) { return ($order_asc == 1 ? 1 : -1) * ($b['token_id'] - $a['token_id']);
return $b['token_id'] - $a['token_id'];
} else {
return $a['token_id'] - $b['token_id'];
}
}; };
$nfts = array(); $nfts = array();
switch ($type) { switch ($type) {
@ -568,16 +576,22 @@ class MarketController extends BaseController {
$nftDb = Nft::getNft($row['token_id']); $nftDb = Nft::getNft($row['token_id']);
$row['info'] = Nft::toDto($nftDb); $row['info'] = Nft::toDto($nftDb);
$row['detail'] = Hero::toDtoInfo(Hero::findByTokenId2($row['token_id'])); $row['detail'] = Hero::toDtoInfo(Hero::findByTokenId2($row['token_id']));
if (in_array($row['info']['info']['job'], $job)==false) continue;
if ($row['detail']['hero_lv']<$lv) continue;
if (count($search)>0) {
if (!(in_array($row['detail']['hero_name'], $search) || in_array($row['detail']['token_id'], $search))) continue;
}
array_push($nfts, $row);
} }
switch ($order_method) { switch ($order_method) {
case 1: case 1:
usort($rows, $sortByLevel); usort($nfts, $sortByLevel);
break; break;
case 2: case 2:
usort($rows, $sortByPower); usort($nfts, $sortByTili);
break; break;
case 3: case 3:
usort($rows, $sortByStar); usort($nfts, $sortByStar);
break; break;
} }
} }
@ -588,16 +602,21 @@ class MarketController extends BaseController {
$nftDb = Nft::getNft($row['token_id']); $nftDb = Nft::getNft($row['token_id']);
$row['info'] = Nft::toDto($nftDb); $row['info'] = Nft::toDto($nftDb);
$row['detail'] = Gun::toDtoInfo(Gun::findByTokenId2($row['token_id'])); $row['detail'] = Gun::toDtoInfo(Gun::findByTokenId2($row['token_id']));
if ($row['detail']['gun_lv']<$lv) continue;
if (count($search)>0) {
if (!(in_array($rwo['detail']['gun_name'], $search) || in_array($row['detail']['token_id'], $search))) continue;
}
array_push($nfts, $row);
} }
switch ($order_method) { switch ($order_method) {
case 1: case 1:
usort($rows, $sortByLevel); usort($nfts, $sortByGunLv);
break; break;
case 2: case 2:
usort($rows, $sortByPower); usort($nfts, $sortByDurability);
break; break;
case 3: case 3:
usort($rows, $sortByStar); usort($nfts, $sortByStar);
break; break;
} }
} }
@ -606,27 +625,33 @@ class MarketController extends BaseController {
$rows = Nft::getNft1155List($account, $type); $rows = Nft::getNft1155List($account, $type);
foreach ($rows as &$row) { foreach ($rows as &$row) {
$row['detail'] = Chip::toDto(Chip::getChipByTokenId($row['token_id'])); $row['detail'] = Chip::toDto(Chip::getChipByTokenId($row['token_id']));
if ($row['detail']['chip_grade']<$lv) continue;
if (count($search)>0) {
if (!(in_array($row['detail']['token_id'], $search))) continue;
}
array_push($nfts, $row);
} }
switch ($order_method) { switch ($order_method) {
case 1: case 1:
usort($rows, $sortByLevel); usort($nfts, $sortByGrade);
break; break;
case 2: case 2:
usort($rows, $sortByPower); usort($nfts, $sortByPower);
break; break;
} }
} }
break; break;
case 4: { case 4: {
$rows = Nft::getNft1155List($account, $type); $rows = Nft::getNft1155List($account, $type);
usort($rows, $sortByTokenId); usort($nfts, $sortByTokenId);
$nfts = $rows;
} }
break; break;
default: { default: {
$rows = array();
} }
} }
return $rows; return $nfts;
} }
public function listSellNfts() public function listSellNfts()
@ -714,11 +739,16 @@ class MarketController extends BaseController {
$job_filters = getReqVal('job_filters', ''); $job_filters = getReqVal('job_filters', '');
$job_filter_array = explode('|', $job_filters); $job_filter_array = explode('|', $job_filters);
$search_filters = getReqVal('search_filters', ''); $search_filters = getReqVal('search_filters', '');
$search_filter_array = explode('|', $search_filters); if ($search_filters!='') {
$search_filter_array = explode('|', $search_filters);
} else {
$search_filter_array = array();
}
$lv_filter = getReqVal('lv_filter', 15); $lv_filter = getReqVal('lv_filter', 15);
$account = '0x9a4d9dd2bfcad659975f0f5a480625c7929e9385'; $account = '0x9a4d9dd2bfcad659975f0f5a480625c7929e9385';
$rows = $this->getNftListByAccountAndType($account, $type); $rows = $this->getNftListByAccountAndType($account, $type, $order_method, $order_asc, $job_filter_array, $search_filter_array, $lv_filter);
$total = count($rows); $total = count($rows);
$page_end = $start + $page_size; $page_end = $start + $page_size;

View File

@ -279,7 +279,6 @@ class RankingController extends BaseAuthedController {
private function calcCECSeasonAward($seasonId){ private function calcCECSeasonAward($seasonId){
$data = SeasonRanking::getDataBySeasonId($seasonId); $data = SeasonRanking::getDataBySeasonId($seasonId);
error_log(json_encode($data));
$rewardParamMeta = \mt\Parameter::getByName('rank_ring_reward'); $rewardParamMeta = \mt\Parameter::getByName('rank_ring_reward');
$rewardParamMetaValue = $rewardParamMeta ? $rewardParamMeta['param_value'] : ''; $rewardParamMetaValue = $rewardParamMeta ? $rewardParamMeta['param_value'] : '';
$rewardList = explode('|',$rewardParamMetaValue); $rewardList = explode('|',$rewardParamMetaValue);