|
...
|
...
|
@@ -131,18 +131,19 @@ class IndexController extends BaseController |
|
|
|
$count = Product::where('keyword_id','like' ,'%,'.$keywordInfo['id'].',%')->count();
|
|
|
|
$productModel = new Product();
|
|
|
|
if($count < 5){
|
|
|
|
$productList = $productModel->list([],'sort',['thumb','title'],'desc',7);
|
|
|
|
$productList = $productModel->list([],'sort',['thumb','title']);
|
|
|
|
//获取7个产品主图
|
|
|
|
}else{
|
|
|
|
$productList = $productModel->list(['keyword_id'=>['like','%,'.$keywordInfo['id'].',%']],['thumb','title'],'desc',7);
|
|
|
|
$productList = $productModel->list(['keyword_id'=>['like','%,'.$keywordInfo['id'].',%']],['thumb','title']);
|
|
|
|
}
|
|
|
|
$product_image = [];
|
|
|
|
foreach ($productList as $k => $v){
|
|
|
|
$product_image[]['title'] = $v['title'];
|
|
|
|
$image = [];
|
|
|
|
$image['title'] = $v['title'];
|
|
|
|
if(!empty($v['thumb']) && !empty($v['thumb']['url'])){
|
|
|
|
$product_image[]['image'] = '';
|
|
|
|
$product_image[]['image'] = getImageUrl($v['thumb']['url']);
|
|
|
|
$image['image'] = getImageUrl($v['thumb']['url']);
|
|
|
|
}
|
|
|
|
$product_image[] = $image;
|
|
|
|
}
|
|
|
|
$data = [
|
|
|
|
'title'=>$keywordInfo['title'],
|
...
|
...
|
|