| @@ 203-225 (lines=23) @@ | ||
| 200 | ); |
|
| 201 | $cacheKey .= ' : ' . $pages->offset; |
|
| 202 | $pagelist = Yii::$app->cache->get($cacheKey); |
|
| 203 | if ($pagelist === false) { |
|
| 204 | $pagelist = Page::find()->where( |
|
| 205 | [ |
|
| 206 | 'in', |
|
| 207 | '`id`', |
|
| 208 | array_slice( |
|
| 209 | $ids, |
|
| 210 | $pages->offset, |
|
| 211 | $pages->limit |
|
| 212 | ) |
|
| 213 | ] |
|
| 214 | )->addOrderBy('sort_order')->with('images')->all(); |
|
| 215 | Yii::$app->cache->set( |
|
| 216 | $cacheKey, |
|
| 217 | $pagelist, |
|
| 218 | 86400, |
|
| 219 | new TagDependency( |
|
| 220 | [ |
|
| 221 | 'tags' => ActiveRecordHelper::getCommonTag(Page::className()), |
|
| 222 | ] |
|
| 223 | ) |
|
| 224 | ); |
|
| 225 | } |
|
| 226 | Yii::$app->response->format = Response::FORMAT_JSON; |
|
| 227 | return [ |
|
| 228 | 'view' => $this->renderPartial( |
|
| @@ 352-374 (lines=23) @@ | ||
| 349 | ); |
|
| 350 | $cacheKey .= ' : ' . $pages->offset; |
|
| 351 | $products = Yii::$app->cache->get($cacheKey); |
|
| 352 | if ($products === false) { |
|
| 353 | $products = Product::find()->where( |
|
| 354 | [ |
|
| 355 | 'in', |
|
| 356 | '`id`', |
|
| 357 | array_slice( |
|
| 358 | $ids, |
|
| 359 | $pages->offset, |
|
| 360 | $pages->limit |
|
| 361 | ) |
|
| 362 | ] |
|
| 363 | )->addOrderBy('sort_order')->with('images')->all(); |
|
| 364 | Yii::$app->cache->set( |
|
| 365 | $cacheKey, |
|
| 366 | $products, |
|
| 367 | 86400, |
|
| 368 | new TagDependency( |
|
| 369 | [ |
|
| 370 | 'tags' => ActiveRecordHelper::getCommonTag(Product::className()), |
|
| 371 | ] |
|
| 372 | ) |
|
| 373 | ); |
|
| 374 | } |
|
| 375 | Yii::$app->response->format = Response::FORMAT_JSON; |
|
| 376 | return [ |
|
| 377 | 'view' => $this->renderAjax( |
|