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