ListData.php
1.46 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
<?php
namespace LibModels\Wap\Product;
use Api\Yohobuy;
use Api\Sign;
/**
* 商品列表相关的数据模型
*
* @name ListData
* @package LibModels/Wap/Product
* @copyright yoho.inc
* @version 1.0 (2015-10-15 20:15:02)
* @author fei.hong <fei.hong@yoho.cn>
*/
class ListData
{
const URI_PRODUCT = 'shops/service/v1/product';
/**
* 根据商品SKN获取商品的简要信息
*
* @param array $skns
* @return array
*/
public static function productInfoBySkns($skns)
{
// // 调用搜索接口
// $param = Yohobuy::param();
// $param['method'] = 'app.search.li';
// $param['query'] = implode(' ', $skns);
// $param['limit'] = count($skns);
// $param['order'] = 's_t_desc';
// $param['client_secret'] = Sign::getSign($param);
//
// return Yohobuy::get(API_URL, $param, 3600); // 有缓存1小时
$condition = array();
$condition['query'] = implode(' ', $skns);
$condition['limit'] = count($skns);
$condition['order'] = 's_t_desc';
return SearchData::searchElasticByCondition($condition, 3600); // 有缓存1小时
}
/**
* 根据商品SKC获取商品的简要信息
*
* @param array $skcs
* @return array
*/
public static function productInfoBySkcs($skcs)
{
return Yohobuy::yarClient(SERVICE_URL . self::URI_PRODUCT, 'getLessInfoByProductSkcs', array(array('productSkcs' => $skcs)));
}
}