StarClassData.php 3.72 KB
<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016-4-12
 * Time: 13:21
 */

namespace LibModels\Wap\Guang;

use Api\Sign;
use Api\Yohobuy;
/**
 * Class StarClassData
 * 星潮教室相关接口
 * @package LibModels\Wap\Guang
 */
class StarClassData
{

    //用户当前亲密度,排名
    public static function rankInfoDataUrl($uid)
    {
        $param = Yohobuy::param();
        $param['uid'] = $uid;
        $param['method'] = 'app.starClass.rankInfo';
        $param['client_secret'] = Sign::getSign($param);
//print_r($param);
        return Yohobuy::httpBuildQuery(Yohobuy::DEV_API_URL, $param);
    }

    /**
     * 获取资源位数据(url)
     * @param  string  $contentCode  内容位置码
     * @return array                 首页频道数据
     */
    public static function getResourceDataUrl($contentCode)
    {
        $param = Yohobuy::param();
        $param['content_code'] = $contentCode;
        $param['client_secret'] = Sign::getSign($param);

        return Yohobuy::httpBuildQuery(Yohobuy::DEV_SERVICE_URL . 'operations/api/v5/resource/get', $param);
    }


    /**
     * 获取资源位数据
     * @param  string  $contentCode  内容位置码
     * @return array                 首页频道数据
     */
    public static function getResourceData($contentCode)
    {
        $param = Yohobuy::param();
        $param['content_code'] = $contentCode;
        $param['client_secret'] = Sign::getSign($param);

        return Yohobuy::get(Yohobuy::DEV_SERVICE_URL . 'operations/api/v5/resource/get', $param);
    }


    /**
     *星潮教室-签到
     */
    public static function sign($uid)
    {
        $param = Yohobuy::param();
        $param['method'] = 'app.starClass.sign';
        $param['uid'] = $uid;
        $param['client_secret'] = Sign::getSign($param);

        return Yohobuy::get(Yohobuy::DEV_API_URL, $param);
    }

    /**
     * 星潮教室-星搭配文章
     */
    public static function collocationData($page)
    {
        $param = Yohobuy::param();
        $param['page'] = $page;
        $param['client_secret'] = Sign::getSign($param);
//print_r($param);
        return Yohobuy::get(Yohobuy::DEV_SERVICE_URL . 'guang/api/v5/article/getStarClassroomArticleList', $param);
    }

    /**
     * 点赞
     */
    public static function setPraise($articleId, $udid)
    {
        $param = Yohobuy::param();
        $param['articleId'] = $articleId;
        $param['udid'] = $udid;
        $param['client_secret'] = Sign::getSign($param);

        return Yohobuy::get(Yohobuy::DEV_SERVICE_URL . 'guang/api/v5/praise/setPraise', $param);
    }

    /**
     * 转发
     */
    public static function forward($uid)
    {
        $param = Yohobuy::param();
        $param['method'] = 'app.starClass.forward';
        $param['uid'] = $uid;
        $param['client_secret'] = Sign::getSign($param);

        return Yohobuy::get(Yohobuy::DEV_API_URL, $param);
    }

    /**
     * 收藏资讯文章
     */
    public static function setFavorite($articleId, $uid, $type)
    {
        if (!empty($type) && $type == 'fav') {
            $url = '/guang/api/v5/favorite/setFavorite';
        }elseif($type == 'del'){
            $url = '/guang/api/v5/favorite/cancelFavorite';
        }

        $param = Yohobuy::param();
        $param['articleId'] = $articleId;
        $param['uid'] = $uid;
        $param['client_secret'] = Sign::getSign($param);

        return Yohobuy::get(Yohobuy::DEV_SERVICE_URL . $url, $param);
    }


    /**
     * 排名前100
     */
    public static function Top()
    {
        $param = Yohobuy::param();
        $param['method'] = 'app.starClass.top100';
        $param['client_secret'] = Sign::getSign($param);

        return Yohobuy::get(Yohobuy::DEV_API_URL, $param);
    }
}