/** * 清理缓存 */ public function clearOp() { if (!uk86_chksubmit()) { Tpl::showpage('cache.clear'); return; } $lang = Uk86Language::uk86_getLangContent(); // 清理所有缓存 if ($_POST['cls_full'] == 1) { foreach ($this->cacheItems as $i) { uk86_dkcache($i); } // 表主键 Model::dropTablePkArrayCache(); // 商品分类 uk86_dkcache('gc_class'); uk86_dkcache('all_categories'); uk86_dkcache('goods_class_seo'); uk86_dkcache('class_tag'); // 广告 Model('adv')->makeApAllCache(); // 首页 Model('web_config')->getWebHtml('index', 1); uk86_delCacheFile('index'); } else { $todo = (array) $_POST['cache']; foreach ($this->cacheItems as $i) { if (in_array($i, $todo)) { uk86_dkcache($i); } } // 表主键 if (in_array('table', $todo)) { Model::dropTablePkArrayCache(); } // 商品分类 if (in_array('goodsclass', $todo)) { uk86_dkcache('gc_class'); uk86_dkcache('all_categories'); uk86_dkcache('goods_class_seo'); uk86_dkcache('class_tag'); } // 广告 if (in_array('adv', $todo)) { Model('adv')->makeApAllCache(); } // 首页 if (in_array('index', $todo)) { Model('web_config')->getWebHtml('index', 1); uk86_delCacheFile('index'); } } $this->log(L('cache_cls_operate')); uk86_showMessage($lang['cache_cls_ok']); }
public function area_dropOp() { $model = Model(); $res = $model->table('live_area')->where(array('live_area_id' => array('in', intval($_POST['live_area_id']))))->delete(); if ($res) { H('city', null); //清除缓存 uk86_delCacheFile('city'); $this->log('删除线下抢区域[ID:' . intval($_POST['live_area_id']) . ']', 1); uk86_showMessage('删除成功', 'index.php?act=live_area', '', 'succ'); } else { uk86_showMessage('删除失败', 'index.php?act=live_area', '', 'error'); } }
/** * 广告 * * @return array */ public function makeApAllCache() { if (C('cache_open')) { // *kcache() doesnt support iterating on keys } else { uk86_delCacheFile('adv'); } $model = Model(); $ap_list = $model->table('adv_position')->where(array('is_use' => 1))->select(); $adv_list = $model->table('adv')->where(array('adv_end_date' => array('gt', time())))->order('slide_sort, adv_id desc')->select(); $array = array(); foreach ((array) $ap_list as $v) { foreach ((array) $adv_list as $xv) { if ($v['ap_id'] == $xv['ap_id']) { $v['adv_list'][] = $xv; } } // 写入缓存 $apId = (int) $v['ap_id']; if (C('cache_open')) { uk86_wkcache("adv/{$apId}", $v); } else { uk86_write_file(BASE_DATA_PATH . '/cache/adv/' . $apId . '.php', $v); } } }
private function updateinfo($field, $id, $value) { $model_live_class = Model('live_class'); $res = $model_live_class->editLive_class(array('live_class_id' => $id), array($field => $value)); if ($res) { H('live_class', null); //清除缓存 uk86_delCacheFile('live_class'); $this->log('编辑抢购分类[ID:' . $id . ']', 1); echo 'true'; } else { echo 'false'; } exit; }