Blame view

library/LibModels/Wap/Home/IndexData.php 2.59 KB
1
<?php
hf authored
2
3
namespace LibModels\Wap\Home;
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

use Api\Yohobuy;
use Api\Sign;

/**
 * 首页数据接口操作类
 * 
 * @name IndexData
 * @package Library/LibModels/wap/Home
 * @copyright yoho.inc
 * @version 1.0 (2015-10-9)
 * @author gtskk <rocky.zhang@yoho.cn>
 */
class IndexData
{
hf authored
19 20 21 22

    /**
     * 获取启动轮播图
     * 
23
     * @param  string  $contentCode  内容位置码
hf authored
24 25
     * @return array 轮播图有关数据
     */
26
    public static function getBannerStart($contentCode)
27
    {
hf authored
28 29
        // 构建必传参数
        $param = Yohobuy::param();
30
        $param['content_code'] = $contentCode;
31
        $param['client_secret'] = Sign::getSign($param);
32
33
        return Yohobuy::get(SERVICE_URL . 'operations/api/v5/resource/get', $param);
34 35
    }
hf authored
36 37 38 39 40
    /**
     * 获取启动封面图
     * 
     * @return array 封面图有关数据
     */
41 42
    public static function getCoverStart()
    {
hf authored
43 44 45
        // 构建必传参数
        $param = Yohobuy::param();
        $param['method'] = 'app.cover.getCoverStart';
46
        $param['client_secret'] = Sign::getSign($param);
hf authored
47
48
        return Yohobuy::get(API_URL, $param);
49 50 51 52 53 54 55 56
    }

    /**
     * 获取首页频道数据(除了可能喜欢的各楼层有关数据)
     * @param  string  $gender       用户性别, "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
     * @param  string  $contentCode  内容位置码
     * @param  integer $limit        查询返回的最大限字数,默认为20
     * @param  integer $page         分页第几页,默认为第1页
57 58
     * @param  integer $uid         用户id
     * @modify sefon 2016-4-19 13:33:49
59 60
     * @return array                 首页频道数据
     */
61
    public static function getResourceData($gender, $contentCode, $limit = 20, $page = 1, $uid = 0)
62
    {
hf authored
63
        $param = Yohobuy::param();
64 65 66 67 68 69
        if ($uid) {
            $param['uid'] = $uid;
        } else {
            //新设备(用户未登录状态,默认新设备):Y/N
            $param['new_device'] = 'Y';
        }
hf authored
70 71 72 73 74
        $param['gender'] = $gender;
        $param['content_code'] = $contentCode;
        $param['page'] = $page;
        $param['limit'] = $limit;
        $param['client_secret'] = Sign::getSign($param);
75
        return Yohobuy::get(SERVICE_URL . 'operations/api/v5/resource/home', $param, false, false, 2);
76
    }
77
yangyang authored
78 79 80 81 82 83 84 85 86
    /**
     * 获取频道选择页数据
     * 
     * @return array
     */
    public static function channelData()
    {
        $param = Yohobuy::param();
        $param['client_secret'] = Sign::getSign($param);
87
88
        return Yohobuy::get(SERVICE_URL . 'operations/api/v5/entrance/getEntrance', $param);
yangyang authored
89
    }
hf authored
90
91
}