BrandData.php 1.21 KB
<?php

namespace LibModels\Wap\Product;

use Api\Yohobuy;
use Api\Sign;

/**
 * 商品品牌相关的数据模型
 * 
 * @name BrandData
 * @package 
 * @copyright yoho.inc
 * @version 1.0 (2015-10-28 11:12:35)
 * @author fei.hong <fei.hong@yoho.cn>
 */
class BrandData
{

    /**
     * 收藏
     * 
     * @param int $id 品牌ID
     * @param int $uid 用户ID
     * @return array
     */
    public static function favorite($id, $uid)
    {
        $param = Yohobuy::param();
        $param['method'] = 'app.favorite.add';
        $param['id'] = $id;
        $param['uid'] = $uid;
        $param['type'] = 'brand';
        $param['client_secret'] = Sign::getSign($param);

        return Yohobuy::post(Yohobuy::API_URL, $param);
    }

    /**
     * 取消收藏
     * 
     * @param int $id 品牌ID
     * @param int $uid 用户ID
     * @return array
     */
    public static function favoriteCancel($id, $uid)
    {
        $param = Yohobuy::param();
        $param['method'] = 'app.favorite.cancel';
        $param['fav_id'] = $id;
        $param['uid'] = $uid;
        $param['type'] = 'brand';
        $param['client_secret'] = Sign::getSign($param);

        return Yohobuy::post(Yohobuy::API_URL, $param);
    }

}