From f6873d5ed02b88e0a0be46ba78832ebf246baa2f Mon Sep 17 00:00:00 2001 From: xindan <2499232802@qq.com> Date: Thu, 30 Sep 2021 15:23:01 +0800 Subject: [PATCH] =?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 | 8 ++++---- app/service/GoodsService.php | 18 ++++++++++++++---- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/app/service/BuyService.php b/app/service/BuyService.php index 4fc2cf3c5..e5a193eba 100755 --- a/app/service/BuyService.php +++ b/app/service/BuyService.php @@ -287,22 +287,22 @@ class BuyService if($v['is_delete_time'] != 0) { $v['is_error'] = 1; - $v['error_msg'] = '商品已作废'; + $v['error_msg'] = '已作废'; } if(empty($v['error_msg']) && $v['is_invalid'] == 1) { $v['is_error'] = 1; - $v['error_msg'] = '商品已失效'; + $v['error_msg'] = '已失效'; } if(empty($v['error_msg']) && $v['is_shelves'] != 1) { $v['is_error'] = 1; - $v['error_msg'] = '商品已下架'; + $v['error_msg'] = '已下架'; } if(empty($v['error_msg']) && $v['inventory'] <= 0) { $v['is_error'] = 1; - $v['error_msg'] = '商品没货了'; + $v['error_msg'] = '没货了'; } if(empty($v['error_msg'])) { diff --git a/app/service/GoodsService.php b/app/service/GoodsService.php index 1bd60eb6c..50225d8f7 100755 --- a/app/service/GoodsService.php +++ b/app/service/GoodsService.php @@ -2602,7 +2602,7 @@ class GoodsService } // 仅可单独购买 - return DataReturn('仅单独购买', -1, $site_type); + return DataReturn('仅单买', -1, $site_type); } /** @@ -2724,10 +2724,20 @@ class GoodsService } // 返回数据 + $count = 0; + $types = []; + if(!empty($data) && is_array($data)) + { + $count = count($data); + $types = array_column($data, 'type'); + } return [ - 'count' => (!empty($data) && is_array($data)) ? count($data) : 0, - 'data' => $data, - 'error' => $error, + 'data' => $data, + 'count' => $count, + 'error' => $error, + 'is_buy' => in_array('buy', $types) ? 1 : 0, + 'is_cart' => in_array('cart', $types) ? 1 : 0, + 'is_show' => in_array('show', $types) ? 1 : 0, ]; }