...
|
...
|
@@ -95,4 +95,79 @@ class IndexModel |
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获取逛首页分类内容列表
|
|
|
*
|
|
|
* @param string $gender "1,3"表示男, "2,3"表示女
|
|
|
* @param int channel APP客户端标识 1表示男,2:表示女,3:潮童,4:创意生活
|
|
|
* @param int type 分类ID 0:最新,1:话题,2:搭配,3:潮人,4:潮品,5:小贴士
|
|
|
* @param int $uid 用户ID
|
|
|
* @param string $udid 客户端唯一标识
|
|
|
* @param int $page 分页第几页, 默认第1页
|
|
|
* @return array
|
|
|
*/
|
|
|
public static function getArticle($gender, $type, $uid, $udid, $page = 1)
|
|
|
{
|
|
|
// 逛首页的分类名称列表
|
|
|
$category = ListData::category();
|
|
|
$article = array();
|
|
|
|
|
|
switch ($gender) {
|
|
|
case '1,3': // 男
|
|
|
$article = ListData::article('1,3', $type, $uid, $udid, $page);
|
|
|
break;
|
|
|
case '2,3': // 女
|
|
|
$article = ListData::article('2,3', $type, $uid, $udid, $page);
|
|
|
break;
|
|
|
default: // 其它所有
|
|
|
$article = ListData::article('1,2,3', $type, $uid, $udid, $page);
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
$data = array();
|
|
|
$build = array();
|
|
|
|
|
|
// 模板中使用JS的标识
|
|
|
$data['guangHome'] = true;
|
|
|
|
|
|
// 顶部的分类列表
|
|
|
if (!empty($category['data'])) {
|
|
|
foreach ($category['data'] as $value) {
|
|
|
$build = array();
|
|
|
$build['typeId'] = $value['id'];
|
|
|
$build['type'] = $value['name'];
|
|
|
$build['focus'] = ($value['id'] == $type);
|
|
|
$data['navs'][] = $build;
|
|
|
|
|
|
$data['guang']['infos'][] = array(
|
|
|
'show' => $build['focus'],
|
|
|
'info' => array(),
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 广告列表
|
|
|
if (!empty($article['data']['list']['adlist'])) {
|
|
|
foreach ($article['data']['list']['adlist'] as $value) {
|
|
|
$build = array();
|
|
|
$build['url'] = Helpers::getFilterUrl($value['url']);
|
|
|
$build['img'] = Helpers::getImageUrl($value['src'], 830, 327);
|
|
|
$data['guang']['swiper'][] = $build;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 内容列表
|
|
|
if (!empty($article['data']['list']['artlist'])) {
|
|
|
$type = intval($type);
|
|
|
foreach ($article['data']['list']['artList'] as $value) {
|
|
|
$data['guang']['infos'][$type]['info'] = Helpers::formatArticle($value, true, false, true);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
$category = array();
|
|
|
$article = array();
|
|
|
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|