OptData.php
3.9 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<?php
namespace LibModels\Wap\Guang;
use Api\Yohobuy;
use Api\Sign;
/**
* 逛操作相关的数据模型
*
* @name OptData
* @package LibModels/Wap/Guang
* @copyright yoho.inc
* @version 1.0 (2015-10-10 11:51:16)
* @author fei.hong <fei.hong@yoho.cn>
*/
class OptData
{
/**
* 品牌收藏/取消收藏
*
* @param int $uid 用户ID
* @param int $id 唯一的ID
* @param string $opt 操作(ok:表示确定,cancel:表示取消)
* @return array
*/
public static function favoriteBrand($uid, $id, $opt = 'ok')
{
$param = Yohobuy::param();
$param['uid'] = $uid;
$param['id'] = $id;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(SERVICE_URL.'guang/service/v2/favorite/toggleBrand', $param);
// if ($opt == 'ok') {
// return Yohobuy::yarClient(SERVICE_URL . 'guang/service/v2/favorite/', 'toggleBrand', array($uid, $id));
// } else {
// return Yohobuy::yarClient(SERVICE_URL . 'guang/service/v2/favorite/', 'toggleBrand', array($uid, $id));
// }
}
/**
* 商品收藏/取消收藏
*
* @param int $uid 用户ID
* @param int $skn 商品标识
* @param string $opt 操作(ok:表示确定,cancel:表示取消)
* @return array
*/
public static function favoriteProduct($uid, $skn, $opt = 'ok')
{
$param = Yohobuy::param();
$param['uid'] = $uid;
$param['productSkn'] = $skn;
$param['client_secret'] = Sign::getSign($param);
if ($opt === 'cancel') {
// return Yohobuy::yarClient(SERVICE_URL . 'shops/service/v1/favorite/', 'addUidProductFav', array($uid, $skn));
return Yohobuy::get(SERVICE_URL.'shops/service/v1/favorite/addUidProductFav', $param);
} else {
// return Yohobuy::yarClient(SERVICE_URL . 'shops/service/v1/favorite/', 'delUidProductFav', array($uid, $skn));
return Yohobuy::get(SERVICE_URL.'shops/service/v1/favorite/delUidProductFav', $param);
}
}
/**
* 逛资讯点赞/取消赞
*
* @param int $udid 唯一客户端标识
* @param int $id 唯一资讯的ID
* @param string $opt 操作(ok:表示确定,cancel:表示取消)
* @return array
*/
public static function praiseArticle($udid, $id, $opt = 'ok')
{
$param = Yohobuy::param();
$param['article_id'] = $id;
$param['udid'] = $udid;
$param['client_secret'] = Sign::getSign($param);
if ($opt === 'cancel') {
// return Yohobuy::yarClient(SERVICE_URL . 'guang/service/v2/praise', 'cancelPraise', array($id, $udid));
return Yohobuy::get(SERVICE_URL.'guang/api/v2/praise/cancel', $param);
} else {
// return Yohobuy::yarClient(SERVICE_URL . 'guang/service/v2/praise', 'setPraise', array($id, $udid));
return Yohobuy::get(SERVICE_URL.'guang/api/v2/praise/setPraise', $param);
}
}
/**
* 逛资讯收藏/取消收藏 (APP里调用)
*
* @param int $udid 唯一客户端标识
* @param int $id 唯一资讯的ID
* @param string $opt 操作(ok:表示确定,cancel:表示取消)
* @return array
*/
public static function collectArticle($uid, $id, $opt = 'ok')
{
$param = Yohobuy::param();
$param['article_id'] = $id;
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
if ($opt === 'cancel') {
// return Yohobuy::yarClient(SERVICE_URL . 'guang/service/v2/favorite/', 'cancelFavorite', array($id, $uid));
return Yohobuy::get(SERVICE_URL.'guang/api/v1/favorite/cancelFavorite', $param);
} else {
// return Yohobuy::yarClient(SERVICE_URL . 'guang/service/v2/favorite/', 'setFavorite', array($id, $uid));
return Yohobuy::get(SERVICE_URL.'guang/api/v1/favorite/setFavorite', $param);
}
}
}