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();
}
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) {
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) {
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) {
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) {
if ($order_asc == 1) {
return $b['token_id'] - $a['token_id'];
} else {
return $a['token_id'] - $b['token_id'];
}
return ($order_asc == 1 ? 1 : -1) * ($b['token_id'] - $a['token_id']);
};
$nfts = array();
switch ($type) {
@ -568,16 +576,22 @@ class MarketController extends BaseController {
$nftDb = Nft::getNft($row['token_id']);
$row['info'] = Nft::toDto($nftDb);
$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) {
case 1:
usort($rows, $sortByLevel);
usort($nfts, $sortByLevel);
break;
case 2:
usort($rows, $sortByPower);
usort($nfts, $sortByTili);
break;
case 3:
usort($rows, $sortByStar);
usort($nfts, $sortByStar);
break;
}
}
@ -588,16 +602,21 @@ class MarketController extends BaseController {
$nftDb = Nft::getNft($row['token_id']);
$row['info'] = Nft::toDto($nftDb);
$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) {
case 1:
usort($rows, $sortByLevel);
usort($nfts, $sortByGunLv);
break;
case 2:
usort($rows, $sortByPower);
usort($nfts, $sortByDurability);
break;
case 3:
usort($rows, $sortByStar);
usort($nfts, $sortByStar);
break;
}
}
@ -606,27 +625,33 @@ class MarketController extends BaseController {
$rows = Nft::getNft1155List($account, $type);
foreach ($rows as &$row) {
$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) {
case 1:
usort($rows, $sortByLevel);
usort($nfts, $sortByGrade);
break;
case 2:
usort($rows, $sortByPower);
usort($nfts, $sortByPower);
break;
}
}
break;
case 4: {
$rows = Nft::getNft1155List($account, $type);
usort($rows, $sortByTokenId);
usort($nfts, $sortByTokenId);
$nfts = $rows;
}
break;
default: {
$rows = array();
}
}
return $rows;
return $nfts;
}
public function listSellNfts()
@ -714,11 +739,16 @@ class MarketController extends BaseController {
$job_filters = getReqVal('job_filters', '');
$job_filter_array = explode('|', $job_filters);
$search_filters = getReqVal('search_filters', '');
if ($search_filters!='') {
$search_filter_array = explode('|', $search_filters);
} else {
$search_filter_array = array();
}
$lv_filter = getReqVal('lv_filter', 15);
$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);
$page_end = $start + $page_size;

View File

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