修复错误

This commit is contained in:
mkm 2023-11-23 18:19:28 +08:00
parent c08e286f74
commit 5d706254df
2 changed files with 11 additions and 11 deletions

View File

@ -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];

View File

@ -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'];