mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2024-12-02 03:48:47 +08:00
细节优化
This commit is contained in:
parent
cca2348344
commit
822b474d06
@ -134,7 +134,7 @@
|
||||
{{/foreach}}
|
||||
|
||||
<div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-left-0">
|
||||
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block">确认</button>
|
||||
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block am-margin-bottom-sm">确认</button>
|
||||
</div>
|
||||
{{else /}}
|
||||
{{include file="public/not_data" /}}
|
||||
|
@ -591,7 +591,12 @@ class BaseLayout
|
||||
case 'goods' :
|
||||
if(!empty($value) && !empty($value['id']))
|
||||
{
|
||||
$url = GoodsService::GoodsUrlCreate($value['id']);
|
||||
// 商品处理
|
||||
$res = GoodsService::GoodsDataHandle([['goods_id'=>$value['id']]], ['data_key_field'=>'goods_id']);
|
||||
if(!empty($res['data']) && !empty($res['data'][0]) && !empty($res['data'][0]['goods_url']))
|
||||
{
|
||||
$url = $res['data'][0]['goods_url'];
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -266,6 +266,9 @@ class BuyService
|
||||
{
|
||||
if(!empty($data))
|
||||
{
|
||||
// 商品处理
|
||||
$res = GoodsService::GoodsDataHandle($data, ['data_key_field'=>'goods_id']);
|
||||
$data = $res['data'];
|
||||
foreach($data as &$v)
|
||||
{
|
||||
// 规格
|
||||
@ -297,16 +300,7 @@ class BuyService
|
||||
$v['extends'] = '';
|
||||
}
|
||||
|
||||
// 无封面图片
|
||||
if(empty($v['images']))
|
||||
{
|
||||
$v['images'] = ResourcesService::AttachmentPathHandle(GoodsService::GoodsImagesCoverHandle($v['goods_id']));
|
||||
}
|
||||
|
||||
// 基础信息
|
||||
$v['goods_url'] = GoodsService::GoodsUrlCreate($v['goods_id']);
|
||||
$v['images_old'] = $v['images'];
|
||||
$v['images'] = ResourcesService::AttachmentPathViewHandle($v['images']);
|
||||
$v['total_price'] = PriceNumberFormat($v['stock']* $v['price']);
|
||||
$v['buy_max_number'] = ($v['buy_max_number'] <= 0) ? $v['inventory']: $v['buy_max_number'];
|
||||
|
||||
|
@ -3065,8 +3065,16 @@ class GoodsService
|
||||
*/
|
||||
public static function GoodsSearchList($params = [])
|
||||
{
|
||||
// 分页
|
||||
$page = max(1, isset($params['page']) ? intval($params['page']) : 1);
|
||||
$page_size = empty($params['page_size']) ? 20 : min(intval($params['page_size']), 100);
|
||||
$page_start = intval(($page-1)*$page_size);
|
||||
|
||||
// 返回格式
|
||||
$result = [
|
||||
'page' => $page,
|
||||
'page_start' => $page_start,
|
||||
'page_size' => $page_size,
|
||||
'page_total' => 0,
|
||||
'total' => 0,
|
||||
'data' => [],
|
||||
@ -3079,11 +3087,8 @@ class GoodsService
|
||||
// 排序
|
||||
$order_by = empty($params['order_by']) ? 'access_count desc, sales_count desc, id desc' : $params['order_by'];
|
||||
|
||||
// 分页计算
|
||||
// 指定字段
|
||||
$field = empty($params['field']) ? '*' : $params['field'];
|
||||
$page = max(1, isset($params['page']) ? intval($params['page']) : 1);
|
||||
$m = empty($params['m']) ? 0 : intval($params['m']);
|
||||
$n = empty($params['n']) ? 20 : intval($params['n']);
|
||||
|
||||
// 商品搜索列表读取前钩子
|
||||
$hook_name = 'plugins_service_goods_search_list_begin';
|
||||
@ -3095,9 +3100,7 @@ class GoodsService
|
||||
'where_keywords' => &$where_keywords,
|
||||
'field' => &$field,
|
||||
'order_by' => &$order_by,
|
||||
'page' => &$page,
|
||||
'm' => &$m,
|
||||
'n' => &$n,
|
||||
'page' => &$result['page'],
|
||||
]);
|
||||
|
||||
// 获取商品总数
|
||||
@ -3111,11 +3114,11 @@ class GoodsService
|
||||
// 查询数据
|
||||
$goods = GoodsService::GoodsDataHandle(Db::name('Goods')->field($field)->where($where_base)->where(function($query) use($where_keywords) {
|
||||
$query->whereOr($where_keywords);
|
||||
})->order($order_by)->limit($m, $n)->select()->toArray());
|
||||
})->order($order_by)->limit($result['page_start'], $result['page_size'])->select()->toArray());
|
||||
|
||||
// 返回数据
|
||||
$result['data'] = $goods['data'];
|
||||
$result['page_total'] = ceil($result['total']/$n);
|
||||
$result['page_total'] = ceil($result['total']/$result['page_size']);
|
||||
}
|
||||
return DataReturn('处理成功', 0, $result);
|
||||
}
|
||||
|
@ -1540,23 +1540,19 @@ class OrderService
|
||||
*/
|
||||
public static function OrderItemList($order_id, $order_model, $status, $pay_status, $is_orderaftersale = 0)
|
||||
{
|
||||
$items = Db::name('OrderDetail')->where(['order_id'=>$order_id])->select()->toArray();
|
||||
if(!empty($items))
|
||||
$data = Db::name('OrderDetail')->where(['order_id'=>$order_id])->select()->toArray();
|
||||
if(!empty($data))
|
||||
{
|
||||
// 虚拟商品取货码
|
||||
$fictitious_value_list = Db::name('OrderFictitiousValue')->where(['order_detail_id'=>array_column($items, 'id')])->column('value', 'order_detail_id');
|
||||
$fictitious_value_list = Db::name('OrderFictitiousValue')->where(['order_detail_id'=>array_column($data, 'id')])->column('value', 'order_detail_id');
|
||||
|
||||
foreach($items as &$vs)
|
||||
// 商品处理
|
||||
$res = GoodsService::GoodsDataHandle($data, ['data_key_field'=>'goods_id']);
|
||||
$data = $res['data'];
|
||||
|
||||
foreach($data as &$vs)
|
||||
{
|
||||
// 商品是否无封面图片
|
||||
if(empty($vs['images']))
|
||||
{
|
||||
$vs['images'] = ResourcesService::AttachmentPathHandle(GoodsService::GoodsImagesCoverHandle($vs['goods_id']));
|
||||
}
|
||||
|
||||
// 商品信息
|
||||
$vs['images'] = ResourcesService::AttachmentPathViewHandle($vs['images']);
|
||||
$vs['goods_url'] = GoodsService::GoodsUrlCreate($vs['goods_id']);
|
||||
// 总价
|
||||
$vs['total_price'] = PriceNumberFormat($vs['buy_number']*$vs['price']);
|
||||
|
||||
// 规格
|
||||
@ -1590,7 +1586,7 @@ class OrderService
|
||||
}
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -160,7 +160,7 @@ class SearchService
|
||||
$where_keywords = [];
|
||||
if(!empty($params['wd']))
|
||||
{
|
||||
$keywords_fields = 'g.title|g.simple_desc';
|
||||
$keywords_fields = 'g.title|g.simple_desc|g.model';
|
||||
if(MyC('home_search_is_keywords_seo_fields') == 1)
|
||||
{
|
||||
$keywords_fields .= '|g.seo_title|g.seo_keywords|g.seo_desc';
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 349 KiB |
Binary file not shown.
After Width: | Height: | Size: 406 KiB |
Loading…
Reference in New Issue
Block a user