布局 url 地址处理优化
parent
3001fa16ca
commit
d46873b5d6
|
|
@ -425,11 +425,16 @@ class BaseLayout
|
||||||
{
|
{
|
||||||
$url = $static_url_arr[$type];
|
$url = $static_url_arr[$type];
|
||||||
} else {
|
} else {
|
||||||
|
// 扩展参数处理
|
||||||
|
if(!empty($value) && !is_array($value))
|
||||||
|
{
|
||||||
|
$value = json_decode(urldecode($value), true);
|
||||||
|
}
|
||||||
switch($type)
|
switch($type)
|
||||||
{
|
{
|
||||||
// 商品
|
// 商品
|
||||||
case 'goods' :
|
case 'goods' :
|
||||||
if(!empty($value) && $value['id'])
|
if(!empty($value) && !empty($value['id']))
|
||||||
{
|
{
|
||||||
$url = ($client_type == 'pc') ? MyUrl('index/goods/index', ['id'=>$value['id']]) : '/pages/goods-detail/goods-detail?goods_id='.$value['id'];
|
$url = ($client_type == 'pc') ? MyUrl('index/goods/index', ['id'=>$value['id']]) : '/pages/goods-detail/goods-detail?goods_id='.$value['id'];
|
||||||
}
|
}
|
||||||
|
|
@ -438,32 +443,25 @@ class BaseLayout
|
||||||
// 商品分类
|
// 商品分类
|
||||||
case 'goods_search' :
|
case 'goods_search' :
|
||||||
$gsp = [];
|
$gsp = [];
|
||||||
if(!empty($value))
|
if(!empty($value) && !empty($value['type']) && !empty($value['value']))
|
||||||
{
|
{
|
||||||
if(!is_array($value))
|
switch($value['type'])
|
||||||
{
|
{
|
||||||
$value = json_decode(urldecode($value), true);
|
// 关键字
|
||||||
}
|
case 'keywords' :
|
||||||
if(!empty($value) && !empty($value['type']) && !empty($value['value']))
|
$gsp = ($client_type == 'pc') ? ['wd'=>StrToAscii($value['value'])] : '?keywords='.$value['value'];
|
||||||
{
|
break;
|
||||||
switch($value['type'])
|
|
||||||
{
|
|
||||||
// 关键字
|
|
||||||
case 'keywords' :
|
|
||||||
$gsp = ($client_type == 'pc') ? ['wd'=>StrToAscii($value['value'])] : '?keywords='.$value['value'];
|
|
||||||
break;
|
|
||||||
|
|
||||||
// 分类
|
// 分类
|
||||||
case 'category' :
|
case 'category' :
|
||||||
$category_id = $value['value'][count($value['value'])-1]['id'];
|
$category_id = $value['value'][count($value['value'])-1]['id'];
|
||||||
$gsp = ($client_type == 'pc') ? ['category_id'=>$category_id] : '?category_id='.$category_id;
|
$gsp = ($client_type == 'pc') ? ['category_id'=>$category_id] : '?category_id='.$category_id;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// 品牌
|
// 品牌
|
||||||
case 'brand' :
|
case 'brand' :
|
||||||
$gsp = ($client_type == 'pc') ? ['brand_id'=>$value['value']['id']] : '?brand_id='.$value['value']['id'];
|
$gsp = ($client_type == 'pc') ? ['brand_id'=>$value['value']['id']] : '?brand_id='.$value['value']['id'];
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 默认搜索页面、无条件
|
// 默认搜索页面、无条件
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue