| @@ 181-203 (lines=23) @@ | ||
| 178 | ); |
|
| 179 | $cacheKey .= ' : ' . $pages->offset; |
|
| 180 | $pagelist = Yii::$app->cache->get($cacheKey); |
|
| 181 | if ($pagelist === false) { |
|
| 182 | $pagelist = Page::find()->where( |
|
| 183 | [ |
|
| 184 | 'in', |
|
| 185 | '`id`', |
|
| 186 | array_slice( |
|
| 187 | $ids, |
|
| 188 | $pages->offset, |
|
| 189 | $pages->limit |
|
| 190 | ) |
|
| 191 | ] |
|
| 192 | )->addOrderBy('sort_order')->with('images')->all(); |
|
| 193 | Yii::$app->cache->set( |
|
| 194 | $cacheKey, |
|
| 195 | $pagelist, |
|
| 196 | 86400, |
|
| 197 | new TagDependency( |
|
| 198 | [ |
|
| 199 | 'tags' => ActiveRecordHelper::getCommonTag(Page::className()), |
|
| 200 | ] |
|
| 201 | ) |
|
| 202 | ); |
|
| 203 | } |
|
| 204 | Yii::$app->response->format = Response::FORMAT_JSON; |
|
| 205 | return [ |
|
| 206 | 'view' => $this->renderPartial( |
|
| @@ 372-394 (lines=23) @@ | ||
| 369 | ); |
|
| 370 | $cacheKey .= ' : ' . $pages->offset; |
|
| 371 | $products = Yii::$app->cache->get($cacheKey); |
|
| 372 | if ($products === false) { |
|
| 373 | $products = Product::find()->where( |
|
| 374 | [ |
|
| 375 | 'in', |
|
| 376 | '`id`', |
|
| 377 | array_slice( |
|
| 378 | $ids, |
|
| 379 | $pages->offset, |
|
| 380 | $pages->limit |
|
| 381 | ) |
|
| 382 | ] |
|
| 383 | )->addOrderBy('sort_order')->with('images')->all(); |
|
| 384 | Yii::$app->cache->set( |
|
| 385 | $cacheKey, |
|
| 386 | $products, |
|
| 387 | 86400, |
|
| 388 | new TagDependency( |
|
| 389 | [ |
|
| 390 | 'tags' => ActiveRecordHelper::getCommonTag(Product::className()), |
|
| 391 | ] |
|
| 392 | ) |
|
| 393 | ); |
|
| 394 | } |
|
| 395 | Yii::$app->response->format = Response::FORMAT_JSON; |
|
| 396 | return [ |
|
| 397 | 'view' => $this->renderAjax( |
|