|
@@ -63,6 +63,9 @@ class HomeModel |
|
@@ -63,6 +63,9 @@ class HomeModel |
63
|
return array();
|
63
|
return array();
|
64
|
}
|
64
|
}
|
65
|
$menu = array();
|
65
|
$menu = array();
|
|
|
66
|
+ $key = sprintf('%s_%s_%s',CacheConfig::KEY_WEB_HOME_NAVBAR_DATA, md5(serialize($data)), $channel);
|
|
|
67
|
+ $menu = Cache::get($key);
|
|
|
68
|
+ if(empty($menu)) {
|
66
|
$item = array();
|
69
|
$item = array();
|
67
|
foreach ($data['data'] as $val) {
|
70
|
foreach ($data['data'] as $val) {
|
68
|
$item = array(
|
71
|
$item = array(
|
|
@@ -112,6 +115,8 @@ class HomeModel |
|
@@ -112,6 +115,8 @@ class HomeModel |
112
|
}
|
115
|
}
|
113
|
$menu[] = $item;
|
116
|
$menu[] = $item;
|
114
|
}
|
117
|
}
|
|
|
118
|
+ Cache::set($key, $menu, 3600);
|
|
|
119
|
+ }
|
115
|
return $menu;
|
120
|
return $menu;
|
116
|
}
|
121
|
}
|
117
|
|
122
|
|
|
@@ -165,9 +170,14 @@ class HomeModel |
|
@@ -165,9 +170,14 @@ class HomeModel |
165
|
*/
|
170
|
*/
|
166
|
public static function getChannelResource($channel, $content_code)
|
171
|
public static function getChannelResource($channel, $content_code)
|
167
|
{
|
172
|
{
|
|
|
173
|
+ $key = sprintf(CacheConfig::KEY_WEB_HOME_CHANNEL_DATA.'_'.$channel);
|
|
|
174
|
+ $data = Cache::get($key);
|
|
|
175
|
+ if(empty($data)) {
|
168
|
$resource = IndexData::getResourceData($content_code);
|
176
|
$resource = IndexData::getResourceData($content_code);
|
169
|
// 格式化数据
|
177
|
// 格式化数据
|
170
|
$data = ChannelProcess::getFormat($channel, $resource['data']);
|
178
|
$data = ChannelProcess::getFormat($channel, $resource['data']);
|
|
|
179
|
+ Cache::set($key, $data, 3600);
|
|
|
180
|
+ }
|
171
|
return $data;
|
181
|
return $data;
|
172
|
}
|
182
|
}
|
173
|
|
183
|
|
|
@@ -213,6 +223,10 @@ class HomeModel |
|
@@ -213,6 +223,10 @@ class HomeModel |
213
|
public static function getNewArrival($channel)
|
223
|
public static function getNewArrival($channel)
|
214
|
{
|
224
|
{
|
215
|
$result = array();
|
225
|
$result = array();
|
|
|
226
|
+ $key = sprintf(CacheConfig::KEY_WEB_HOME_CHANNEL_NEWARRIVAL_DATA.'_'.$channel);
|
|
|
227
|
+ //缓存数据
|
|
|
228
|
+ $result = Cache::get($key);
|
|
|
229
|
+ if(empty($result)) {
|
216
|
$params = array(
|
230
|
$params = array(
|
217
|
'order' => 's_t_desc',
|
231
|
'order' => 's_t_desc',
|
218
|
'shelve_time' => strtotime("-60 days") . ',' . time()
|
232
|
'shelve_time' => strtotime("-60 days") . ',' . time()
|
|
@@ -253,6 +267,8 @@ class HomeModel |
|
@@ -253,6 +267,8 @@ class HomeModel |
253
|
}
|
267
|
}
|
254
|
}
|
268
|
}
|
255
|
}
|
269
|
}
|
|
|
270
|
+ Cache::set($key, $result, 3600);
|
|
|
271
|
+ }
|
256
|
return $result;
|
272
|
return $result;
|
257
|
}
|
273
|
}
|
258
|
} |
274
|
} |