• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP wcache函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中wcache函数的典型用法代码示例。如果您正苦于以下问题:PHP wcache函数的具体用法?PHP wcache怎么用?PHP wcache使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了wcache函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: 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;
     }
 }
开发者ID:ff00x0,项目名称:shopnc-api,代码行数:28,代码来源:circle.php


示例2: 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;
 }
开发者ID:noikiy,项目名称:haifenbao,代码行数:37,代码来源:evaluate_goods.model.php


示例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;
 }
开发者ID:noikiy,项目名称:ejia,代码行数:15,代码来源:member.model.php


示例4: 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;
 }
开发者ID:noikiy,项目名称:haifenbao,代码行数:15,代码来源:evaluate_store.model.php


示例5: manageList

 /**
  * 圈主和管理信息
  */
 protected function manageList()
 {
     $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))))->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);
     }
     Tpl::output('creator', $manager_list[1][0]);
     Tpl::output('manager_list', $manager_list[2]);
 }
开发者ID:uwitec,项目名称:xbshop,代码行数:16,代码来源:control.php


示例6: 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']);
//.........这里部分代码省略.........
开发者ID:lehman3087,项目名称:wanhaoshop,代码行数:101,代码来源:goods.php


示例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;
 }
开发者ID:bubargaininc,项目名称:oak_oak,代码行数:18,代码来源:store.model.php


示例8: _wGoodsBundlingCache

 /**
  * 写入商品优惠套装缓存
  * @param int $goods_id
  * @param array $array
  * @return boolean
  */
 private function _wGoodsBundlingCache($goods_id, $array)
 {
     return wcache($goods_id, $array, 'goods_bundling');
 }
开发者ID:dotku,项目名称:shopnc_cnnewyork,代码行数:10,代码来源:p_bundling.model.php


示例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;
 }
开发者ID:ff00x0,项目名称:shopnc,代码行数:19,代码来源:evaluate_store.model.php


示例10: editbrand

 public function editbrand($update, $condition)
 {
     //清空缓存
     $store_list = $this->getStoreList($condition);
     foreach ($store_list as $value) {
         wcache($value['brand_id'], array(), 'store_info');
     }
     return $this->where($condition)->update($update);
 }
开发者ID:bubargaininc,项目名称:oak_oak,代码行数:9,代码来源:brand.model.php


示例11: 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;
 }
开发者ID:bubargaininc,项目名称:oak_oak,代码行数:38,代码来源:control.php


示例12: browseOp

 /**
  * 将缓存中的浏览记录存入数据库中,并删除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 = 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 = 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);
                     }
                     //重新赋值浏览历史缓存
                     dcache($hash_key, 'goodsbrowse');
                     $_cache['goodsid'] = serialize($cachegoodsid_arr);
                     wcache($hash_key, $_cache, 'goodsbrowse');
                 }
             }
         }
     }
     //删除30天前的浏览历史
     $model->delGoodsbrowse(array('browsetime' => array('lt', $monthago)));
 }
开发者ID:xuxuecheng,项目名称:shopnc,代码行数:74,代码来源:goods.php


示例13: _wGoodsMansongCache

 /**
  * 写入商品满即送缓存
  * @param int $store_id
  * @param array $mansong_info
  * @return boolean
  */
 private function _wGoodsMansongCache($store_id, $mansong_info)
 {
     return wcache($store_id, $mansong_info, 'goods_mansong');
 }
开发者ID:flying3615,项目名称:chuniang,代码行数:10,代码来源:p_mansong.model.php


示例14: delPointCart

	/**
	 * 删除特定条件礼品购物车信息
	 * @param	mixed $pc_id 删除记录编号
	 */
	public function delPointCart($where, $member_id = 0){
		$result = $this->table('points_cart')->where($where)->delete();
		//清除相关缓存
		if ($result && $member_id > 0){
		    wcache($member_id, array('pointcart_count' => null), 'm_pointcart');
		}
		return $result;
	}
开发者ID:noikiy,项目名称:ejia,代码行数:12,代码来源:pointcart.model.php


示例15: getGoodsCountByStoreArray

 /**
  * 获取店铺商品数
  *
  * @param array $store_array 店铺数组
  * @return array $store_array 包含商品数goods_count的店铺数组
  */
 public function getGoodsCountByStoreArray($store_array)
 {
     $store_array_new = array();
     $model = Model();
     $no_cache_store = '';
     foreach ($store_array as $value) {
         $goods_count = rcache($value['store_id'], 'store_goods_count');
         if (!empty($goods_count) && $goods_count !== FALSE) {
             //有缓存的直接赋值
             $value['goods_count'] = $goods_count;
         } else {
             //没有缓存记录store_id,统计从数据库读取
             $no_cache_store .= $value['store_id'] . ',';
             $value['goods_count'] = '0';
         }
         $store_array_new[$value['store_id']] = $value;
     }
     if (!empty($no_cache_store)) {
         //从数据库读取店铺商品数赋值并缓存
         $no_cache_store = rtrim($no_cache_store, ',');
         $condition = array();
         $condition['goods_state'] = '1';
         $condition['store_id'] = array('in', $no_cache_store);
         $goods_count_array = $model->table('goods')->field('store_id,count(*) as goods_count')->where($condition)->group('store_id')->select();
         if (!empty($goods_count_array)) {
             foreach ($goods_count_array as $value) {
                 $store_array_new[$value['store_id']]['goods_count'] = $value['goods_count'];
                 wcache($value['store_id'], $value['goods_count'], 'store_goods_count');
             }
         }
     }
     return $store_array_new;
 }
开发者ID:dotku,项目名称:shopnc_cnnewyork,代码行数:39,代码来源:store.model.php


示例16: addViewedGoodsToCache

 /**
  * 浏览过的商品加入浏览历史cache
  *
  * @param mixed $goods_id 商品ID或者商品ID数组
  * @param int $member_id 会员ID(一般传递$_SESSION['member_id'])
  * @param int $store_id 店铺ID(一般传递$_SESSION['store_id'])
  * @param array $goods_info 如果已经获取了商品信息则可传递至函数,避免重复查询
  * @return array
  */
 public function addViewedGoodsToCache($goods_id, $member_id, $store_id = 0, $goods_info = array())
 {
     if (!$goods_id || $member_id <= 0) {
         return array('state' => false, 'msg' => '参数错误');
     }
     $browsetime = time();
     if (!$goods_info) {
         //查询商品详细信息
         $model_goods = Model('goods');
         if (is_array($goods_id)) {
             $goods_infotmp = $model_goods->getGoodsList(array('goods_id' => array('in', $goods_id)), 'goods_id,gc_id,gc_id_1,gc_id_2,gc_id_3,store_id');
             if (!$goods_infotmp) {
                 return array('state' => true);
             }
             foreach ($goods_infotmp as $k => $v) {
                 if ($store_id != $goods_infotmp['store_id']) {
                     //店铺浏览自己的商品不加入浏览历史
                     $goods_infotmp[$v['goods_id']] = $v;
                 }
             }
             if (!$goods_infotmp) {
                 return array('state' => true);
             }
             //对数组按照浏览先后进行排序
             foreach ($goods_id as $v) {
                 if ($goods_infotmp[$v]) {
                     $goods_info[$v] = $goods_infotmp[$v];
                 }
             }
         } else {
             $goods_infotmp = $model_goods->getGoodsInfoByID($goods_id, 'goods_id,gc_id,gc_id_1,gc_id_2,gc_id_3,store_id');
             if (!$goods_infotmp || $store_id == $goods_infotmp['store_id']) {
                 //店铺浏览自己的商品不加入浏览历史
                 return array('state' => true);
             }
             $goods_info[$goods_id] = $goods_infotmp;
         }
     }
     //生成缓存的键值
     $hash_key = $member_id;
     //处理浏览历史cache中商品ID
     $_cache = rcache($hash_key, 'goodsbrowse', 'goodsid');
     $goodsid_arr = $_cache['goodsid'] ? unserialize($_cache['goodsid']) : array();
     if ($goodsid_arr) {
         //如果商品ID已经存在则先删除该ID,然后在数组末尾新增该ID
         $goodsid_arr = array_diff($goodsid_arr, array_keys($goods_info));
         array_push($goodsid_arr, implode(',', array_keys($goods_info)));
     } else {
         $goodsid_arr = array_keys($goods_info);
     }
     $_cache['goodsid'] = serialize($goodsid_arr);
     //处理浏览历史cache中商品详细信息
     foreach ($goods_info as $k => $v) {
         $tmp_arr = array();
         $tmp_arr['goods_id'] = $v['goods_id'];
         $tmp_arr['member_id'] = $member_id;
         $tmp_arr['browsetime'] = $v['browsetime'] ? $v['browsetime'] : $browsetime;
         $tmp_arr['gc_id'] = $v['gc_id'];
         $tmp_arr['gc_id_1'] = $v['gc_id_1'];
         $tmp_arr['gc_id_2'] = $v['gc_id_2'];
         $tmp_arr['gc_id_3'] = $v['gc_id_3'];
         $_cache[$k] = serialize($tmp_arr);
     }
     //缓存商品信息
     wcache($hash_key, $_cache, 'goodsbrowse');
     return array('state' => true);
 }
开发者ID:dotku,项目名称:shopnc_cnnewyork,代码行数:76,代码来源:goods_browse.model.php


示例17: _wGoodsXianshiCache

 /**
  * 写入商品限时折扣缓存
  * @param int $goods_id
  * @param array $info
  * @return boolean
  */
 private function _wGoodsXianshiCache($goods_id, $info)
 {
     return wcache($goods_id, $info, 'goods_xianshi');
 }
开发者ID:flying3615,项目名称:chuniang,代码行数:10,代码来源:p_xianshi_goods.model.php


示例18: _wGoodsGiftCache

 /**
  * 写入商品公共缓存
  * @param int $goods_id
  * @param array $list
  * @return boolean
  */
 private function _wGoodsGiftCache($goods_id, $list)
 {
     return wcache($goods_id, $list, 'goods_gift');
 }
开发者ID:Maplecms,项目名称:shopnc-api,代码行数:10,代码来源:goods_gift.model.php


示例19: editlikeOp

	/**
	 * 喜欢商品(访客登录后操作)
	 */
	public function editlikeOp(){
		$obj_validate = new Validate();
		$validate_arr[] = array("input"=>$_GET["id"], "require"=>"true","message"=>Language::get('sns_likegoods_choose'));
		$obj_validate -> validateparam = $validate_arr;
		$error = $obj_validate->validate();
		if ($error != ''){
			showDialog($error,'','error');
		}
		//查询会员信息
		$member_model = Model('member');
		$member_info = $member_model->getMemberInfo(array('member_id'=>$_SESSION['member_id'],'member_state'=>1));
		if (empty($member_info)){
			showDialog(Language::get('sns_member_error'),'','error');
		}
		//查询商品信息
		$goods_model = Model('goods');
		$goods_info = $goods_model->getGoodsOnlineInfoForShare(intval($_GET["id"]));
		if (empty($goods_info)){
			showDialog(Language::get('sns_goods_error'),'','error');
		}
		$sharegoods_model = Model('sns_sharegoods');
		//判断该商品是否已经存在分享记录
		$sharegoods_info = $sharegoods_model->getSharegoodsInfo(array('share_memberid'=>"{$_SESSION['member_id']}",'share_goodsid'=>"{$goods_info['goods_id']}"));
		if (!empty($sharegoods_info) && $sharegoods_info['share_islike'] == 1){
			showDialog(Language::get('sns_likegoods_exist'),'','error');
		}
		if (empty($sharegoods_info)){
			//添加分享商品信息
			$insert_arr = array();
			$insert_arr['share_goodsid'] = $goods_info['goods_id'];
			$insert_arr['share_memberid'] = $_SESSION['member_id'];
			$insert_arr['share_membername'] = $_SESSION['member_name'];
			$insert_arr['share_content'] = '';
			$insert_arr['share_likeaddtime'] = time();
			$insert_arr['share_privacy'] = 0;
			$insert_arr['share_commentcount'] = 0;
			$insert_arr['share_islike'] = 1;
			$result = $sharegoods_model->sharegoodsAdd($insert_arr);
			unset($insert_arr);
		}else {
			//更新分享商品信息
			$update_arr = array();
			$update_arr['share_likeaddtime'] = time();
			$update_arr['share_islike'] = 1;
			$result = $sharegoods_model->editSharegoods($update_arr,array('share_id'=>"{$sharegoods_info['share_id']}"));
			unset($update_arr);
		}
		if ($result){
			//商品缓存数据更新
			//生成缓存的键值
			$hash_key = $goods_info['goods_id'];
			//先查找$hash_key缓存
			if ($_cache = rcache($hash_key,'product')){
				$_cache['likenum'] = intval($_cache['likenum'])+1;
				//缓存商品信息
				wcache($hash_key,$_cache,'product');
			}
			//更新SNS商品表信息
			$snsgoods_model = Model('sns_goods');
			$snsgoods_info = $snsgoods_model->getGoodsInfo(array('snsgoods_goodsid'=>"{$goods_info['goods_id']}"));
			if (empty($snsgoods_info)){
				//添加SNS商品
				$insert_arr = array();
				$insert_arr['snsgoods_goodsid'] = $goods_info['goods_id'];
				$insert_arr['snsgoods_goodsname'] = $goods_info['goods_name'];
				$insert_arr['snsgoods_goodsimage'] = $goods_info['goods_image'];
				$insert_arr['snsgoods_goodsprice'] = $goods_info['goods_price'];
				$insert_arr['snsgoods_storeid'] = $goods_info['store_id'];
				$insert_arr['snsgoods_storename'] = $goods_info['store_name'];
				$insert_arr['snsgoods_addtime'] = time();
				$insert_arr['snsgoods_likenum'] = 1;
				$insert_arr['snsgoods_likemember'] = "{$_SESSION['member_id']}";
				$insert_arr['snsgoods_sharenum'] = 0;
				$snsgoods_model->goodsAdd($insert_arr);
				unset($insert_arr);
			}else {
				//更新SNS商品
				$update_arr = array();
				$update_arr['snsgoods_likenum'] = intval($snsgoods_info['snsgoods_likenum'])+1;
				$likemember_arr = array();
				if (!empty($snsgoods_info['snsgoods_likemember'])){
					$likemember_arr = explode(',',$snsgoods_info['snsgoods_likemember']);
				}
				$likemember_arr[] = $_SESSION['member_id'];
				$update_arr['snsgoods_likemember'] = implode(',',$likemember_arr);
				$snsgoods_model->editGoods($update_arr,array('snsgoods_goodsid'=>"{$goods_info['goods_id']}"));
			}
			//添加喜欢动态
			$tracelog_model = Model('sns_tracelog');
			$insert_arr = array();
			$insert_arr['trace_originalid'] = '0';
			$insert_arr['trace_originalmemberid'] = '0';
			$insert_arr['trace_memberid'] = $_SESSION['member_id'];
			$insert_arr['trace_membername'] = $_SESSION['member_name'];
			$insert_arr['trace_memberavatar'] = $member_info['member_avatar'];
			$insert_arr['trace_title'] = Language::get('sns_likegoods_title');
			$content_str = '';
//.........这里部分代码省略.........
开发者ID:noikiy,项目名称:ejia,代码行数:101,代码来源:member_snsindex.php


示例20: get_member_info

 /**
  * 会员信息
  *
  * @return array
  */
 public function get_member_info()
 {
     //生成缓存的键值
     $hash_key = $this->master_id;
     if ($hash_key <= 0) {
         showMessage(L('wrong_argument'), '', '', 'error');
     }
     //写入缓存的数据
     $cachekey_arr = array('member_name', 'store_id', 'member_avatar', 'member_qq', 'member_email', 'member_ww', 'member_goldnum', 'member_points', 'available_predeposit', 'member_snsvisitnum', 'credit_arr', 'fan_count', 'attention_count');
     //先查找$hash_key缓存
     if ($_cache = rcache($hash_key, 'sns_member')) {
         foreach ($_cache as $k => $v) {
             $member_info[$k] = $v;
         }
     } else {
         $model = Model();
         $member_info = $model->table('member')->where(array('member_id' => $this->master_id))->find();
         if (empty($member_info)) {
             showMessage(L('wrong_argument'), 'index.php?act=member_snshome', '', 'error');
         }
         //粉丝数
         $fan_count = $model->table('sns_friend')->where(array('friend_tomid' => $this->master_id))->count();
         $member_info['fan_count'] = $fan_count;
         //关注数
         $attention_count = $model->table('sns_friend')->where(array('friend_frommid' => $this->master_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' => $this->master_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($hash_key, $member_info, 'sns_member');
     }
     Tpl::output('member_info', $member_info);
     return $member_info;
 }
开发者ID:Maplecms,项目名称:shopnc-yhmall,代码行数:45,代码来源:control.php



注:本文中的wcache函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wcj_get_invoice_types函数代码示例发布时间:2022-05-23
下一篇:
PHP wc_walk_category_dropdown_tree函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap