Merge branch 'james_bc' of git.kingsome.cn:server/game2006api into james_bc
This commit is contained in:
commit
1c1c828624
1
.gitignore
vendored
1
.gitignore
vendored
@ -22,3 +22,4 @@ nginx.htaccess
|
|||||||
.idea/
|
.idea/
|
||||||
.vscode/
|
.vscode/
|
||||||
webapp/logs
|
webapp/logs
|
||||||
|
._*
|
||||||
|
@ -319,6 +319,8 @@ class Market(object):
|
|||||||
['job_filters', '', '职业过滤(用|分割)'],
|
['job_filters', '', '职业过滤(用|分割)'],
|
||||||
['search_filters', '', '搜索过滤(用|分割)'],
|
['search_filters', '', '搜索过滤(用|分割)'],
|
||||||
['lv_filter', 0, '等级过滤'],
|
['lv_filter', 0, '等级过滤'],
|
||||||
|
['quality_filter', 0, '品阶顾虑'],
|
||||||
|
['durability_filter', 0, '能量过滤'],
|
||||||
['price_filter', '', '价格过滤(用|分割)']
|
['price_filter', '', '价格过滤(用|分割)']
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
@ -345,6 +347,8 @@ class Market(object):
|
|||||||
['job_filters', '', '职业过滤(用|分割)'],
|
['job_filters', '', '职业过滤(用|分割)'],
|
||||||
['search_filters', '', '搜索过滤(用|分割)'],
|
['search_filters', '', '搜索过滤(用|分割)'],
|
||||||
['lv_filter', 0, '等级过滤'],
|
['lv_filter', 0, '等级过滤'],
|
||||||
|
['quality_filter', 0, '品阶顾虑'],
|
||||||
|
['durability_filter', 0, '能量过滤'],
|
||||||
],
|
],
|
||||||
'response': [
|
'response': [
|
||||||
_common.RspHead(),
|
_common.RspHead(),
|
||||||
|
@ -541,7 +541,7 @@ class MarketController extends BaseController {
|
|||||||
myself()->_rspOk();
|
myself()->_rspOk();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getNftListByAccountAndType($account, $type, $order_method, $order_asc, $job, $search, $lv)
|
private function getNftListByAccountAndType($account, $type, $order_method, $order_asc, $job, $search, $lv, $quality, $durability)
|
||||||
{
|
{
|
||||||
$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']);
|
return ($order_asc == 1 ? 1 : -1) * ($b['detail']['hero_lv'] - $a['detail']['hero_lv']);
|
||||||
@ -577,8 +577,11 @@ class MarketController extends BaseController {
|
|||||||
$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 (in_array($row['info']['info']['job'], $job)==false) continue;
|
||||||
if ($row['detail']['hero_lv']<$lv) continue;
|
if ($row['detail']['hero_lv']<$lv) continue;
|
||||||
|
if ($row['detail']['quality']<$quality) continue;
|
||||||
|
if ($row['detail']['hero_tili']<$durability) continue;
|
||||||
if (count($search)>0) {
|
if (count($search)>0) {
|
||||||
if (!(in_array($row['detail']['hero_name'], $search) || in_array($row['detail']['token_id'], $search))) continue;
|
$searchLower = array_map('strtolower', $search);
|
||||||
|
if (!(in_array(strtolower($row['detail']['hero_name']), $searchLower) || in_array(strtolower($row['detail']['token_id']), $searchLower))) continue;
|
||||||
}
|
}
|
||||||
array_push($nfts, $row);
|
array_push($nfts, $row);
|
||||||
}
|
}
|
||||||
@ -602,8 +605,11 @@ class MarketController extends BaseController {
|
|||||||
$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 ($row['detail']['gun_lv']<$lv) continue;
|
||||||
|
if ($row['detail']['quality']<$quality) continue;
|
||||||
|
if ($row['detail']['durability']<$durability) continue;
|
||||||
if (count($search)>0) {
|
if (count($search)>0) {
|
||||||
if (!(in_array($rwo['detail']['gun_name'], $search) || in_array($row['detail']['token_id'], $search))) continue;
|
$searchLower = array_map('strtolower', $search);
|
||||||
|
if (!(in_array(strtolower($row['detail']['gun_name']), $searchLower) || in_array(strtolower($row['detail']['token_id']), $searchLower))) continue;
|
||||||
}
|
}
|
||||||
array_push($nfts, $row);
|
array_push($nfts, $row);
|
||||||
}
|
}
|
||||||
@ -666,17 +672,69 @@ class MarketController extends BaseController {
|
|||||||
$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);
|
$search_filter_array = explode('|', $search_filters);
|
||||||
$lv_filter = getReqVal('lv_filter', 15);
|
$lv_filter = getReqVal('lv_filter', 1);
|
||||||
|
$quality_filter = getReqVal('quality_filter', 1);
|
||||||
|
$durability_filter = getReqVal('durability_filter', 0);
|
||||||
$price_filter = getReqVal('price_filter', '');
|
$price_filter = getReqVal('price_filter', '');
|
||||||
$price_filter_array = explode('|', $price_filter);
|
$price_filter_array = explode('|', $price_filter);
|
||||||
|
|
||||||
|
$job_filter_fn = function ($f) {
|
||||||
|
return '';
|
||||||
|
};
|
||||||
|
$lv_filter_fn = function ($f) {
|
||||||
|
$f = (int) $f;
|
||||||
|
return 'AND c_lv>=' . $f. ' ';
|
||||||
|
};
|
||||||
|
$quality_filter_fn = function ($f) {
|
||||||
|
$f = (int) $f;
|
||||||
|
return 'AND c_quality>=' . $f. ' ';
|
||||||
|
};
|
||||||
|
$durability_filter_fn = function ($f) {
|
||||||
|
$f = (int) $f;
|
||||||
|
return 'AND c_durability>=' . $f. ' ';
|
||||||
|
};
|
||||||
|
$search_filter_fn = function ($f) {
|
||||||
|
return '';
|
||||||
|
};
|
||||||
|
|
||||||
|
$order_fn = function ($method, $asc) {
|
||||||
|
switch ($method) {
|
||||||
|
case 2:
|
||||||
|
return 'ORDER BY s_price ' . ($asc == 0 ? 'ASC' : 'DESC' . ' ');
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
return 'ORDER BY c_quality ' . ($asc == 0 ? 'ASC' : 'DESC' . ' ');
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
return 'ORDER BY c_lv ' . ($asc == 0 ? 'ASC' : 'DESC' . ' ');
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
return 'ORDER BY c_durability ' . ($asc == 0 ? 'ASC' : 'DESC' . ' ');
|
||||||
|
break;
|
||||||
|
|
||||||
|
// 所有其他不正常的排序都执行最新上架
|
||||||
|
case 1:
|
||||||
|
default:
|
||||||
|
return 'ORDER BY createtime ' . ($asc == 0 ? 'ASC' : 'DESC' . ' ');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return '';
|
||||||
|
};
|
||||||
|
|
||||||
$conn = myself()->_getMysql('');
|
$conn = myself()->_getMysql('');
|
||||||
|
|
||||||
$rows = SqlHelper::ormSelect(
|
$rows = $conn->execQuery(
|
||||||
$conn,
|
'SELECT * FROM t_market_store '.
|
||||||
't_market_store',
|
'WHERE token_type=:token_type '.
|
||||||
|
$job_filter_fn($job_filter_array).
|
||||||
|
$lv_filter_fn($lv_filter).
|
||||||
|
$quality_filter_fn($quality_filter).
|
||||||
|
$durability_filter_fn($durability_filter).
|
||||||
|
$search_filter_fn($search_filter_array).
|
||||||
|
$order_fn($order_method, $order_asc).
|
||||||
|
'LIMIT '.$start.','.$page_size,
|
||||||
array(
|
array(
|
||||||
'token_type' => $type
|
':token_type' => $type,
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -749,9 +807,11 @@ class MarketController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$lv_filter = getReqVal('lv_filter', 15);
|
$lv_filter = getReqVal('lv_filter', 15);
|
||||||
|
$quality_filter = getReqVal('quality_filter', 15);
|
||||||
|
$durability_filter = getReqVal('durability_filter', 15);
|
||||||
$account = '0x9a4d9dd2bfcad659975f0f5a480625c7929e9385';
|
$account = '0x9a4d9dd2bfcad659975f0f5a480625c7929e9385';
|
||||||
|
|
||||||
$rows = $this->getNftListByAccountAndType($account, $type, $order_method, $order_asc, $job_filter_array, $search_filter_array, $lv_filter);
|
$rows = $this->getNftListByAccountAndType($account, $type, $order_method, $order_asc, $job_filter_array, $search_filter_array, $lv_filter, $quality_filter, $durability_filter);
|
||||||
|
|
||||||
$total = count($rows);
|
$total = count($rows);
|
||||||
$page_end = $start + $page_size;
|
$page_end = $start + $page_size;
|
||||||
@ -777,6 +837,7 @@ class MarketController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function sellMyNft() {
|
public function sellMyNft() {
|
||||||
|
|
||||||
$account = getReqVal('account', '');
|
$account = getReqVal('account', '');
|
||||||
$token = getReqVal('token', '');
|
$token = getReqVal('token', '');
|
||||||
$nft_token = getReqVal('nft_token', '');
|
$nft_token = getReqVal('nft_token', '');
|
||||||
@ -803,8 +864,10 @@ class MarketController extends BaseController {
|
|||||||
'modifytime' => myself()->_getNowTime(),
|
'modifytime' => myself()->_getNowTime(),
|
||||||
's_price' => $s_price,
|
's_price' => $s_price,
|
||||||
'c_name' => $nftDetail['info']['name'],
|
'c_name' => $nftDetail['info']['name'],
|
||||||
'c_job' => isset($nftDetail['info']['job']) ? $nftDetail['info']['job'] : -1,
|
'c_job' => isset($nftDetail['info']['job']) ? $nftDetail['info']['job'] : 0,
|
||||||
'c_lv' => isset($nftDetail['info']['level']) ? $nftDetail['info']['level'] : -1,
|
'c_lv' => isset($nftDetail['info']['level']) ? $nftDetail['info']['level'] : 0,
|
||||||
|
'c_quality' => isset($nftDetail['info']['quality']) ? $nftDetail['info']['quality'] : 0,
|
||||||
|
'c_durability' => isset($nftDetail['info']['durability']) ? $nftDetail['info']['durability'] : 0,
|
||||||
'c_id' => $nftDetail['item_id'],
|
'c_id' => $nftDetail['item_id'],
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user