Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
纵之格
ShopXO
提交
a520bdf4
ShopXO
项目概览
纵之格
/
ShopXO
通知
394
Star
16
Fork
11
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
ShopXO
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a520bdf4
编写于
8月 17, 2020
作者:
D
devil
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
首页分类推荐优化
上级
7baa2d49
变更
7
显示空白变更内容
内联
并排
Showing
7 changed file
with
179 addition
and
153 deletion
+179
-153
application/index/view/default/index/index.html
application/index/view/default/index/index.html
+138
-140
application/service/GoodsService.php
application/service/GoodsService.php
+36
-8
sourcecode/alipay/pages/index/index.axml
sourcecode/alipay/pages/index/index.axml
+1
-1
sourcecode/baidu/pages/index/index.swan
sourcecode/baidu/pages/index/index.swan
+1
-1
sourcecode/qq/pages/index/index.qml
sourcecode/qq/pages/index/index.qml
+1
-1
sourcecode/toutiao/pages/index/index.ttml
sourcecode/toutiao/pages/index/index.ttml
+1
-1
sourcecode/weixin/pages/index/index.wxml
sourcecode/weixin/pages/index/index.wxml
+1
-1
未找到文件。
application/index/view/default/index/index.html
浏览文件 @
a520bdf4
...
...
@@ -139,7 +139,6 @@
<!-- 楼层 -->
{{if !empty($goods_floor_list)}}
{{foreach $goods_floor_list as $key=>$floor}}
{{if isset($floor['is_home_recommended']) and $floor['is_home_recommended'] eq 1}}
<div
id=
"floor{{$key+1}}"
>
<div
class=
"am-container"
>
<div
class=
"items-nav-title"
{{
if
!
empty
($
floor
['
bg_color
'])}}
style=
"border-bottom: 2px solid {{$floor.bg_color}};"
{{/
if
}}
>
...
...
@@ -150,7 +149,7 @@
{{foreach $floor.items as $key=>$category}}
{{if !empty($category['items'])}}
{{foreach $category.items as $keys=>$categorys}}
{{if $key lt 6 and $keys eq 0 and isset($categorys['is_home_recommended']) and $categorys['is_home_recommended'] eq 1
}}
{{if $key lt 6 and $keys eq 0
}}
<a
href=
"{{:MyUrl('index/search/index', ['category_id'=>$categorys['id']])}}"
target=
"_blank"
>
{{$categorys.name}}
</a>
{{/if}}
{{/foreach}}
...
...
@@ -190,7 +189,7 @@
<div
class=
"word"
>
{{if !empty($floor['items'])}}
{{foreach $floor.items as $category_key=>$category}}
{{if $category_key lt 6 and isset($category['is_home_recommended']) and $category['is_home_recommended'] eq 1
}}
{{if $category_key lt 6
}}
<a
href=
"{{:MyUrl('index/search/index', ['category_id'=>$category['id']])}}"
class=
"outer"
target=
"_blank"
>
{{:mb_substr($category['name'], 0, 4, 'utf-8')}}
</a>
{{/if}}
{{/foreach}}
...
...
@@ -330,7 +329,6 @@
{{/php}}
</div>
</div>
{{/if}}
{{/foreach}}
{{/if}}
</div>
...
...
application/service/GoodsService.php
浏览文件 @
a520bdf4
...
...
@@ -60,8 +60,7 @@ class GoodsService
// 从缓存获取
$key
=
config
(
'shopxo.cache_goods_category_key'
);
$data
=
cache
(
$key
);
if
(
empty
(
$data
))
if
(
empty
(
$data
)
||
config
(
'app_debug'
))
{
// 获取分类
$params
[
'where'
]
=
[
'pid'
=>
0
,
'is_enable'
=>
1
];
...
...
@@ -97,12 +96,12 @@ class GoodsService
{
// 一次性查出所有二级下的三级、再做归类、避免sql连接超多
$where
[
'pid'
]
=
array_column
(
$v
[
'items'
],
'id'
);
$items
=
self
::
GoodsCategoryList
(
$where
);
if
(
!
empty
(
$items
))
$items
s
=
self
::
GoodsCategoryList
(
$where
);
if
(
!
empty
(
$items
s
))
{
foreach
(
$v
[
'items'
]
as
&
$vs
)
{
foreach
(
$items
as
$vss
)
foreach
(
$items
s
as
$vss
)
{
if
(
$vs
[
'id'
]
==
$vss
[
'pid'
])
{
...
...
@@ -183,13 +182,42 @@ class GoodsService
// 缓存
$key
=
config
(
'shopxo.cache_goods_floor_list_key'
);
$data
=
cache
(
$key
);
if
(
empty
(
$data
))
if
(
empty
(
$data
)
||
config
(
'app_debug'
)
)
{
// 商品大分类
$
params
[
'where'
]
=
[
'pid'
=>
0
,
'is_home_recommended'
=>
1
,
'is_enable'
=>
1
];
$data
=
self
::
GoodsCategory
(
$params
);
$
where
=
[
'pid'
=>
0
,
'is_home_recommended'
=>
1
,
'is_enable'
=>
1
];
$data
=
self
::
GoodsCategory
List
(
$where
);
if
(
!
empty
(
$data
))
{
$level
=
MyC
(
'common_show_goods_category_level'
,
3
,
true
);
if
(
$level
>
1
)
{
foreach
(
$data
as
&
$c
)
{
$where
[
'pid'
]
=
$c
[
'id'
];
$c
[
'items'
]
=
self
::
GoodsCategoryList
(
$where
);
if
(
!
empty
(
$c
[
'items'
])
&&
$level
>
2
)
{
// 一次性查出所有二级下的三级、再做归类、避免sql连接超多
$where
[
'pid'
]
=
array_column
(
$c
[
'items'
],
'id'
);
$itemss
=
self
::
GoodsCategoryList
(
$where
);
if
(
!
empty
(
$itemss
))
{
foreach
(
$c
[
'items'
]
as
&
$cv
)
{
foreach
(
$itemss
as
$cvv
)
{
if
(
$cv
[
'id'
]
==
$cvv
[
'pid'
])
{
$cv
[
'items'
][]
=
$cvv
;
}
}
}
}
}
}
}
// 根据分类获取楼层商品
foreach
(
$data
as
&
$v
)
{
...
...
sourcecode/alipay/pages/index/index.axml
浏览文件 @
a520bdf4
...
...
@@ -35,7 +35,7 @@
<view class="word" style="background-color:{{floor.bg_color || '#eaeaea'}}">
<view a:if="{{floor.items.length > 0}}">
<block a:for="{{floor.items}}" a:for-index="icx" a:for-item="icv">
<navigator a:if="{{icx < 6
&& icv.is_home_recommended == 1
}}" class="word-icon" url="/pages/goods-search/goods-search?category_id={{icv.id}}" hover-class="none">
<navigator a:if="{{icx < 6}}" class="word-icon" url="/pages/goods-search/goods-search?category_id={{icv.id}}" hover-class="none">
{{icv.name}}
</navigator>
</block>
...
...
sourcecode/baidu/pages/index/index.swan
浏览文件 @
a520bdf4
...
...
@@ -35,7 +35,7 @@
<view class="word" style="background-color:{{floor.bg_color || '#eaeaea'}}">
<view s-if="floor.items.length > 0">
<block s-for="icv, icx in floor.items" s-key="ck">
<navigator s-if="icx < 6
&& icv.is_home_recommended == 1
" class="word-icon" url="/pages/goods-search/goods-search?category_id={{icv.id}}" hover-class="none">
<navigator s-if="icx < 6" class="word-icon" url="/pages/goods-search/goods-search?category_id={{icv.id}}" hover-class="none">
{{icv.name}}
</navigator>
</block>
...
...
sourcecode/qq/pages/index/index.qml
浏览文件 @
a520bdf4
...
...
@@ -35,7 +35,7 @@
<
view
class
=
"
word
"
style
=
"
background-color:{{floor.bg_color || '#eaeaea'}}
"
>
<
view
qq
:
if
=
"
{{floor.items.length > 0}}
"
>
<
block
qq
:
for
=
"
{{floor.items}}
"
qq
:
key
=
"
ck
"
qq
:
for
-
index
=
"
icx
"
qq
:
for
-
item
=
"
icv
"
>
<
navigator
qq
:
if
=
"
{{icx < 6
&& icv.is_home_recommended == 1
}}
"
class
=
"
word-icon
"
url
=
"
/pages/goods-search/goods-search?category_id={{icv.id}}
"
hover
-
class
=
"
none
"
>
<
navigator
qq
:
if
=
"
{{icx < 6}}
"
class
=
"
word-icon
"
url
=
"
/pages/goods-search/goods-search?category_id={{icv.id}}
"
hover
-
class
=
"
none
"
>
{{
icv
.
name
}}
<
/navigator
>
<
/block
>
...
...
sourcecode/toutiao/pages/index/index.ttml
浏览文件 @
a520bdf4
...
...
@@ -38,7 +38,7 @@
<view class="word" style="background-color:{{floor.bg_color || '#eaeaea'}}">
<view tt:if="{{floor.items.length > 0}}">
<block tt:for="{{floor.items}}" tt:key="ck" tt:for-index="icx" tt:for-item="icv">
<navigator tt:if="{{icx < 6
&& icv.is_home_recommended == 1
}}" class="word-icon" url="/pages/goods-search/goods-search?category_id={{icv.id}}" hover-class="none">
<navigator tt:if="{{icx < 6}}" class="word-icon" url="/pages/goods-search/goods-search?category_id={{icv.id}}" hover-class="none">
{{icv.name}}
</navigator>
</block>
...
...
sourcecode/weixin/pages/index/index.wxml
浏览文件 @
a520bdf4
...
...
@@ -35,7 +35,7 @@
<view class="word" style="background-color:{{floor.bg_color || '#eaeaea'}}">
<view wx:if="{{floor.items.length > 0}}">
<block wx:for="{{floor.items}}" wx:key="ck" wx:for-index="icx" wx:for-item="icv">
<navigator wx:if="{{icx < 6
&& icv.is_home_recommended == 1
}}" class="word-icon" url="/pages/goods-search/goods-search?category_id={{icv.id}}" hover-class="none">
<navigator wx:if="{{icx < 6}}" class="word-icon" url="/pages/goods-search/goods-search?category_id={{icv.id}}" hover-class="none">
{{icv.name}}
</navigator>
</block>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录