...
|
...
|
@@ -4,6 +4,7 @@ namespace LibModels\Wap\Guang; |
|
|
|
|
|
use Api\Sign;
|
|
|
use Api\Yohobuy;
|
|
|
use Plugin\Helpers;
|
|
|
|
|
|
/**
|
|
|
* 明星品牌和原创品牌相关的数据模型
|
...
|
...
|
@@ -17,6 +18,11 @@ use Api\Yohobuy; |
|
|
class PlusstarData
|
|
|
{
|
|
|
|
|
|
const URI_BRANDLIST = 'guang/api/v1/plustar/getlist';
|
|
|
const URI_BRANDINFO_PLUSSTAR = 'guang/service/v1/plustar/';
|
|
|
const URI_BRANDINFO_FAVORITE = 'shops/service/v1/favorite/';
|
|
|
const URI_BRANDINFO_ARTICLE = 'guang/service/v1/article/';
|
|
|
|
|
|
/**
|
|
|
* 品牌列表
|
|
|
*
|
...
|
...
|
@@ -32,7 +38,7 @@ class PlusstarData |
|
|
// 存放接口列表
|
|
|
$urlList = array();
|
|
|
// 接口调用的URL
|
|
|
$url = Yohobuy::SERVICE_URL . 'guang/api/v1/plustar/getlist';
|
|
|
$url = Yohobuy::SERVICE_URL . self::URI_BRANDLIST;
|
|
|
|
|
|
// 公共的参数
|
|
|
$param = Yohobuy::param();
|
...
|
...
|
@@ -80,7 +86,7 @@ class PlusstarData |
|
|
$result['getArticleByBrand'] = array();
|
|
|
|
|
|
// 品牌详情信息
|
|
|
$brandInfo = Yohobuy::yarClient(Yohobuy::SERVICE_URL . 'guang/service/v1/plustar/', 'getBrandInfo', array(array('id' => $id)) );
|
|
|
$brandInfo = Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_PLUSSTAR, 'getBrandInfo', array(array('id' => $id)) );
|
|
|
if (!isset($brandInfo['brand_id'])) {
|
|
|
return $result;
|
|
|
} else {
|
...
|
...
|
@@ -90,14 +96,14 @@ class PlusstarData |
|
|
// 是否收藏店铺
|
|
|
$isUidOk = $uid && is_numeric($uid);
|
|
|
if ($isUidOk) {
|
|
|
Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . 'shops/service/v1/favorite/', 'getUidBrandFav', array($uid, $id), function($retval) use(&$result) {
|
|
|
Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_FAVORITE, 'getUidBrandFav', array($uid, $id), function($retval) use(&$result) {
|
|
|
$result['getUidBrandFav'] = empty($retval['data']) ? false : $retval['data'];
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 相关资讯列表 (3篇)
|
|
|
$result['getArticleByBrand'] = array();
|
|
|
Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . 'guang/service/v1/article/', 'getArticleByBrand', array($brandInfo['brand_id'], 3, $udid), function($retval) use(&$result) {
|
|
|
Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_ARTICLE, 'getArticleByBrand', array($brandInfo['brand_id'], 3, $udid), function($retval) use(&$result) {
|
|
|
$result['getArticleByBrand'] = empty($retval) ? array() : $retval;
|
|
|
});
|
|
|
|
...
|
...
|
@@ -120,24 +126,23 @@ class PlusstarData |
|
|
break;
|
|
|
}
|
|
|
|
|
|
//$result['getNewProduct'] = $newProduct['data']['product_list'];
|
|
|
|
|
|
$skn = '';
|
|
|
foreach ($newProduct['data']['product_list'] as $value) {
|
|
|
if (empty($value['goods_list'])) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
// 商品信息列表
|
|
|
$result['getNewProduct'][] = Helpers::formatProduct($value);
|
|
|
|
|
|
// 用户是否收藏该商品
|
|
|
$skn = $value['product_skn'];
|
|
|
$result['getUidProductFav'][ $skn ] = false;
|
|
|
if ($isUidOk) {
|
|
|
Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . 'shops/service/v1/favorite/', 'getUidProductFav', array($uid, $value['product_skn']), function($retval) use(&$result,&$skn) {
|
|
|
Yohobuy::yarConcurrentCall(Yohobuy::SERVICE_URL . self::URI_BRANDINFO_FAVORITE, 'getUidProductFav', array($uid, $value['product_skn']), function($retval) use(&$result,&$skn) {
|
|
|
$result['getUidProductFav'][ $skn ] = empty($retval['data']) ? false : $retval['data'];
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// @todo 需要根据页面结构封装返回数据
|
|
|
}
|
|
|
} while (false);
|
|
|
|
...
|
...
|
@@ -146,63 +151,8 @@ class PlusstarData |
|
|
|
|
|
return $result;
|
|
|
|
|
|
|
|
|
// @todo 根据页面展示数据封装
|
|
|
// $url = '';
|
|
|
// if($uid > 0){
|
|
|
// $isLike = Favorite::getUidProductFav($uid, $new_goods_info['product_skn']);
|
|
|
// }
|
|
|
// if($client_type == 'web'){
|
|
|
// $baseUrl = QUtilsConfig::$websiteRoot['yohobuy'];
|
|
|
// }else{
|
|
|
// $baseUrl = QUtilsConfig::$websiteRoot['h5'];
|
|
|
// }
|
|
|
// $goods_url = MakeUrl::h5ProductDetailUrl($baseUrl,$new_goods_info['product_id'],$new_goods_info['goods_list'][0]['goods_id'],$new_goods_info['cn_alphabet']);
|
|
|
// $url = MakeUrl::makeUrl('go.productDetail',$goods_url, array('product_skn'=>$new_goods_info['product_skn']),$client_type);
|
|
|
// if((int)$new_goods_info['market_price'] == (int)$new_goods_info['sales_price'])
|
|
|
// {
|
|
|
// $new_goods_info['market_price'] = '';
|
|
|
// }
|
|
|
// $tags = array(
|
|
|
// 'isNew' => false,
|
|
|
// 'isSale' => false,
|
|
|
// 'isLimit' => false,
|
|
|
// 'isYohood' => false,
|
|
|
// 'midYear' => false,
|
|
|
// 'yearEnd' => false,
|
|
|
// );
|
|
|
// foreach ($new_goods_info['tags'] as $v){
|
|
|
// if($v == 'is_new'){
|
|
|
// $tags['isNew'] = true;
|
|
|
// }elseif($v == 'is_discount'){
|
|
|
// $tags['isSale'] = true;
|
|
|
// }elseif($v == 'is_limited'){
|
|
|
// $tags['isLimit'] = true;
|
|
|
// }elseif($v == 'is_yohood'){
|
|
|
// $tags['isYohood'] = true;
|
|
|
// }elseif($v == 'mid-year'){
|
|
|
// $tags['midYear'] = true;
|
|
|
// }elseif($v == 'year-end'){
|
|
|
// $tags['yearEnd'] = true;
|
|
|
// }
|
|
|
// }
|
|
|
// $newPatterns[$new_goods_info['product_skn']]= array (
|
|
|
// 'id'=>$new_goods_info['product_skn'],
|
|
|
// 'product_id'=>$new_goods_info['product_id'],
|
|
|
// 'product_skn'=>$new_goods_info['product_skn'],
|
|
|
// 'thumb' => $new_goods_info['default_images'],
|
|
|
// 'name' => $new_goods_info['product_name'],
|
|
|
// 'isLike' => $isLike,
|
|
|
// 'price' => $new_goods_info['market_price'],
|
|
|
// 'salePrice' => $new_goods_info['sales_price'],
|
|
|
// 'isSale' => $new_goods_info['is_discount'] == 'Y' ? true : false,
|
|
|
// 'isFew' => $new_goods_info['is_soon_sold_out'] == 'Y' ? true : false,
|
|
|
// 'isNew' => $new_goods_info['is_new'] == 'Y' ? true : false,
|
|
|
// 'url' => $url,
|
|
|
// 'tags' => $tags
|
|
|
// );
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|