正在显示
1 个修改的文件
包含
6 行增加
和
5 行删除
| @@ -131,18 +131,19 @@ class IndexController extends BaseController | @@ -131,18 +131,19 @@ class IndexController extends BaseController | ||
| 131 | $count = Product::where('keyword_id','like' ,'%,'.$keywordInfo['id'].',%')->count(); | 131 | $count = Product::where('keyword_id','like' ,'%,'.$keywordInfo['id'].',%')->count(); |
| 132 | $productModel = new Product(); | 132 | $productModel = new Product(); |
| 133 | if($count < 5){ | 133 | if($count < 5){ |
| 134 | - $productList = $productModel->list([],'sort',['thumb','title'],'desc',7); | 134 | + $productList = $productModel->list([],'sort',['thumb','title']); |
| 135 | //获取7个产品主图 | 135 | //获取7个产品主图 |
| 136 | }else{ | 136 | }else{ |
| 137 | - $productList = $productModel->list(['keyword_id'=>['like','%,'.$keywordInfo['id'].',%']],['thumb','title'],'desc',7); | 137 | + $productList = $productModel->list(['keyword_id'=>['like','%,'.$keywordInfo['id'].',%']],['thumb','title']); |
| 138 | } | 138 | } |
| 139 | $product_image = []; | 139 | $product_image = []; |
| 140 | foreach ($productList as $k => $v){ | 140 | foreach ($productList as $k => $v){ |
| 141 | - $product_image[]['title'] = $v['title']; | 141 | + $image = []; |
| 142 | + $image['title'] = $v['title']; | ||
| 142 | if(!empty($v['thumb']) && !empty($v['thumb']['url'])){ | 143 | if(!empty($v['thumb']) && !empty($v['thumb']['url'])){ |
| 143 | - $product_image[]['image'] = ''; | ||
| 144 | - $product_image[]['image'] = getImageUrl($v['thumb']['url']); | 144 | + $image['image'] = getImageUrl($v['thumb']['url']); |
| 145 | } | 145 | } |
| 146 | + $product_image[] = $image; | ||
| 146 | } | 147 | } |
| 147 | $data = [ | 148 | $data = [ |
| 148 | 'title'=>$keywordInfo['title'], | 149 | 'title'=>$keywordInfo['title'], |
-
请 注册 或 登录 后发表评论