本文整理匯總了PHP中rcache函數的典型用法代碼示例。如果您正苦於以下問題:PHP rcache函數的具體用法?PHP rcache怎麽用?PHP rcache使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了rcache函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getEvaluateGoodsInfoByGoodsID
/**
* 根據商品編號查詢商品評價信息
*/
public function getEvaluateGoodsInfoByGoodsID($goods_id)
{
$prefix = 'evaluation_goods_info';
$info = rcache($goods_id, $prefix);
if (empty($info)) {
$info = array();
$good = $this->field('count(*) as count')->where(array('geval_goodsid' => $goods_id, 'geval_scores' => array('in', '4,5')))->find();
$info['good'] = $good['count'];
$normal = $this->field('count(*) as count')->where(array('geval_goodsid' => $goods_id, 'geval_scores' => array('in', '2,3')))->find();
$info['normal'] = $normal['count'];
$bad = $this->field('count(*) as count')->where(array('geval_goodsid' => $goods_id, 'geval_scores' => array('in', '1')))->find();
$info['bad'] = $bad['count'];
$info['all'] = $info['good'] + $info['normal'] + $info['bad'];
if (intval($info['all']) > 0) {
$info['good_percent'] = intval($info['good'] / $info['all'] * 100);
$info['normal_percent'] = intval($info['normal'] / $info['all'] * 100);
$info['bad_percent'] = intval($info['bad'] / $info['all'] * 100);
$info['good_star'] = ceil($info['good'] / $info['all'] * 5);
} else {
$info['good_percent'] = 100;
$info['normal_percent'] = 0;
$info['bad_percent'] = 0;
$info['good_star'] = 5;
}
//更新商品表好評星級和評論數
$model_goods = Model('goods');
$update = array();
$update['evaluation_good_star'] = $info['good_star'];
$update['evaluation_count'] = $info['all'];
$model_goods->editGoods($update, array('goods_id' => $goods_id));
wcache($goods_id, $info, $prefix);
}
return $info;
}
示例2: circleInfoOp
/**
* GET 圈子詳情
*/
public function circleInfoOp()
{
$c_id = $_GET['circle_id'];
if ($c_id != '' && $c_id > 0) {
$circle_info = Model()->table('circle')->find($c_id);
if (empty($circle_info)) {
output_error("圈子不存在");
die;
}
//圈主和管理員信息
$prefix = 'circle_managelist';
$manager_list = rcache($this->c_id, $prefix);
if (empty($manager_list)) {
$manager_list = Model()->table('circle_member')->where(array('circle_id' => $this->c_id, 'is_identity' => array('in', array(1, 2))))->page($this->page)->select();
$manager_list = array_under_reset($manager_list, 'is_identity', 2);
$manager_list[2] = array_under_reset($manager_list[2], 'member_id', 1);
wcache($this->c_id, $manager_list, $prefix);
}
$circle_info['circle_masteravatar'] = getMemberAvatarForID($circle_info['circle_masterid']);
output_data(array('circle_info' => $circle_info, 'creator' => $manager_list[1][0], 'manager_list' => $manager_list[2]));
} else {
output_error("圈子id錯誤");
die;
}
}
示例3: getMemberInfoByID
/**
* 取得會員詳細信息(優先查詢緩存)
* 如果未找到,則緩存所有字段
* @param int $member_id
* @param string $field 需要取得的緩存鍵值, 例如:'*','member_name,member_sex'
* @return array
*/
public function getMemberInfoByID($member_id, $fields = '*') {
$member_info = rcache($member_id, 'member', $fields);
if (empty($member_info)) {
$member_info = $this->getMemberInfo(array('member_id'=>$member_id),'*',true);
wcache($member_id, $member_info, 'member');
}
return $member_info;
}
示例4: countPointCart
/**
* 禮品購物車禮品數量
*
* @param array $member_id 會員ID
*/
public function countPointCart($member_id) {
$info = rcache($member_id, 'm_pointcart', 'pointcart_count');
if (empty($info['pointcart_count']) && $info['pointcart_count'] !== 0) {
$pointcart_count = $this->table('points_cart')->where(array('pmember_id'=>$member_id))->count();
$pointcart_count = intval($pointcart_count);
wcache($member_id, array('pointcart_count' => $pointcart_count), 'm_pointcart');
} else {
$pointcart_count = intval($info['pointcart_count']);
}
return $pointcart_count;
}
示例5: getEvaluateStoreInfoByScID
/**
* 根據分類編號獲取分類評分數據
*/
public function getEvaluateStoreInfoByScID($sc_id)
{
$prefix = 'sc_evaluate_store_info';
$info = rcache($sc_id, $prefix);
if (empty($info)) {
$model_store = Model('store');
$store_id_string = $model_store->getStoreIDString(array('sc_id' => $sc_id));
$info = $this->_getEvaluateStore(array('seval_storeid' => array('in', $store_id_string)));
wcache($sc_id, $info, $prefix);
}
return $info;
}
示例6: getCurrentAvailableVoucherCount
/**
* 取得當前有效代金券數量
* @param int $member_id
*/
public function getCurrentAvailableVoucherCount($member_id) {
$info = rcache($member_id, 'm_voucher', 'voucher_count');
if (empty($info['voucher_count']) && $info['voucher_count'] !== 0) {
$condition['voucher_owner_id'] = $member_id;
$condition['voucher_end_date'] = array('gt',TIMESTAMP);
$condition['voucher_state'] = 1;
$voucher_count = $this->table('voucher')->where($condition)->count();
$voucher_count = intval($voucher_count);
wcache($member_id, array('voucher_count' => $voucher_count), 'm_voucher');
} else {
$voucher_count = intval($info['voucher_count']);
}
return $voucher_count;
}
示例7: getHotCollectList
/**
* 獲取商品收藏排行
*
* @param int $store_id 店鋪編號
* @param int $limit 數量
* @return array 商品信息
*/
public function getHotCollectList($store_id, $limit = 5)
{
$prefix = 'store_collect_sales_list_' . $limit;
$hot_collect_list = rcache($store_id, $prefix);
if (empty($hot_collect_list)) {
$model_goods = Model('goods');
$hot_collect_list = $model_goods->getGoodsOnlineList(array('store_id' => $store_id), '*', 0, 'goods_collect desc', $limit);
wcache($store_id, $hot_collect_list, $prefix);
}
return $hot_collect_list;
}
示例8: _rGoodsBundlingCache
/**
* 讀取商品優惠套裝緩存
* @param int $goods_id
* @return array
*/
private function _rGoodsBundlingCache($goods_id)
{
return rcache($goods_id, 'goods_bundling');
}
示例9: getEvaluateStoreInfoByScID
/**
* 根據分類編號獲取分類評分數據
*/
public function getEvaluateStoreInfoByScID($sc_id)
{
$prefix = 'sc_evaluate_store_info';
$info = rcache($sc_id, $prefix);
if (empty($info)) {
$model_store = Model('store');
$store_id_string = $model_store->getStoreIDString(array('sc_id' => $sc_id));
$info = $this->_getEvaluateStore(array('seval_storeid' => array('in', $store_id_string)));
$cache = array();
$cache['evaluate_store_info'] = serialize($info);
wcache($sc_id, $cache, $prefix, 60 * 24);
} else {
$info = unserialize($info['evaluate_store_info']);
}
return $info;
}
示例10: _rStorePlateCache
/**
* 讀取店鋪關聯板式緩存緩存
* @param int $plate_id
* @param string $fields
* @return array
*/
private function _rStorePlateCache($plate_id, $fields)
{
return rcache($plate_id, 'store_plate', $fields);
}
示例11: _rGoodsGiftCache
/**
* 讀取商品公共緩存
* @param int $goods_id
* @return array
*/
private function _rGoodsGiftCache($goods_id)
{
return rcache($goods_id, 'goods_gift');
}
示例12: get_member_detail_info
/**
* 用戶詳細信息
*/
protected function get_member_detail_info($member_info)
{
//生成緩存的鍵值
$member_id = $member_info['member_id'];
if ($member_id <= 0) {
return null;
}
//寫入緩存的數據
$cachekey_arr = array('member_name', 'store_id', 'member_avatar', 'member_qq', 'member_email', 'member_msn', 'member_ww', 'member_points', 'available_predeposit', 'member_snsvisitnum', 'credit_arr', 'fan_count', 'attention_count');
//先查找$member_id緩存
if ($_cache = rcache($member_id, 'sns_member')) {
foreach ($_cache as $k => $v) {
$member_info[$k] = $v;
}
} else {
$model = Model();
//粉絲數
$fan_count = $model->table('sns_friend')->where(array('friend_tomid' => $member_id))->count();
$member_info['fan_count'] = $fan_count;
//關注數
$attention_count = $model->table('sns_friend')->where(array('friend_frommid' => $member_id))->count();
$member_info['attention_count'] = $attention_count;
//興趣標簽
$mtag_list = $model->table('sns_membertag,sns_mtagmember')->field('mtag_name')->on('sns_membertag.mtag_id = sns_mtagmember.mtag_id')->join('inner')->where(array('sns_mtagmember.member_id' => $member_id))->select();
$tagname_array = array();
if (!empty($mtag_list)) {
foreach ($mtag_list as $val) {
$tagname_array[] = $val['mtag_name'];
}
}
$member_info['tagname'] = $tagname_array;
wcache($member_id, $member_info, 'sns_member');
}
return $member_info;
}
示例13: _rStoreGoodsClassCache
/**
* 讀取店鋪商品分類緩存
* @param int $store_id
* @param string $fields
* @return array
*/
private function _rStoreGoodsClassCache($store_id)
{
return rcache($store_id, 'store_goods_class');
}
示例14: indexOp
/**
* 單個商品信息頁
*/
public function indexOp()
{
$goods_id = intval($_GET['goods_id']);
// 商品詳細信息
$model_goods = Model('goods');
$goods_detail = $model_goods->getGoodsDetail($goods_id);
$goods_info = $goods_detail['goods_info'];
if (empty($goods_info)) {
showMessage(L('goods_index_no_goods'), '', 'html', 'error');
}
// by 33hao.com
$rs = $model_goods->getGoodsList(array('goods_commonid' => $goods_info['goods_commonid']));
$count = 0;
foreach ($rs as $v) {
$count += $v['goods_salenum'];
}
$goods_info['goods_salenum'] = $count;
// 添加 end
$this->getStoreInfo($goods_info['store_id']);
Tpl::output('spec_list', $goods_detail['spec_list']);
Tpl::output('spec_image', $goods_detail['spec_image']);
Tpl::output('goods_image', $goods_detail['goods_image']);
Tpl::output('mansong_info', $goods_detail['mansong_info']);
Tpl::output('gift_array', $goods_detail['gift_array']);
// 生成緩存的鍵值
$hash_key = $goods_info['goods_id'];
$_cache = rcache($hash_key, 'product');
if (empty($_cache)) {
// 查詢SNS中該商品的信息
$snsgoodsinfo = Model('sns_goods')->getSNSGoodsInfo(array('snsgoods_goodsid' => $goods_info['goods_id']), 'snsgoods_likenum,snsgoods_sharenum');
$data = array();
$data['likenum'] = $snsgoodsinfo['snsgoods_likenum'];
$data['sharenum'] = $snsgoodsinfo['snsgoods_sharenum'];
// 緩存商品信息
wcache($hash_key, $data, 'product');
}
$goods_info = array_merge($goods_info, $_cache);
$inform_switch = true;
// 檢測商品是否下架,檢查是否為店主本人
if ($goods_info['goods_state'] != 1 || $goods_info['goods_verify'] != 1 || $goods_info['store_id'] == $_SESSION['store_id']) {
$inform_switch = false;
}
Tpl::output('inform_switch', $inform_switch);
// 如果使用運費模板
if ($goods_info['transport_id'] > 0) {
// 取得三種運送方式默認運費
$model_transport = Model('transport');
$transport = $model_transport->getExtendList(array('transport_id' => $goods_info['transport_id'], 'is_default' => 1));
if (!empty($transport) && is_array($transport)) {
foreach ($transport as $v) {
$goods_info[$v['type'] . "_price"] = $v['sprice'];
}
}
}
Tpl::output('goods', $goods_info);
//v3-b11 搶購商品是否開始
$IsHaveBuy = 0;
if (!empty($_SESSION['member_id'])) {
$buyer_id = $_SESSION['member_id'];
$promotion_type = $goods_info["promotion_type"];
if ($promotion_type == 'groupbuy') {
//檢測是否限購數量
$upper_limit = $goods_info["upper_limit"];
if ($upper_limit > 0) {
//查詢些會員的訂單中,是否已買過了
$model_order = Model('order');
//取商品列表
$order_goods_list = $model_order->getOrderGoodsList(array('goods_id' => $goods_id, 'buyer_id' => $buyer_id, 'goods_type' => 2));
if ($order_goods_list) {
//取得上次購買的活動編號(防一個商品參加多次團購活動的問題)
$promotions_id = $order_goods_list[0]["promotions_id"];
//用此編號取數據,檢測是否這次活動的訂單商品。
$model_groupbuy = Model('groupbuy');
$groupbuy_info = $model_groupbuy->getGroupbuyInfo(array('groupbuy_id' => $promotions_id));
if ($groupbuy_info) {
$IsHaveBuy = 1;
} else {
$IsHaveBuy = 0;
}
}
}
}
}
Tpl::output('IsHaveBuy', $IsHaveBuy);
//end
$model_plate = Model('store_plate');
// 頂部關聯版式
if ($goods_info['plateid_top'] > 0) {
$plate_top = $model_plate->getStorePlateInfoByID($goods_info['plateid_top']);
Tpl::output('plate_top', $plate_top);
}
// 底部關聯版式
if ($goods_info['plateid_bottom'] > 0) {
$plate_bottom = $model_plate->getStorePlateInfoByID($goods_info['plateid_bottom']);
Tpl::output('plate_bottom', $plate_bottom);
}
Tpl::output('store_id', $goods_info['store_id']);
//.........這裏部分代碼省略.........
示例15: indexOp
/**
* 店鋪列表
*/
public function indexOp()
{
/**
* 讀取語言包
*/
Language::read('home_store_class_index');
$lang = Language::getLangContent();
//店鋪類目快速搜索
$class_list = ($h = F('store_class')) ? $h : rcache('store_class', true, 'file');
if (!key_exists($_GET['cate_id'], $class_list)) {
$_GET['cate_id'] = 0;
}
Tpl::output('class_list', $class_list);
//店鋪搜索
$model = Model();
$condition = array();
$keyword = trim($_GET['keyword']);
if (C('fullindexer.open') && !empty($keyword)) {
//全文搜索
$condition = $this->full_search($keyword);
} else {
if ($keyword != '') {
$condition['store_name|store_zy'] = array('like', '%' . $keyword . '%');
}
if ($_GET['user_name'] != '') {
$condition['member_name'] = trim($_GET['user_name']);
}
}
if (!empty($_GET['area_id'])) {
$condition['area_id'] = intval($_GET['area_id']);
}
if ($_GET['cate_id'] > 0) {
$child = array_merge((array) $class_list[$_GET['cate_id']]['child'], array($_GET['cate_id']));
$condition['sc_id'] = array('in', $child);
}
$condition['store_state'] = 1;
if (!in_array($_GET['order'], array('desc', 'asc'))) {
unset($_GET['order']);
}
if (!in_array($_GET['key'], array('store_sales', 'store_credit'))) {
unset($_GET['key']);
}
$order = 'store_sort asc';
if (isset($condition['store.store_id'])) {
$condition['store_id'] = $condition['store.store_id'];
unset($condition['store.store_id']);
}
$model_store = Model('store');
$store_list = $model_store->where($condition)->order($order)->page(10)->select();
//獲取店鋪商品數,推薦商品列表等信息
$store_list = $model_store->getStoreSearchList($store_list);
//print_r($store_list);exit();
//信用度排序
if ($_GET['key'] == 'store_credit') {
if ($_GET['order'] == 'desc') {
$store_list = sortClass::sortArrayDesc($store_list, 'store_credit_average');
} else {
$store_list = sortClass::sortArrayAsc($store_list, 'store_credit_average');
}
} else {
if ($_GET['key'] == 'store_sales') {
//銷量排行
if ($_GET['order'] == 'desc') {
$store_list = sortClass::sortArrayDesc($store_list, 'num_sales_jq');
} else {
$store_list = sortClass::sortArrayAsc($store_list, 'num_sales_jq');
}
}
}
Tpl::output('store_list', $store_list);
Tpl::output('show_page', $model->showpage(2));
//當前位置
if (intval($_GET['cate_id']) > 0) {
$nav_link[1]['link'] = 'index.php?act=shop_search';
$nav_link[1]['title'] = $lang['site_search_store'];
$nav = $class_list[$_GET['cate_id']];
//如果有父級
if ($nav['sc_parent_id'] > 0) {
$tmp = $class_list[$nav['sc_parent_id']];
//存入父級
$nav_link[] = array('title' => $tmp['sc_name'], 'link' => "index.php?act=shop_search&cate_id=" . $nav['sc_parent_id']);
}
//存入當前級
$nav_link[] = array('title' => $nav['sc_name']);
} else {
$nav_link[1]['link'] = 'index.php';
$nav_link[1]['title'] = $lang['homepage'];
$nav_link[2]['title'] = $lang['site_search_store'];
}
$purl = $this->getParam();
Tpl::output('nav_link_list', $nav_link);
Tpl::output('purl', urlShop($purl['act'], $purl['op'], $purl['param']));
//SEO
Model('seo')->type('index')->show();
Tpl::output('html_title', (empty($_GET['keyword']) ? '' : $_GET['keyword'] . ' - ') . C('site_name') . $lang['nc_common_search']);
Tpl::showpage('shop_search');
}