...
|
...
|
@@ -9,50 +9,79 @@ use Plugin\Helpers; |
|
|
*/
|
|
|
class ShopProcess
|
|
|
{
|
|
|
private static $shopData = array();
|
|
|
/**
|
|
|
* 组织店铺页面数据
|
|
|
* @param array $data 接口返回的店铺页所需数据
|
|
|
* @param int $type 店铺模板id
|
|
|
* @author sefon 2016-4-26 21:56:32
|
|
|
* @return array
|
|
|
*/
|
|
|
public static function formShopData($data)
|
|
|
public static function formShopData($data, $type = 2)
|
|
|
{
|
|
|
$result = array();
|
|
|
foreach ($data as $key => $val) {
|
|
|
if (empty($val) || !is_callable("self::$key")) {
|
|
|
continue;
|
|
|
}
|
|
|
$result[] = self::$key($val);
|
|
|
self::$key($val);
|
|
|
}
|
|
|
return $result;
|
|
|
// print_r($data);
|
|
|
// exit;
|
|
|
return self::$shopData;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 店铺介绍
|
|
|
* 组织店铺装修
|
|
|
* @param array $data
|
|
|
* @author sefon 2016-4-26 22:06:44
|
|
|
* @author sefon 2016-4-26 22:04:04
|
|
|
* @return array
|
|
|
*/
|
|
|
private static function shopInfo($data)
|
|
|
private static function decorator($data)
|
|
|
{
|
|
|
return $data;
|
|
|
if (!isset($data['code']) || $data['code'] != 200 || !isset($data['data']['list']) || empty($data['data']['list'])) {
|
|
|
return;
|
|
|
}
|
|
|
foreach ($data['data']['list'] as $val) {
|
|
|
if (empty($val['resource_data']) || !is_callable("self::$val[resource_name]")) {
|
|
|
continue;
|
|
|
}
|
|
|
self::$val['resource_name'](json_decode($val['resource_data'], true));
|
|
|
}
|
|
|
// print_r($data); exit;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 组织店铺装修
|
|
|
* 店铺Banner
|
|
|
* @param array $data
|
|
|
* @author sefon 2016-4-26 22:04:04
|
|
|
* @author sefon 2016-4-27 08:40:05
|
|
|
* @return array
|
|
|
*/
|
|
|
private static function decretion($data)
|
|
|
private static function shopTopBanner($data)
|
|
|
{
|
|
|
//优惠券
|
|
|
|
|
|
//广告图
|
|
|
|
|
|
//热门分类
|
|
|
foreach ($data as $val) {
|
|
|
self::$shopData['bannerTop']['list'][] = array('url' => '', 'img' => $val['shopSrc']);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//人气单品
|
|
|
/**
|
|
|
* 资源位小图
|
|
|
* @param array $data
|
|
|
* @author sefon 2016-4-27 08:37:30
|
|
|
* @return array
|
|
|
*/
|
|
|
private static function oneRowTwoColImages($data)
|
|
|
{
|
|
|
foreach ($data as $key => $val) {
|
|
|
if (empty($val['data'])) {
|
|
|
continue;
|
|
|
}
|
|
|
foreach ($val['data'] as $val) {
|
|
|
self::$shopData['spring'][] = array(
|
|
|
'url' => $val['url'],
|
|
|
'springType' => $val['src']
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
return $data;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -62,17 +91,47 @@ class ShopProcess |
|
|
* @author sefon 2016-4-26 22:04:04
|
|
|
* @return array
|
|
|
*/
|
|
|
private static function shopBrands($data)
|
|
|
private static function brandBrowse($data)
|
|
|
{
|
|
|
foreach ($data as $val) {
|
|
|
self::$shopData['multi-list'][] = array(
|
|
|
'url' => '',
|
|
|
'img' => $val['brandIco'],
|
|
|
'brandName' => $val['brandName']
|
|
|
);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 热门分类
|
|
|
* @param array $data
|
|
|
* @author sefon 2016-4-27 08:38:36
|
|
|
* @return array
|
|
|
*/
|
|
|
private static function hotRecommend($data)
|
|
|
{
|
|
|
|
|
|
return $data;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 店铺商品列表 可能不需要
|
|
|
* 人气单品
|
|
|
* @param array $data
|
|
|
* @author sefon 2016-4-27 08:38:36
|
|
|
* @return array
|
|
|
*/
|
|
|
private static function products($data)
|
|
|
private static function hotProducts($data)
|
|
|
{
|
|
|
// print_r($data);
|
|
|
foreach ($data as $val) {
|
|
|
echo $val['src'];
|
|
|
self::$shopData['hotList'][] = array(
|
|
|
'url' => $val['url'],
|
|
|
'img' => $val['src'],
|
|
|
'salesPrice' => '¥'.$val['salesPrice'],
|
|
|
'presentPrice' => '¥'.$val['salesPrice']
|
|
|
);
|
|
|
}
|
|
|
|
|
|
return $data;
|
|
|
}
|
...
|
...
|
|