| @@ 191-213 (lines=23) @@ | ||
| 188 | ); |
|
| 189 | $cacheKey .= ' : ' . $pages->offset; |
|
| 190 | $pagelist = Yii::$app->cache->get($cacheKey); |
|
| 191 | if ($pagelist === false) { |
|
| 192 | $pagelist = Page::find()->where( |
|
| 193 | [ |
|
| 194 | 'in', |
|
| 195 | '`id`', |
|
| 196 | array_slice( |
|
| 197 | $ids, |
|
| 198 | $pages->offset, |
|
| 199 | $pages->limit |
|
| 200 | ) |
|
| 201 | ] |
|
| 202 | )->addOrderBy('sort_order')->with('images')->all(); |
|
| 203 | Yii::$app->cache->set( |
|
| 204 | $cacheKey, |
|
| 205 | $pagelist, |
|
| 206 | 86400, |
|
| 207 | new TagDependency( |
|
| 208 | [ |
|
| 209 | 'tags' => ActiveRecordHelper::getCommonTag(Page::className()), |
|
| 210 | ] |
|
| 211 | ) |
|
| 212 | ); |
|
| 213 | } |
|
| 214 | Yii::$app->response->format = Response::FORMAT_JSON; |
|
| 215 | return [ |
|
| 216 | 'view' => $this->renderPartial( |
|
| @@ 383-405 (lines=23) @@ | ||
| 380 | ); |
|
| 381 | $cacheKey .= ' : ' . $pages->offset; |
|
| 382 | $products = Yii::$app->cache->get($cacheKey); |
|
| 383 | if ($products === false) { |
|
| 384 | $products = Product::find()->where( |
|
| 385 | [ |
|
| 386 | 'in', |
|
| 387 | '`id`', |
|
| 388 | array_slice( |
|
| 389 | $ids, |
|
| 390 | $pages->offset, |
|
| 391 | $pages->limit |
|
| 392 | ) |
|
| 393 | ] |
|
| 394 | )->addOrderBy('sort_order')->with('images')->all(); |
|
| 395 | Yii::$app->cache->set( |
|
| 396 | $cacheKey, |
|
| 397 | $products, |
|
| 398 | 86400, |
|
| 399 | new TagDependency( |
|
| 400 | [ |
|
| 401 | 'tags' => ActiveRecordHelper::getCommonTag(Product::className()), |
|
| 402 | ] |
|
| 403 | ) |
|
| 404 | ); |
|
| 405 | } |
|
| 406 | Yii::$app->response->format = Response::FORMAT_JSON; |
|
| 407 | return [ |
|
| 408 | 'view' => $this->renderAjax( |
|