ListData.php 1.68 KB
<?php

namespace LibModels\Wap\Guang;

use Api\Sign;
use Api\Yohobuy;

/**
 * 逛首页列表相关的数据模型
 * 
 * @name ListData
 * @package LibModels/Wap/Guang
 * @copyright yoho.inc
 * @version 1.0 (2015-10-10 9:54:07)
 * @author fei.hong <fei.hong@yoho.cn>
 */
class ListData
{
    /**
     * 逛分类
     * 
     * 备注: id (0:最新,1:话题,2:搭配,3:潮人,4:潮品,5:小贴士)
     * 
     * @return array
     */
    public static function category()
    {
        return Yohobuy::get(Yohobuy::SERVICE_URL . 'guang/api/v1/category/get');
    }
    
    /**
     * 根据分类进行分组的逛内容列表
     * 
     * @param array $category 分类
     * @param string $gender "1,3"表示男, "2,3"表示女
     * @param int $page 分页第几页, 默认第1页
     * @param int $channel 1表示男, 2表示女
     * @param int $uid 用户ID
     * @param string $udid 客户端cookie唯一标识
     * @return array
     */
    public static function articleGroup($category, $gender, $channel, $uid = 0, $udid, $page = 1)
    {
        $urlList = array();
        $param = array();
        
        foreach ($category as $value) {
            $param = Yohobuy::param();
            $param['gender'] = $gender;
            $param['page'] = $page;
            $param['yh_channel'] = $channel;
            $param['sort_id'] = $value['id'];
            $param['uid'] = $uid;
            $param['udid'] = $udid;
            $param['client_secret'] = Sign::getSign($param);
            
            $urlList[ $value['id'] ] = Yohobuy::httpBuildQuery(Yohobuy::SERVICE_URL . 'guang/api/v2/article/getList', $param);
        } 
        
        return Yohobuy::getMulti($urlList);
    }
    
}