本文整理汇总了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');
}