diff --git a/app/api/logic/GoodsLogic.php b/app/api/logic/GoodsLogic.php index 05f3edb4..4eab5e20 100755 --- a/app/api/logic/GoodsLogic.php +++ b/app/api/logic/GoodsLogic.php @@ -346,8 +346,6 @@ class GoodsLogic extends Logic // 虚拟浏览量 $goodsDetailArr['clicks'] += $goodsDetailArr['clicks_virtual']; - $goodsDetailArr['platform_shop_note']= ConfigServer::get('website', 'platform_shop_note');//平台商品备注 - // 记录访问足迹 event('Footprint', [ 'type' => FootprintEnum::BROWSE_GOODS, @@ -427,6 +425,7 @@ class GoodsLogic extends Logic $wh = "find_in_set(".$get['platform_cate_id'].", third_cate_id)"; } } + } // 品牌 @@ -519,47 +518,13 @@ class GoodsLogic extends Logic // dump($wh); // dump($where); // dump($order);die; - $cate = []; - if (isset($get['keyword'])) { - $cate = GoodsCategory::where(['is_show' => 1, 'del' => 0]) - ->where([['name', 'like', '%' . trim($get['keyword']) . '%']]) - ->field('id, level') - ->select() - ->toArray(); - } - if (!empty($cate)) { - $where = array_filter($where, function($item) { - return $item[0] !== "name"; - }); - $where = array_values($where); - - $con = array( - 1 => 'first_cate_id', - 2 => 'second_cate_id', - 3 => 'second_cate_id', - ); - foreach ($cate as &$v) { - $list = Goods::with(['shop']) - ->field($field) - ->where($where) - ->where([ - [$con[$v['level']], 'like', '%' . $v['id'] . '%'], - ]) - ->order($order) - ->select(); - } - } else { - $list = Goods::with(['shop']) - ->field($field) - ->where($wh) - ->where($where) - ->order($order) - ->page($get['page_no'], $get['page_size']) - ->select(); - } - - - + $list = Goods::with(['shop']) + ->field($field) + ->where($wh) + ->where($where) + ->order($order) + ->page($get['page_no'], $get['page_size']) + ->select(); // foreach ($list as &$v) { // $v['market_price'] = round($v['min_price'],2); // $v['min_price'] = round(0.88*$v['min_price'],2); @@ -942,20 +907,6 @@ class GoodsLogic extends Logic return []; } - SearchRecord::create([ - 'user_id'=>$user_id, - 'keyword'=>$shop_name, - 'count' => 1, - 'update_time' => time(), - 'del' => 0 - ]); - - $category = GoodsCategory::where(['is_show' => 1, 'del' => 0]) - ->where([['name', 'like', '%' . trim($shop_name) . '%']]) - ->field('id') - ->select() - ->toArray(); - $onSaleWhere = [ 'del' => GoodsEnum::DEL_NORMAL, // 未删除 'status' => GoodsEnum::STATUS_SHELVES, // 上架中 @@ -970,23 +921,19 @@ class GoodsLogic extends Logic $where[] = ['name', 'like', '%' . trim($shop_name) . '%']; - if (empty($category)) { - $goods = Goods::field('id, name') - ->where($onSaleWhere) - ->where($where) - ->order('sort_weight asc, sort asc, id desc') - ->select()->toArray(); - - } else { - foreach ($category as &$v) { - $goods = Goods::where($onSaleWhere) - ->where([['first_cate_id|second_cate_id|third_cate_id', 'like', '%' . $v['id'] . '%']]) - ->order('sort_weight asc, sort asc, id desc') - ->select() - ->toArray(); - } - } + SearchRecord::create([ + 'user_id'=>$user_id, + 'keyword'=>$shop_name, + 'count' => 1, + 'update_time' => time(), + 'del' => 0 + ]); + $goods = Goods::field('id, name') + ->where($onSaleWhere) + ->where($where) + ->order('sort_weight asc, sort asc, id desc') + ->select()->toArray(); if ($goods) { return $goods; }