1
|
<?php
|
1
|
<?php
|
2
|
namespace Plugin\DataProcess\WebChannel;
|
2
|
namespace Plugin\DataProcess\WebChannel;
|
|
|
3
|
+use Plugin\Images;
|
|
|
4
|
+use Plugin\Helpers;
|
3
|
/**
|
5
|
/**
|
4
|
* web版通用处理器
|
6
|
* web版通用处理器
|
5
|
*/
|
7
|
*/
|
|
@@ -46,13 +48,37 @@ class Process |
|
@@ -46,13 +48,37 @@ class Process |
46
|
);
|
48
|
);
|
47
|
}
|
49
|
}
|
48
|
foreach($data['menuNav']['blocks'] as $val) {
|
50
|
foreach($data['menuNav']['blocks'] as $val) {
|
49
|
- $temp['tplrecommend']['keyword'][] = array('href'=> $val['url'],'name'=> $val['title'],'img'=>['src']);
|
51
|
+ $val['img'] = Images::getImageUrl($val['img'], 185, 76, 1);
|
|
|
52
|
+ $val['url'] = Helpers::transUrl($val['url'], $type);
|
|
|
53
|
+ $temp['tplrecommend']['keyword'][] = array('href'=> $val['url'],'name'=> $val['title'], 'img'=>$val['img']);
|
50
|
}
|
54
|
}
|
|
|
55
|
+
|
51
|
foreach($data['menuNav']['list'] as $val) {
|
56
|
foreach($data['menuNav']['list'] as $val) {
|
|
|
57
|
+ if(empty($val['name']) && empty($val['url']))
|
|
|
58
|
+ {
|
|
|
59
|
+ continue;
|
|
|
60
|
+ }
|
|
|
61
|
+ $val['url'] = Helpers::transUrl($val['url'], $type);
|
52
|
$temp['tplrecommend']['category'][] = array('name'=> $val['name'],'url'=> $val['url']);
|
62
|
$temp['tplrecommend']['category'][] = array('name'=> $val['name'],'url'=> $val['url']);
|
53
|
}
|
63
|
}
|
54
|
- foreach($data['imgs'] as $val) {
|
|
|
55
|
- $temp['tplrecommend']['types'][] = array('href'=> $val['url'],'name'=> $val['title'],'img'=>['src']);
|
64
|
+
|
|
|
65
|
+ foreach($data['imgs'] as $key => $val) {
|
|
|
66
|
+ $w = 185; $h = 248;
|
|
|
67
|
+ if($key == 0)
|
|
|
68
|
+ {
|
|
|
69
|
+ $w = 377;
|
|
|
70
|
+ $h = 504;
|
|
|
71
|
+ }
|
|
|
72
|
+ $val['img'] = Images::getImageUrl($val['img'], $w, $h, 1);
|
|
|
73
|
+ $val['url'] = Helpers::transUrl($val['url'], $type);
|
|
|
74
|
+ if($key == 0)
|
|
|
75
|
+ {
|
|
|
76
|
+ $temp['tplrecommend']['brands'][] = array('href'=> $val['url'],'name'=> $val['title'],'img'=> $val['img']);
|
|
|
77
|
+ }
|
|
|
78
|
+ else
|
|
|
79
|
+ {
|
|
|
80
|
+ $temp['tplrecommend']['types'][] = array('href'=> $val['url'],'name'=> $val['title'],'img'=> $val['img']);
|
|
|
81
|
+ }
|
56
|
}
|
82
|
}
|
57
|
$result['recommend'] = $temp;
|
83
|
$result['recommend'] = $temp;
|
58
|
return $result;
|
84
|
return $result;
|
|
@@ -69,8 +95,12 @@ class Process |
|
@@ -69,8 +95,12 @@ class Process |
69
|
{
|
95
|
{
|
70
|
$result = array();
|
96
|
$result = array();
|
71
|
$temp = array();
|
97
|
$temp = array();
|
|
|
98
|
+ $width = 1150;
|
|
|
99
|
+ $height = 450;
|
72
|
if($data['focus_type'] == 1) {
|
100
|
if($data['focus_type'] == 1) {
|
73
|
foreach($data['data'] as $val) {
|
101
|
foreach($data['data'] as $val) {
|
|
|
102
|
+ $val['src'] = Images::getImageUrl($val['src'], $width, $height, 1);
|
|
|
103
|
+ $val['url'] = Helpers::transUrl($val['url'], $type);
|
74
|
$temp[] = array('href'=> $val['url'],'img' => $val['src']);
|
104
|
$temp[] = array('href'=> $val['url'],'img' => $val['src']);
|
75
|
}
|
105
|
}
|
76
|
$result['slide']['list'] = $temp;
|
106
|
$result['slide']['list'] = $temp;
|
|
@@ -96,31 +126,46 @@ class Process |
|
@@ -96,31 +126,46 @@ class Process |
96
|
if($data[$key]['template_name'] == 'text' && $data[$key+1]['template_name'] == 'textNav'
|
126
|
if($data[$key]['template_name'] == 'text' && $data[$key+1]['template_name'] == 'textNav'
|
97
|
&& $data[$key+2]['template_name'] == 'goods' && $data[$key+3]['template_name'] == 'floor')
|
127
|
&& $data[$key+2]['template_name'] == 'goods' && $data[$key+3]['template_name'] == 'floor')
|
98
|
{
|
128
|
{
|
|
|
129
|
+ //text模版
|
99
|
$temp['singlehot']['name']= $val['data']['text'];
|
130
|
$temp['singlehot']['name']= $val['data']['text'];
|
|
|
131
|
+
|
|
|
132
|
+ //goods模版
|
100
|
foreach($data[$key+2]['data'] as $val)//TODO
|
133
|
foreach($data[$key+2]['data'] as $val)//TODO
|
101
|
{
|
134
|
{
|
102
|
$temp['singlehot']['imgHot'][] = array('href'=> '',//$val['url'],
|
135
|
$temp['singlehot']['imgHot'][] = array('href'=> '',//$val['url'],
|
103
|
'name' => '','price'=> '');
|
136
|
'name' => '','price'=> '');
|
104
|
}
|
137
|
}
|
|
|
138
|
+
|
|
|
139
|
+ //floor模版
|
105
|
foreach($data[$key+3]['data'] as $val)
|
140
|
foreach($data[$key+3]['data'] as $val)
|
106
|
{
|
141
|
{
|
|
|
142
|
+ $val['src'] = Images::getImageUrl($val['src'], 185, 86, 1);
|
|
|
143
|
+ $val['url'] = Helpers::transUrl($val['url'], $type);
|
107
|
$temp['singlehot']['brands'][] = array('href' => $val['url'],
|
144
|
$temp['singlehot']['brands'][] = array('href' => $val['url'],
|
108
|
'img' => $val['src'],'name'=>$val['title']);
|
145
|
'img' => $val['src'],'name'=>$val['title']);
|
109
|
}
|
146
|
}
|
|
|
147
|
+
|
110
|
$result[$key] = $temp;
|
148
|
$result[$key] = $temp;
|
111
|
unset($data[$key], $data[$key+1], $data[$key+2], $data[$key+3]);
|
149
|
unset($data[$key], $data[$key+1], $data[$key+2], $data[$key+3]);
|
112
|
}
|
150
|
}
|
113
|
}
|
151
|
}
|
114
|
- if(isset($data[$key]) && isset($data[$key+1])) //优选品牌 [ template: text & focus]
|
152
|
+ if(isset($data[$key]) && isset($data[$key+1])) //优选品牌 [ template: text & focus ]
|
115
|
{
|
153
|
{
|
116
|
$temp = array('preferenceBrands'=> array('name'=>'', 'slider'=> array()));
|
154
|
$temp = array('preferenceBrands'=> array('name'=>'', 'slider'=> array()));
|
117
|
if($data[$key]['template_name'] =='text' && $data[$key+1]['template_name'] =='focus')
|
155
|
if($data[$key]['template_name'] =='text' && $data[$key+1]['template_name'] =='focus')
|
118
|
{
|
156
|
{
|
119
|
$temp['preferenceBrands']['name'] = $val['data']['text'];
|
157
|
$temp['preferenceBrands']['name'] = $val['data']['text'];
|
|
|
158
|
+
|
|
|
159
|
+ //focus 分类
|
120
|
foreach($data[$key+1]['data'] as $val)
|
160
|
foreach($data[$key+1]['data'] as $val)
|
121
|
{
|
161
|
{
|
|
|
162
|
+ $width = 320;
|
|
|
163
|
+ $height = 430;
|
|
|
164
|
+ $val['src'] = Images::getImageUrl($val['src'], $width, $height, 1);
|
|
|
165
|
+ $val['url'] = Helpers::transUrl($val['url'], $type);
|
122
|
$temp['preferenceBrands']['slider'][] = array('href'=> $val['url'],'img'=> $val['src']);
|
166
|
$temp['preferenceBrands']['slider'][] = array('href'=> $val['url'],'img'=> $val['src']);
|
123
|
}
|
167
|
}
|
|
|
168
|
+
|
124
|
$result[$key] = $temp;
|
169
|
$result[$key] = $temp;
|
125
|
unset($data[$key], $data[$key+1]);
|
170
|
unset($data[$key], $data[$key+1]);
|
126
|
}
|
171
|
}
|