提交 bd9119a5 编写于 作者: D Devil

公共分类编辑图片丢失修复

上级 7ef71ed5
......@@ -51,7 +51,7 @@
<!-- save win end -->
<!-- list start -->
<div id="tree" class="am-margin-top-sm" data-additional='[{"field":"icon", "value":"", "type":"input"}, {"field":"icon_url", "value":"{{$attachment_host}}/static/admin/default/images/default-images.jpg", "type":"attr", "tag":"ul.express-icon-images-view li img", "style":"src"}]' data-node-url="{{:MyUrl('admin/express/getnodeson')}}" data-del-url="{{:MyUrl('admin/express/delete')}}" data-popup-tag="#data-save-win">
<div id="tree" class="am-margin-top-sm" data-additional='[{"field":"icon", "value":"", "type":"input"}, {"field":"icon", "value":"{{$attachment_host}}/static/admin/default/images/default-images.jpg", "type":"attr", "tag":"ul.express-icon-images-view li img", "style":"src"}]' data-node-url="{{:MyUrl('admin/express/getnodeson')}}" data-del-url="{{:MyUrl('admin/express/delete')}}" data-popup-tag="#data-save-win">
{{include file="public/loading" /}}
</div>
<!-- list end -->
......
......@@ -112,7 +112,7 @@
<!-- save win end -->
<!-- list start -->
<div id="tree" class="am-margin-top-sm" data-additional='[{"field":"bg_color", "value":"", "type":"input"}, {"field":"bg_color", "value":"", "type":"css", "tag":"button.colorpicker-submit", "style":"background-color"}, {"field":"icon", "value":"", "type":"input"}, {"field":"icon_url", "value":"{{$attachment_host}}/static/admin/default/images/default-images.jpg", "type":"attr", "tag":"ul.goods-category-icon-images-view li img", "style":"src"}, {"field":"big_images", "value":"", "type":"input"}, {"field":"big_images_url", "value":"{{$attachment_host}}/static/admin/default/images/default-images.jpg", "type":"attr", "tag":"ul.goods-category-big_images-images-view li img", "style":"src"}]' data-node-url="{{:MyUrl('admin/goodscategory/getnodeson')}}" data-del-url="{{:MyUrl('admin/goodscategory/delete')}}" data-popup-tag="#data-save-win" data-rank="3">
<div id="tree" class="am-margin-top-sm" data-additional='[{"field":"bg_color", "value":"", "type":"input"}, {"field":"bg_color", "value":"", "type":"css", "tag":"button.colorpicker-submit", "style":"background-color"}, {"field":"icon", "value":"", "type":"input"}, {"field":"icon", "value":"{{$attachment_host}}/static/admin/default/images/default-images.jpg", "type":"attr", "tag":"ul.goods-category-icon-images-view li img", "style":"src"}, {"field":"big_images", "value":"", "type":"input"}, {"field":"big_images", "value":"{{$attachment_host}}/static/admin/default/images/default-images.jpg", "type":"attr", "tag":"ul.goods-category-big_images-images-view li img", "style":"src"}]' data-node-url="{{:MyUrl('admin/goodscategory/getnodeson')}}" data-del-url="{{:MyUrl('admin/goodscategory/delete')}}" data-popup-tag="#data-save-win" data-rank="3">
{{include file="public/loading" /}}
</div>
<!-- list end -->
......
......@@ -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]));
}
/**
......
......@@ -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]));
}
/**
......
......@@ -7,7 +7,7 @@
3. 支付宝支付插件优化
4. 现金支付插件优化、新增自定义支付信息
5. 订单支付状态金额控制开关
6. 搜索页面价格、参数、规格开关控制
6. 搜索页面价格、参数、规格、品牌开关控制
web端
1. 编辑器图片、附件、视频多选支持按照顺序选择插入编辑器
......
......@@ -668,9 +668,9 @@ function TreeItemHtmlHandle(item, id, level, is_add_node, is_delete_all)
son_css = 'padding-left:'+tmp_level+'px;';
}
html += '<span style="'+son_css+'">';
if((item['icon_url'] || null) != null)
if((item['icon'] || null) != null)
{
html += '<a href="'+item['icon_url']+'" target="_blank"><img src="'+item['icon_url']+'" width="20" height="20" class="am-vertical-align-middle am-margin-right-xs" /></a>';
html += '<a href="'+item['icon']+'" target="_blank"><img src="'+item['icon']+'" width="20" height="20" class="am-vertical-align-middle am-margin-right-xs" /></a>';
}
html += '<span>'+(item['name_alias'] || item['name'])+'</span>';
html += '</span>';
......
......@@ -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)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册