diff --git a/application/admin/view/default/goodscategory/index.html b/application/admin/view/default/goodscategory/index.html
index 24f83955a..d08b6360d 100755
--- a/application/admin/view/default/goodscategory/index.html
+++ b/application/admin/view/default/goodscategory/index.html
@@ -112,7 +112,7 @@
-
+
{{include file="public/loading" /}}
diff --git a/application/service/ExpressService.php b/application/service/ExpressService.php
index c62ea07b9..8846c20ea 100755
--- a/application/service/ExpressService.php
+++ b/application/service/ExpressService.php
@@ -73,12 +73,31 @@ class ExpressService
$where['is_enable'] = intval($params['is_enable']);
}
$data = Db::name('Express')->where($where)->field('id,icon,name,sort,is_enable')->order('sort asc')->select();
+ return self::DataHandle($data);
+ }
+
+ /**
+ * 数据处理
+ * @author Devil
+ * @blog http://gong.gg/
+ * @version 1.0.0
+ * @date 2018-09-06
+ * @desc description
+ * @param [array] $data [二维数组]
+ */
+ public static function DataHandle($data)
+ {
if(!empty($data) && is_array($data))
{
foreach($data as &$v)
{
- $v['icon_old'] = $v['icon'];
- $v['icon'] = ResourcesService::AttachmentPathViewHandle($v['icon']);
+ if(is_array($v))
+ {
+ if(array_key_exists('icon', $v))
+ {
+ $v['icon'] = ResourcesService::AttachmentPathViewHandle($v['icon']);
+ }
+ }
}
}
return $data;
@@ -102,11 +121,11 @@ class ExpressService
$data = Db::name('Express')->field($field)->where(['pid'=>$id])->order('sort asc')->select();
if(!empty($data))
{
+ $data = self::DataHandle($data);
foreach($data as &$v)
{
- $v['is_son'] = (Db::name('Express')->where(['pid'=>$v['id']])->count() > 0) ? 'ok' : 'no';
- $v['icon_url'] = ResourcesService::AttachmentPathViewHandle($v['icon']);
- $v['json'] = json_encode($v);
+ $v['is_son'] = (Db::name('Express')->where(['pid'=>$v['id']])->count() > 0) ? 'ok' : 'no';
+ $v['json'] = json_encode($v);
}
return DataReturn('操作成功', 0, $data);
}
@@ -173,7 +192,9 @@ class ExpressService
$data['id'] = $params['id'];
}
}
- return DataReturn('操作成功', 0, json_encode($data));
+
+ $res = self::DataHandle([$data]);
+ return DataReturn('操作成功', 0, json_encode($res[0]));
}
/**
diff --git a/application/service/GoodsService.php b/application/service/GoodsService.php
index 7e8fd8b90..941237360 100755
--- a/application/service/GoodsService.php
+++ b/application/service/GoodsService.php
@@ -46,7 +46,7 @@ class GoodsService
return null;
}
$field = empty($params['field']) ? 'id,pid,icon,name,vice_name,describe,bg_color,big_images,sort,is_home_recommended' : $params['field'];
- $data = self::GoodsCategoryDataDealWith([Db::name('GoodsCategory')->field($field)->where(['is_enable'=>1, 'id'=>intval($params['id'])])->find()]);
+ $data = self::GoodsCategoryDataHandle([Db::name('GoodsCategory')->field($field)->where(['is_enable'=>1, 'id'=>intval($params['id'])])->find()]);
return empty($data[0]) ? null : $data[0];
}
@@ -144,7 +144,7 @@ class GoodsService
$field = empty($params['field']) ? 'id,pid,icon,name,vice_name,describe,bg_color,big_images,sort,is_home_recommended,seo_title,seo_keywords,seo_desc' : $params['field'];
$data = Db::name('GoodsCategory')->field($field)->where($where)->order($order_by)->limit($m, $n)->select();
- return self::GoodsCategoryDataDealWith($data);
+ return self::GoodsCategoryDataHandle($data);
}
/**
@@ -156,7 +156,7 @@ class GoodsService
* @desc description
* @param [array] $data [商品分类数据 二维数组]
*/
- public static function GoodsCategoryDataDealWith($data)
+ public static function GoodsCategoryDataHandle($data)
{
if(!empty($data) && is_array($data))
{
@@ -164,13 +164,12 @@ class GoodsService
{
if(is_array($v))
{
- if(isset($v['icon']))
+ if(array_key_exists('icon', $v))
{
$v['icon'] = ResourcesService::AttachmentPathViewHandle($v['icon']);
}
- if(isset($v['big_images']))
+ if(array_key_exists('big_images', $v))
{
- $v['big_images_old'] = $v['big_images'];
$v['big_images'] = ResourcesService::AttachmentPathViewHandle($v['big_images']);
}
}
@@ -2302,12 +2301,11 @@ class GoodsService
$data = Db::name('GoodsCategory')->field($field)->where(['pid'=>$id])->order('sort asc')->select();
if(!empty($data))
{
+ $data = self::GoodsCategoryDataHandle($data);
foreach($data as &$v)
{
- $v['is_son'] = (Db::name('GoodsCategory')->where(['pid'=>$v['id']])->count() > 0) ? 'ok' : 'no';
- $v['icon_url'] = ResourcesService::AttachmentPathViewHandle($v['icon']);
- $v['big_images_url'] = ResourcesService::AttachmentPathViewHandle($v['big_images']);
- $v['json'] = json_encode($v);
+ $v['is_son'] = (Db::name('GoodsCategory')->where(['pid'=>$v['id']])->count() > 0) ? 'ok' : 'no';
+ $v['json'] = json_encode($v);
}
return DataReturn('操作成功', 0, $data);
}
@@ -2427,7 +2425,8 @@ class GoodsService
// 删除大分类缓存
cache(config('shopxo.cache_goods_category_key'), null);
- return DataReturn('操作成功', 0, json_encode($data));
+ $res = self::GoodsCategoryDataHandle([$data]);
+ return DataReturn('操作成功', 0, json_encode($res[0]));
}
/**
diff --git a/changelog.txt b/changelog.txt
index ca1b34d1f..cee1591b3 100755
--- a/changelog.txt
+++ b/changelog.txt
@@ -7,7 +7,7 @@
3. 支付宝支付插件优化
4. 现金支付插件优化、新增自定义支付信息
5. 订单支付状态金额控制开关
- 6. 搜索页面价格、参数、规格开关控制
+ 6. 搜索页面价格、参数、规格、品牌开关控制
web端
1. 编辑器图片、附件、视频多选支持按照顺序选择插入编辑器
diff --git a/public/static/common/js/common.js b/public/static/common/js/common.js
index ac2f7abbb..e5d05cbc0 100755
--- a/public/static/common/js/common.js
+++ b/public/static/common/js/common.js
@@ -668,9 +668,9 @@ function TreeItemHtmlHandle(item, id, level, is_add_node, is_delete_all)
son_css = 'padding-left:'+tmp_level+'px;';
}
html += '
';
- if((item['icon_url'] || null) != null)
+ if((item['icon'] || null) != null)
{
- html += '
';
+ html += '
';
}
html += ''+(item['name_alias'] || item['name'])+'';
html += '';
diff --git a/public/static/index/default/js/search.js b/public/static/index/default/js/search.js
index daa3094c3..ebf47c88c 100755
--- a/public/static/index/default/js/search.js
+++ b/public/static/index/default/js/search.js
@@ -85,7 +85,13 @@ function GetGoodsList(page)
} else {
Prompt(result.msg);
}
- $('.map-result-count').text(result.data.total || 0);
+
+ // 总数处理
+ var total = result.data.total || 0;
+ if(total > 0 || $('.search-list li').length == 0)
+ {
+ $('.map-result-count').text(total);
+ }
},
error:function(xhr, type)
{