session_id = session_id(); // 当前的 session_id define('SESSION_ID',$this->session_id); //将当前的session_id保存为常量,供其它方法调用 // 判断当前用户是否手机 if(isMobile()) cookie('is_mobile','1',3600); else cookie('is_mobile','0',3600); $this->public_assign(); } /** * 保存公告变量到 smarty中 比如 导航 */ public function public_assign() { $tpshop_config = array(); $tp_config = M('config')->cache(true,TPSHOP_CACHE_TIME)->select(); if($tp_config){ foreach($tp_config as $k => $v) { if($v['name'] == 'hot_keywords'){ $tpshop_config['hot_keywords'] = explode('|', $v['value']); } $tpshop_config[$v['inc_type'].'_'.$v['name']] = $v['value']; } } if(empty($tpshop_config["integral_point_rate"])) $tpshop_config["integral_point_rate"] = 10; $goods_category_tree = get_goods_category_tree(); $this->cateTrre = $goods_category_tree; $this->assign('goods_category_tree', $goods_category_tree); $brand_list = M('brand')->cache(true)->field('id,name,parent_cat_id,logo,is_hot')->where("parent_cat_id>0")->select(); $this->assign('brand_list', $brand_list); $this->assign('tpshop_config', $tpshop_config); $user = session('user'); $this->assign('username',$user['nickname']); //PC端首页"手机端、APP二维码" $store_logo = tpCache('shop_info.shop_info_store_logo'); $store_logo ? $head_pic = $store_logo: $head_pic ='/public/static/images/logo/pc_home_logo_default.png'; $mobile_url = "http://{$_SERVER['HTTP_HOST']}".U('Mobile/index/app_down'); $this->assign('head_pic', "http://{$_SERVER['HTTP_HOST']}/".$head_pic); $this->assign('mobile_url', $mobile_url); } /* * */ public function ajaxReturn($data) { exit(json_encode($data)); } }