/** * 编辑会员 * @param array $condition * @param array $data */ public function editMember($condition, $data) { $update = $this->table('member')->where($condition)->update($data); if ($update && $condition['member_id']) { uk86_dcache($condition['member_id'], 'member'); } return $update; }
/** * 删除管理员 * @param unknown $condition */ public function delCircleMember($condition) { $result = $this->where($condition)->delete(); if ($result) { uk86_dcache($condition['circle_id'], 'circle_managelist'); } return $result; }
/** * 删除商品图片缓存 * @param int $key ($goods_commonid .'|'. $color_id) * @return boolean */ private function _dGoodsImageCache($key) { return uk86_dcache($key, 'goods_image'); }
/** * 删除商品优惠套装缓存 * @param int $goods_id * @return boolean */ private function _dGoodsBundlingCache($goods_id) { return uk86_dcache($goods_id, 'goods_bundling'); }
/** * 删除商品限时折扣缓存 * @param int $goods_id * @return boolean */ private function _dGoodsXianshiCache($goods_id) { return uk86_dcache($goods_id, 'goods_xianshi'); }
/** * 清理缓存 */ private function _delMbSpecialCache($special_id) { //清理缓存 uk86_dcache($special_id, 'mb_special'); //删除静态文件 $html_path = $this->getMbSpecialHtmlPath($special_id); if (is_file($html_path)) { @unlink($html_path); } }
/** * 删除商品公共缓存 * @param int $goods_id * @return boolean */ private function _dGoodsGiftCache($goods_id) { return uk86_dcache($goods_id, 'goods_gift'); }
/** * 批量添加商品评价 * * @param array $param * @param array $goodsid_array 商品id数组,更新缓存使用 * @return boolean */ public function addEvaluateGoodsArray($param, $goodsid_array) { $result = $this->insertAll($param); // 删除商品评价缓存 if ($result && !empty($goodsid_array)) { foreach ($goodsid_array as $goods_id) { uk86_dcache($goods_id, 'goods_evaluation'); } } return $result; }
/** * 删除店铺商品分类缓存 * @param int $store_id * @return boolean */ private function _dStoreGoodsClassCache($store_id) { return uk86_dcache($store_id, 'store_goods_class'); }
/** * 删除商品推荐搭配缓存 * @param int $goods_id * @return boolean */ private function _dGoodsComboCache($goods_id) { return uk86_dcache($goods_id, 'goods_combo'); }
/** * 将缓存中的浏览记录存入数据库中,并删除30天前的浏览历史 */ public function browseOp() { $model = Model('goods_browse'); //将cache中的记录存入数据库 if (C('cache.type') != 'file') { //如果浏览记录已经存入了缓存中,则将其整理到数据库中 //上次更新缓存的时间 $latest_record = $model->getGoodsbrowseOne(array(), '', 'browsetime desc'); $starttime = ($t = intval($latest_record['browsetime'])) ? $t : 0; $monthago = strtotime(date('Y-m-d', time())) - 86400 * 30; $model_member = Model('member'); //查询会员信息总条数 $countnum = $model_member->getMemberCount(array()); $eachnum = 100; for ($i = 0; $i < $countnum; $i += $eachnum) { //每次查询100条 $member_list = $model_member->getMemberList(array(), '*', 0, 'member_id asc', "{$i},{$eachnum}"); foreach ((array) $member_list as $k => $v) { $insert_arr = array(); $goodsid_arr = array(); //生成缓存的键值 $hash_key = $v['member_id']; $browse_goodsid = uk86_rcache($hash_key, 'goodsbrowse', 'goodsid'); if ($browse_goodsid) { //删除缓存中多余的浏览历史记录,仅保留最近的30条浏览历史,先取出最近30条浏览历史的商品ID $cachegoodsid_arr = $browse_goodsid['goodsid'] ? unserialize($browse_goodsid['goodsid']) : array(); unset($browse_goodsid['goodsid']); if ($cachegoodsid_arr) { $cachegoodsid_arr = array_slice($cachegoodsid_arr, -30, 30, true); } //处理存入数据库的浏览历史缓存信息 $_cache = uk86_rcache($hash_key, 'goodsbrowse'); foreach ((array) $_cache as $c_k => $c_v) { $c_v = unserialize($c_v); if ($c_v['browsetime'] >= $starttime) { //如果 缓存中的数据未更新到数据库中(即添加时间大于上次更新到数据库中的数据时间)则将数据更新到数据库中 $tmp_arr = array(); $tmp_arr['goods_id'] = $c_v['goods_id']; $tmp_arr['member_id'] = $v['member_id']; $tmp_arr['browsetime'] = $c_v['browsetime']; $tmp_arr['gc_id'] = $c_v['gc_id']; $tmp_arr['gc_id_1'] = $c_v['gc_id_1']; $tmp_arr['gc_id_2'] = $c_v['gc_id_2']; $tmp_arr['gc_id_3'] = $c_v['gc_id_3']; $insert_arr[] = $tmp_arr; $goodsid_arr[] = $c_v['goods_id']; } //除了最近的30条浏览历史之外多余的浏览历史记录或者30天之前的浏览历史从缓存中删除 if (!in_array($c_v['goods_id'], $cachegoodsid_arr) || $c_v['browsetime'] < $monthago) { unset($_cache[$c_k]); } } //删除已经存在的该商品浏览记录 if ($goodsid_arr) { $model->delGoodsbrowse(array('member_id' => $v['member_id'], 'goods_id' => array('in', $goodsid_arr))); } //将缓存中的浏览历史存入数据库 if ($insert_arr) { $model->addGoodsbrowseAll($insert_arr); } //重新赋值浏览历史缓存 uk86_dcache($hash_key, 'goodsbrowse'); $_cache['goodsid'] = serialize($cachegoodsid_arr); uk86_wcache($hash_key, $_cache, 'goodsbrowse'); } } } } //删除30天前的浏览历史 $model->delGoodsbrowse(array('browsetime' => array('lt', $monthago))); }
/** * 删除商品满即送缓存 * @param int $store_id * @return boolean */ private function _dGoodsMansongCache($store_id) { return uk86_dcache($store_id, 'goods_mansong'); }
/** * 删除店铺关联板式缓存缓存 * @param int $plate_id * @return boolean */ private function _dStorePlateCache($plate_id) { return uk86_dcache($plate_id, 'store_plate'); }
/** * 删除商品抢购缓存 * @param int $goods_commonid * @return boolean */ private function _dGoodsGroupbuyCache($goods_commonid) { return uk86_dcache($goods_commonid, 'goods_groupbuy'); }
public function delStore($condition) { $store_info = $this->getStoreInfo($condition); //删除店铺相关图片 @unlink(BASE_UPLOAD_PATH . DS . ATTACH_STORE . DS . $store_info['store_label']); @unlink(BASE_UPLOAD_PATH . DS . ATTACH_STORE . DS . $store_info['store_banner']); if ($store_info['store_slide'] != '') { foreach (explode(',', $store_info['store_slide']) as $val) { @unlink(BASE_UPLOAD_PATH . DS . ATTACH_SLIDE . DS . $val); } } //清空缓存 uk86_dcache($store_info['store_id'], 'store_info'); return $this->where($condition)->delete(); }