BrandData.php
1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?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
* @param bool $isBrand 是品牌还是商品
* @return array
*/
public static function favorite($id, $uid, $isBrand = true)
{
$param = Yohobuy::param();
$param['method'] = 'app.favorite.add';
$param['id'] = $id;
$param['uid'] = $uid;
$param['type'] = $isBrand ? 'brand' : 'product';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::post(API_URL, $param);
}
/**
* 取消收藏
*
* @param int $id 品牌ID
* @param int $uid 用户ID
* @param bool $isBrand 是品牌还是商品
* @return array
*/
public static function favoriteCancel($id, $uid, $isBrand = true)
{
$param = Yohobuy::param();
$param['method'] = 'app.favorite.cancel';
$param['fav_id'] = $id;
$param['uid'] = $uid;
$param['type'] = $isBrand ? 'brand' : 'product';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::post(API_URL, $param);
}
}