diff --git a/app/controller/api/Demo.php b/app/controller/api/Demo.php index c35b488c..b7f9a2df 100644 --- a/app/controller/api/Demo.php +++ b/app/controller/api/Demo.php @@ -47,7 +47,6 @@ class Demo extends BaseController $files = scandir($directory); $dir = 'def/' . date('Y-m-d'); $upload = UploadService::create(); - /**循环目录 */ foreach ($files as $file) { if ($file === '.' || $file === '..' ||$file ==='__MACOSX') { @@ -60,11 +59,13 @@ class Demo extends BaseController $slider_image = []; $details = []; $sku_arr = []; - - /**清洗图片 */ + /**清洗图片 + * file_two 商品名对应目录 + */ foreach ($files_two as $file_two) { - $arr = explode('.', $file_two); - if (in_array($arr[1], $image_extensions)) { + $arr = $file_two; + + if (in_array($arr, $image_extensions)) { /**首图 */ $images[] = $file_two; if ($image == '' && is_int((int)$arr[0])) { @@ -88,7 +89,7 @@ class Demo extends BaseController $sku_arr[$sku] = $directory . '/' . $file . '/' . $file_two; } }else{ - throw new \think\exception\HttpException(404, '请上传jpg,jpeg,png的图片'); + continue; } } $where = ['mer_id' => $mer_id, 'is_del' => 0]; diff --git a/app/controller/api/store/product/CloudWarehouse.php b/app/controller/api/store/product/CloudWarehouse.php index 14b529d6..be5d6d02 100644 --- a/app/controller/api/store/product/CloudWarehouse.php +++ b/app/controller/api/store/product/CloudWarehouse.php @@ -45,7 +45,9 @@ class CloudWarehouse extends BaseController */ public function index($street_code, $page = 1, $category_id = 0,$location='') { - $cloud_product = Db::name('cloud_product')->where('street_code', $street_code)->where('status', 1)->page($page)->column('product_id'); + $cloud_product = Db::name('cloud_product') + ->where('cate_id',$category_id) + ->where('street_code', $street_code)->where('status', 1)->page($page)->column('product_id'); $where = [ 'is_show' => 1, 'is_used' => 1, @@ -56,13 +58,10 @@ class CloudWarehouse extends BaseController 'product_id'=>$cloud_product ]; if (!$cloud_product && $category_id==0) { - return app('json')->success(['count' => 0, 'list' => []]); } $count = Db::name('cloud_product')->where('street_code', $street_code)->where('status', 1)->count(); - if (!empty($params['category_id'])) { - $where['cate_id'] = $params['category_id']; - } + $products = $this->spuRepository->getApiSearch($where,$page,10, false,true); if($products['list']){ $list=$products['list'];