|
@@ -591,19 +591,33 @@ class ShopModel |
|
@@ -591,19 +591,33 @@ class ShopModel |
591
|
* @param type string $tag 搜索内容
|
591
|
* @param type string $tag 搜索内容
|
592
|
* @return array []
|
592
|
* @return array []
|
593
|
*/
|
593
|
*/
|
594
|
- public static function getArticle($tag = '')
|
594
|
+ public static function getArticle($shopId)
|
595
|
{
|
595
|
{
|
596
|
$result = array();
|
596
|
$result = array();
|
597
|
- if (empty($tag)) {
|
597
|
+ $articleData = array();
|
|
|
598
|
+ $brands = self::getShopsBrands($shopId);
|
|
|
599
|
+ if (empty($brands)) {
|
598
|
return $result;
|
600
|
return $result;
|
599
|
}
|
601
|
}
|
|
|
602
|
+ foreach ($brands as $val) {
|
|
|
603
|
+ $article = GuangListData::getArticleByBrand($val['brand_id'], 3);
|
|
|
604
|
+ if (!empty($article['data'])) {
|
|
|
605
|
+ $articleData = array_merge($articleData, $article['data']);
|
|
|
606
|
+ }
|
|
|
607
|
+
|
|
|
608
|
+ if (count($articleData) > 3) {
|
|
|
609
|
+ break;
|
|
|
610
|
+ }
|
|
|
611
|
+ }
|
600
|
|
612
|
|
601
|
- $article = GuangListData::article('1,2,3', 0, 0, '', 0, $tag, '', 3);
|
|
|
602
|
- if (empty($article['data']['list']['artList'])) {
|
613
|
+ if (empty($articleData)) {
|
603
|
return $result;
|
614
|
return $result;
|
604
|
}
|
615
|
}
|
605
|
|
616
|
|
606
|
- foreach ($article['data']['list']['artList'] as $artList) {
|
617
|
+ foreach ($articleData as $key => $artList) {
|
|
|
618
|
+ if ($key >= 3) {
|
|
|
619
|
+ break;
|
|
|
620
|
+ }
|
607
|
$result['trendList'][] = array(
|
621
|
$result['trendList'][] = array(
|
608
|
'href' => $artList['url'],
|
622
|
'href' => $artList['url'],
|
609
|
'src' => self::imageView2(substr($artList['src'], 0, strpos($artList['src'], '?')), 264, 173),
|
623
|
'src' => self::imageView2(substr($artList['src'], 0, strpos($artList['src'], '?')), 264, 173),
|
|
@@ -611,7 +625,7 @@ class ShopModel |
|
@@ -611,7 +625,7 @@ class ShopModel |
611
|
'Subtitle' => $artList['intro']
|
625
|
'Subtitle' => $artList['intro']
|
612
|
);
|
626
|
);
|
613
|
}
|
627
|
}
|
614
|
-
|
628
|
+ //等于3个才显示
|
615
|
if (count($result['trendList']) < 3) {
|
629
|
if (count($result['trendList']) < 3) {
|
616
|
return array();
|
630
|
return array();
|
617
|
}
|
631
|
}
|