From afe6d300eea0fccb62db4615209c2cac9ed44daa Mon Sep 17 00:00:00 2001 From: gongfuxiang Date: Tue, 5 Apr 2022 17:07:05 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=AD=E7=89=A9=E8=BD=A6=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=A4=84=E7=90=86=E5=88=86=E7=A6=BB+css?= =?UTF-8?q?=E7=BB=86=E8=8A=82=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/service/BuyService.php | 25 +++++++++++++++++++--- public/static/admin/default/css/common.css | 2 +- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/app/service/BuyService.php b/app/service/BuyService.php index 1ef03e790..f89c13210 100755 --- a/app/service/BuyService.php +++ b/app/service/BuyService.php @@ -229,6 +229,7 @@ class BuyService return DataReturn($ret, -1); } + // 获取购物车数据 $where = (!empty($params['where']) && is_array($params['where'])) ? $params['where'] : []; $where['c.user_id'] = $params['user']['id']; @@ -236,6 +237,22 @@ class BuyService $data = Db::name('Cart')->alias('c')->leftJoin('goods g', 'g.id=c.goods_id')->where($where)->field($field)->order('c.id desc')->select()->toArray(); // 数据处理 + $data = self::CartListDataHandle($data, $params); + return DataReturn('操作成功', 0, $data); + } + + /** + * 购物车列表数据处理 + * @author Devil + * @blog http://gong.gg/ + * @version 1.0.0 + * @date 2022-04-05 + * @desc description + * @param [array] $data [购物车数据] + * @param [array] $params [输入参数] + */ + public static function CartListDataHandle($data, $params = []) + { if(!empty($data)) { foreach($data as &$v) @@ -316,8 +333,7 @@ class BuyService } } } - - return DataReturn('操作成功', 0, $data); + return $data; } /** @@ -538,7 +554,7 @@ class BuyService 'is_delete_time' => 0, 'is_shelves' => 1, ], - 'field' => 'id, id AS goods_id, title, images, inventory_unit, buy_min_number, buy_max_number, model', + 'field' => 'id AS goods_id, title, images, inventory_unit, buy_min_number, buy_max_number, model', ]); $ret = GoodsService::GoodsList($goods_params); if(empty($ret['data'][0])) @@ -550,6 +566,9 @@ class BuyService // 规格 $goods['spec'] = self::GoodsSpecificationsHandle($params); + // id处理、避免不同规格导致id一样 + $goods['id'] = md5($goods['goods_id'].(empty($goods['spec']) ? 'default' : implode('', array_column($goods['spec'], 'value')))); + // 获取商品基础信息 $spec_params = array_merge($params, [ 'id' => $goods['goods_id'], diff --git a/public/static/admin/default/css/common.css b/public/static/admin/default/css/common.css index 4626c3271..5c51d4ee2 100755 --- a/public/static/admin/default/css/common.css +++ b/public/static/admin/default/css/common.css @@ -449,7 +449,7 @@ ul {margin-top:0;} */ .am-container {padding-left:0px;padding-right:0px ;} @media only screen and (min-width: 641px) { - .submit { display: none; } + #tree tr .submit { display: none; } #tree tr:hover .submit { display: block !important; } } @media only screen and (min-width: 1025px) {