Ejemplo n.º 1
0
 public function index()
 {
     /**首页统计代码实现**/
     if (1 == C('IP_TONGJI')) {
         $id = "index";
         $record = IpLookup("", 1, $id);
     }
     $cate = M('Category');
     $catelist = $this->menulist();
     $this->assign('categoryq', $catelist);
     $user = M('category');
     $id = $user->where('display=1 and pid=0')->getField('id', true);
     $this->assign('arrr', $id);
     /** 幻灯片调用* */
     $slide = get_slide();
     $this->assign('slide', $slide);
     /** 限时抢购调用* */
     $timelist = $this->timelist();
     $this->assign('timelist', $timelist);
     /** 最新上架调用**/
     $bytime = $this->bytime();
     $this->assign('bytime', $bytime);
     $totalsales = $this->totalsales();
     /** 热卖调用*/
     $this->assign('totalsales', $totalsales);
     $Carousel = $this->Carousel();
     $this->assign('carousel', $Carousel);
     /** 热词调用**/
     $hotsearch = $this->getHotsearch();
     $this->assign('hotsearch', $hotsearch);
     $tree = $this->maketree();
     $this->assign('category', $tree);
     $this->meta_title = '首页';
     $this->display();
 }
Ejemplo n.º 2
0
 public function index()
 {
     /* 左侧菜单 */
     $menu = R('index/menulist');
     $this->assign('categoryq', $menu);
     /**
      * 购物车调用
      */
     $cart = R("shopcart/usercart");
     $this->assign('usercart', $cart);
     if (!session('user_auth')) {
         $usercart = $_SESSION['cart'];
         $this->assign('usercart', $usercart);
     }
     /*栏目页统计代码实现,tag=2*/
     if (1 == C('IP_TONGJI')) {
         $record = IpLookup("", 4, $name);
     }
     /* 热词调用*/
     $hotsearch = R("Index/getHotsearch");
     $this->assign('hotsearch', $hotsearch);
     /* 分类信息 */
     $id = I('get.id');
     //获取id
     $this->assign('id', $id);
     $this->display();
 }
Ejemplo n.º 3
0
 public function index()
 {
     /**
      * 菜单调用
      */
     /*首页统计代码实现*/
     if (1 == C('IP_TONGJI')) {
         $id = "index";
         $record = IpLookup("", 1, $id);
     }
     $cate = M('Category');
     $catelist = $this->menulist();
     $this->assign('categoryq', $catelist);
     $this->assign('page', D('Document')->page);
     //分页
     $user = M('category');
     $id = $user->where('display=1 and pid=0')->getField('id', true);
     $this->assign('arrr', $id);
     //文章列表
     /** 幻灯片调用* */
     $slide = get_slide();
     $this->assign('slide', $slide);
     //文章列表
     /** 限时抢购调用* */
     $timelist = $this->timelist();
     $this->assign('timelist', $timelist);
     /**
      * 最新上架调用
      */
     $bytime = $this->bytime();
     $this->assign('bytime', $bytime);
     $totalsales = $this->totalsales();
     /**
      * 热卖调用
      */
     $this->assign('totalsales', $totalsales);
     $Carousel = $this->Carousel();
     $this->assign('carousel', $Carousel);
     /**
      * 热词调用
      */
     $hotsearch = $this->getHotsearch();
     $this->assign('hotsearch', $hotsearch);
     /**
      * 购物车调用
      */
     $cart = R("shopcart/usercart");
     $this->assign('usercart', $cart);
     if (!session('user_auth')) {
         $usercart = $_SESSION['cart'];
         $this->assign('usercart', $usercart);
     }
     $adlist = $this->goodlist();
     $this->assign('articlelist', $adlist);
     $this->display();
 }
Ejemplo n.º 4
0
 public function index()
 {
     /**首页统计代码实现**/
     if (1 == C('IP_TONGJI')) {
         $id = "index";
         $record = IpLookup("", 1, $id);
     }
     $cate = M('Category');
     $catelist = $this->menulist();
     $this->assign('categoryq', $catelist);
     $user = M('category');
     $id = $user->where('display=1 and pid=0')->getField('id', true);
     $this->assign('arrr', $id);
     /** 幻灯片调用* */
     $slide = get_slide();
     $this->assign('slide', $slide);
     /** 限时抢购调用* */
     $timelist = $this->timelist();
     $this->assign('timelist', $timelist);
     /** 最新上架调用**/
     $bytime = $this->bytime();
     $this->assign('bytime', $bytime);
     $totalsales = $this->totalsales();
     /** 热卖调用*/
     $this->assign('totalsales', $totalsales);
     $Carousel = $this->Carousel();
     $this->assign('carousel', $Carousel);
     /** 热词调用**/
     $hotsearch = $this->getHotsearch();
     $this->assign('hotsearch', $hotsearch);
     /**购物车调用**/
     $cart = R("shopcart/usercart");
     $this->assign('usercart', $cart);
     if (!session('user_auth')) {
         $usercart = $_SESSION['cart'];
         $this->assign('usercart', $usercart);
     }
     /** 底部分类调用**/
     $menulist = R('Service/AllMenu');
     $this->assign('footermenu', $menulist);
     $tree = $this->maketree();
     $this->assign('category', $tree);
     /** 公告分类调用**/
     $notice = M('document')->order('id desc')->where("category_id='56'")->limit(8)->select();
     $this->assign('notice', $notice);
     /** 活动分类调用**/
     $activity = M('document')->order('id desc')->where("category_id='70'")->limit(8)->select();
     $this->assign('activity', $activity);
     $this->meta_title = '首页';
     $this->display();
 }
Ejemplo n.º 5
0
 public function index()
 {
     /**首页统计代码实现**/
     if (1 == C('IP_TONGJI')) {
         $id = "index";
         $record = IpLookup("", 1, $id);
     }
     //左导航
     $cate = M('Category');
     $catelist = $this->menulist();
     $result['$catelist'] = $catelist;
     //分页
     $this->assign('page', D('Document')->page);
     $user = M('category');
     $ids = $user->where('display=1 and pid=0')->getField('id', true);
     $result['page'] = $ids;
     /** 幻灯片调用* */
     $slide = get_slide();
     $result['slide'] = $slide;
     /** 限时抢购调用* */
     $time_list = $this->timelist();
     $result['time_list'] = $time_list;
     /** 最新上架调用**/
     $bytime = $this->bytime();
     $result['bytime'] = $bytime;
     /** 折扣 */
     $totalsales = $this->totalsales();
     $result['totalsales'] = $totalsales;
     /** 热卖调用*/
     $carousel = $this->Carousel();
     $result['carousel'] = $carousel;
     /** 热词调用**/
     $hotsearch = $this->getHotsearch();
     $result['hotsearch'] = $hotsearch;
     /**购物车调用**/
     $usercart = D("shopcart")->getcart();
     $result['usercart'] = $usercart;
     if (!session('user_auth')) {
         $usercart = $_SESSION['cart'];
         $result['usercart'] = $usercart;
     }
     /** 底部分类调用**/
     $footermenu = R('Service/AllMenu');
     $result['footermenu'] = $footermenu;
     /** 楼梯 **/
     $tree = $this->maketree();
     $this->assign('category', $tree);
     $result['tree'] = $tree;
     $this->ajaxReturn($result);
 }
Ejemplo n.º 6
0
 public function index()
 {
     /**首页统计代码实现**/
     if (1 == C('IP_TONGJI')) {
         $id = "index";
         $record = IpLookup("", 1, $id);
     }
     //左导航
     $cate = M('Category');
     $catelist = $this->menulist();
     $this->assign('categoryq', $catelist);
     $this->assign('page', D('Document')->page);
     //分页
     $user = M('category');
     $id = $user->where('display=1 and pid=0')->getField('id', true);
     $this->assign('arrr', $id);
     /** 幻灯片调用* */
     $slide = get_slide();
     $this->assign('slide', $slide);
     /** 限时抢购调用* */
     $timelist = $this->timelist();
     $this->assign('timelist', $timelist);
     /** 最新上架调用**/
     $bytime = $this->bytime();
     $this->assign('bytime', $bytime);
     $totalsales = $this->totalsales();
     /** 热卖调用*/
     $this->assign('totalsales', $totalsales);
     $Carousel = $this->Carousel();
     $this->assign('carousel', $Carousel);
     /** 热词调用**/
     $hotsearch = $this->getHotsearch();
     $this->assign('hotsearch', $hotsearch);
     /**购物车调用**/
     $cart = D("shopcart")->getcart();
     $this->assign('usercart', $cart);
     if (!session('user_auth')) {
         $usercart = $_SESSION['cart'];
         $this->assign('usercart', $usercart);
     }
     /** 底部分类调用**/
     $menulist = R('Service/AllMenu');
     $this->assign('footermenu', $menulist);
     /** 楼梯 **/
     $tree = $this->maketree();
     $this->assign('category', $tree);
     $this->meta_title = '首页';
     $this->display();
 }
Ejemplo n.º 7
0
 public function detail()
 {
     /*栏目页统计代码实现,tag=2*/
     if (1 == C('IP_TONGJI')) {
         $record = IpLookup("", 2, $name);
     }
     $id = I('get.id', 0, 'intval');
     /*获取文章明细*/
     if (!empty($id)) {
         $info = D('Document')->detail($id);
     }
     $pid = $info['category_id'];
     //分类一维数组
     $category = M("category")->where("id='{$pid}'")->find();
     /*设置网站标题,一维数组*/
     $this->meta_title = $category['title'];
     $this->assign('info', $info);
     $this->display();
 }
Ejemplo n.º 8
0
 public function index()
 {
     /* 左侧菜单 */
     $menu = R('index/menulist');
     $this->assign('categoryq', $menu);
     /**
      * 购物车调用
      */
     $cart = R("shopcart/usercart");
     $this->assign('usercart', $cart);
     if (!session('user_auth')) {
         $usercart = $_SESSION['cart'];
         $this->assign('usercart', $usercart);
     }
     /*栏目页统计代码实现,tag=2*/
     if (1 == C('IP_TONGJI')) {
         $record = IpLookup("", 2, $name);
     }
     /* 热词调用*/
     $hotsearch = R("Index/getHotsearch");
     $this->assign('hotsearch', $hotsearch);
     /* 分类信息id */
     $id = I('get.id');
     //分类一维数组
     $category = M("category")->where("id='{$id}'")->find();
     //获取最大的文章id
     $info = M("document")->where("category_id='{$id}'and model_id='2'")->order("id desc")->limit(1)->find();
     /*获取文章明细*/
     if (!empty($info)) {
         $data = D('Document')->detail($info['id']);
     }
     /*设置网站标题,一维数组*/
     $pid = $category['pid'];
     $pcategory = M("category")->where("id='{$pid}'")->find();
     $this->meta_title = $category['title'] . "-" . $pcategory['title'];
     $position = "<p class='red fwb'>" . $pcategory['title'] . "</p>><p class='red fwb'>" . $category['title'] . "</p>";
     $this->assign('position', $position);
     $this->assign('info', $data);
     $menulist = $this->AllMenu();
     $this->assign('footermenu', $menulist);
     $this->display();
 }
Ejemplo n.º 9
0
 public function index()
 {
     /**首页统计代码实现**/
     $ip_tongji = C('IP_TONGJI');
     if (1 == $ip_tongji) {
         $id = "index";
         $record = IpLookup("", 1, $id);
     }
     /** 幻灯片调用* */
     if (S(C('HOME_SLIDE_BANNER'))) {
         $slide = S(C('HOME_SLIDE_BANNER'));
     } else {
         $slide = get_slide();
         S(C('HOME_SLIDE_BANNER'), $slide, 3600 * 24 * 30);
     }
     $this->assign('slide', $slide);
     /** 限时抢购调用* */
     /*$timelist=$this->timelist();
       $this->assign('timelist',$timelist);*/
     /** 最新上架调用**/
     /*$bytime=$this->bytime();
       $this->assign('bytime',$bytime);*/
     /** 热卖调用*/
     /*$totalsales=$this->totalsales();
       $this->assign('totalsales',$totalsales);
       $Carousel=$this->Carousel();
       $this->assign('carousel',$Carousel);*/
     /** 热词调用 热门搜索**/
     $hotsearch = C('HOT_SEARCH');
     $this->assign('hotsearch', $hotsearch);
     /**   主体商品内容    **/
     $tree = S(C('HOME_SHOP_CENTER'));
     if (empty($tree)) {
         $tree = $this->maketree();
         S(C('HOME_SHOP_CENTER'), $tree, 3600 * 24 * 5);
     }
     $this->assign('category', $tree);
     $this->meta_title = '首页';
     $this->display();
 }
Ejemplo n.º 10
0
 public function index()
 {
     // cookie自动登录
     if (!is_login() && cookie('username') && cookie('password')) {
         $username = cookie('username');
         $password = cookie('password');
         $username = safe_replace($username);
         //过滤
         $user = new UserApi();
         $uid = $user->login($username, $password);
         if (0 < $uid) {
             //UC登录成功
             /* 登录用户 */
             $Member = D("Member");
             if ($Member->login($uid)) {
                 //登录用户,记录日志
                 addUserLog('cookie登陆成功', $uid);
             }
         }
     }
     if (1 == C('IP_TONGJI')) {
         $title = "index";
         /**首页统计代码实现 status=1**/
         $record = IpLookup("", 1, $title);
     }
     /** 幻灯片* */
     $slide = D('slide')->get_slide();
     $this->assign('slide', $slide);
     /** 顶级栏目* */
     $tree = D('Category')->maketree();
     $this->assign('tree', $tree);
     /** 公告分类**/
     $notice = M('document')->order('id desc')->where("category_id='56'")->limit(8)->select();
     $this->assign('notice', $notice);
     /** 活动分类**/
     $activity = M('document')->order('id desc')->where("category_id='70'")->limit(8)->select();
     $this->assign('activity', $activity);
     $this->meta_title = '首页';
     $this->display();
 }
Ejemplo n.º 11
0
 public function index()
 {
     /** 分类信息id **/
     $id = I('get.id');
     if (empty($id)) {
         $this->error('对不起,参数有误!');
     }
     /*栏目页统计代码实现,tag=2*/
     if (1 == C('IP_TONGJI')) {
         $record = IpLookup("", 2, 'server');
     }
     /** 热词调用 热门搜索**/
     $hotsearch = C('HOT_SEARCH');
     $this->assign('hotsearch', $hotsearch);
     //分类一维数组
     $category = M("category")->where("id='{$id}'")->field('id,name,pid,title')->find();
     //获取最大的文章id
     $info = M("document")->where("category_id='{$id}'and model_id='2'")->order("id desc")->field('id')->limit(1)->find();
     /**获取文章明细**/
     if (!empty($info)) {
         $data = D('Document')->detail($info['id']);
     }
     /**设置网站标题,一维数组**/
     $pid = $category['pid'];
     $pcategory = M("category")->where("id='{$pid}'")->field('title')->find();
     $this->meta_title = $category['title'] . "-" . $pcategory['title'];
     $position = "<p class='red fwb'>" . $pcategory['title'] . "</p>><p class='red fwb'>" . $category['title'] . "</p>";
     $this->assign('position', $position);
     $this->assign('info', $data);
     $serverMenuList = S(C('HOME_SERVER_MENU'));
     if (empty($serverMenuList)) {
         $serverMenuList = $this->AllMenu();
         S(C('HOME_SERVER_MENU'), $serverMenuList, 3600 * 24 * 30);
         //缓存一个月
     }
     $this->assign('serverMenuList', $serverMenuList);
     $this->assign('curr_id', $id);
     $this->display();
 }
Ejemplo n.º 12
0
 public function detail($id = 0, $p = 1)
 {
     /* 热词调用*/
     $hotsearch = C('HOT_SEARCH');
     $this->assign('hotsearch', $hotsearch);
     /* 标识正确性检测 */
     if (!($id && is_numeric($id))) {
         $this->error('不存在该商品!');
     }
     /* 获取详细信息 */
     $Document = D('Document');
     $info = $Document->detail($id);
     if (!$info) {
         $this->error($Document->getError());
     }
     /* 分类信息 */
     $category = $this->category($info['category_id']);
     /* 获取模板 */
     if (!empty($info['template'])) {
         //已定制模板
         $tmpl = $info['template'];
     } elseif (!empty($category['template_detail'])) {
         //分类已定制模板
         $tmpl = $category['template_detail'];
     } else {
         //使用默认模板
         $tmpl = 'Article/' . get_document_model($info['model_id'], 'name') . '/detail';
     }
     /* 更新浏览数 */
     $map = array('id' => $id);
     $Document->where($map)->setInc('view');
     /*内容页统计代码实现,tag=3*/
     if (1 == C('IP_TONGJI')) {
         $record = IpLookup("", 3, $id);
     }
     /**获取商品所有评论**/
     $comment = M('comment');
     $count = $comment->where("status='1' and goodid='{$id}'")->count();
     //计算记录数
     $this->assign('count', $count);
     $limitRows = 5;
     // 设置每页记录数
     $p = new \Think\AjaxPage($count, $limitRows, "comment");
     //第三个参数是你需要调用换页的ajax函数名
     $limit_value = $p->firstRow . "," . $p->listRows;
     $data = $comment->where("status='1' and goodid='{$id}'")->order('id desc')->limit($limit_value)->select();
     // 查询数据
     $page = $p->show();
     // 产生分页信息,AJAX的连接在此处生成
     $this->assign('list', $data);
     $this->assign('page', $page);
     /**获取商品所有好评**/
     $comment = M('comment');
     $countbetter = $comment->where("status='1' and goodid='{$id}' and score='3'")->count();
     //计算记录数
     $this->assign('countbetter', $countbetter);
     $limitRowsbetter = 5;
     // 设置每页记录数
     $pbetter = new \Think\AjaxPage($countbetter, $limitRowsbetter, "commentgood");
     //第三个参数是你需要调用换页的ajax函数名
     $limitbetter = $pbetter->firstRow . "," . $pbetter->listRows;
     $listbetter = $comment->where("status='1' and goodid='{$id}' and score='3'")->order('id desc')->limit($limitbetter)->select();
     // 查询数据
     $pagebetter = $pbetter->show();
     // 产生分页信息,AJAX的连接在此处生成
     $this->assign('listbetter', $listbetter);
     $this->assign('pagebetter', $pagebetter);
     /**获取商品所有中评**/
     $comment = M('comment');
     $countmiddle = $comment->where("status='1' and goodid='{$id}' and score='2'")->count();
     //计算记录数
     $this->assign('countmiddle ', $countmiddle);
     $limitRows = 5;
     // 设置每页记录数
     $pmiddle = new \Think\AjaxPage($countmiddle, $limitRows, "commentmiddle");
     //第三个参数是你需要调用换页的ajax函数名
     $limitmiddle = $pmiddle->firstRow . "," . $pmiddle->listRows;
     $datamiddle = $comment->where("status='1' and goodid='{$id}' and score='2'")->order('id desc')->limit($limitmiddle)->select();
     // 查询数据
     $pagemiddle = $pmiddle->show();
     // 产生分页信息,AJAX的连接在此处生成
     $this->assign('listmiddle', $datamiddle);
     $this->assign('pagemiddle', $pagemiddle);
     /**获取商品所有差评**/
     $comment = M('comment');
     $countworse = $comment->where("status='1' and goodid='{$id}' and score='1'")->count();
     //计算记录数
     $this->assign('countworse ', $countworse);
     $limitRows = 5;
     // 设置每页记录数
     $pworse = new \Think\AjaxPage($countworse, $limitRows, "commentworse");
     //第三个参数是你需要调用换页的ajax函数名
     $limitworse = $pworse->firstRow . "," . $pworse->listRows;
     $dataworse = $comment->where("status='1' and goodid='{$id}' and score='1'")->order('id desc')->limit($limitworse)->select();
     // 查询数据
     $pageworse = $pworse->show();
     // 产生分页信息,AJAX的连接在此处生成
     $this->assign('listworse', $dataworse);
     $this->assign('pageworse', $pageworse);
     /** 好评率 **/
     $rate = $countbetter / $count * 100;
     $this->assign('rate', $rate);
     /** 咨询管理 **/
     $message = M("message");
     $reply = M("reply");
     $countmessage = $message->where(" goodid='{$id}'")->count();
     $Pagequestion = new \Think\AjaxPage($countmessage, 5, "quest");
     $limitquestion = $Pagequestion->firstRow . "," . $Pagequestion->listRows;
     $showquestion = $Pagequestion->show();
     $listquestion = $message->where("goodid='{$id}'")->order('id desc')->limit($limitquestion)->select();
     foreach ($listquestion as $n => $val) {
         $listquestion[$n]['id'] = $reply->where('messageid=\'' . $val['id'] . '\'')->select();
     }
     $this->assign('listquestion', $listquestion);
     // 赋值数据集
     $this->assign('pagequestion', $showquestion);
     //
     /* 模板赋值并渲染模板 */
     $this->assign('category', $category);
     $this->assign('info', $info);
     $this->meta_title = $info["title"];
     $this->display($tmpl);
 }
 public function activity($id)
 {
     /* 左侧菜单 */
     $menu = R('index/menulist');
     $this->assign('categoryq', $menu);
     /**
      * 购物车调用
      */
     $cart = R("shopcart/usercart");
     $this->assign('usercart', $cart);
     if (!session('user_auth')) {
         $usercart = $_SESSION['cart'];
         $this->assign('usercart', $usercart);
     }
     /*栏目页统计代码实现,tag=2*/
     if (1 == C('IP_TONGJI')) {
         $record = IpLookup("", 2, $name);
     }
     /* 热词调用*/
     $hotsearch = R("Index/getHotsearch");
     $this->assign('hotsearch', $hotsearch);
     $slideid = $id ? $id : I('get.id', 0);
     //获取分类的英文名称
     /* 获取活动标题*/
     $title = M('slide')->where("id='{$slideid}'")->getField("title");
     $this->assign('title', $title);
     // 赋值数据集
     /* 获取商品*/
     $User = M("slideid");
     $count = M('slideid')->where("slidepid='{$slideid}'")->count();
     $Page = new \Think\Page($count, 12);
     $Page->setConfig('prev', '上一页');
     $Page->setConfig('next', '下一页');
     $Page->setConfig('first', '第一页');
     $Page->setConfig('last', '尾页');
     $Page->setConfig('theme', '%FIRST% %UP_PAGE% %LINK_PAGE% %DOWN_PAGE% %END% %HEADER%');
     $show = $Page->show();
     $list = $User->where("slidepid='{$slideid}' ")->limit($Page->firstRow . ',' . $Page->listRows)->select();
     $this->assign('list', $list);
     // 赋值数据集
     $this->assign('page', $show);
     // 赋值分页输出 $this->display();
     $this->display();
 }
Ejemplo n.º 14
0
 public function detail($id = 0, $p = 1)
 {
     /* 热词调用*/
     $hotsearch = R("Index/getHotsearch");
     $this->assign('hotsearch', $hotsearch);
     /* 购物车调用*/
     $cart = R("Shopcart/usercart");
     $this->assign('usercart', $cart);
     if (!session('user_auth')) {
         $usercart = $_SESSION['cart'];
         $this->assign('usercart', $usercart);
     }
     /* 左侧分类列表*/
     $mlist = R('Index/menulist');
     $this->assign('categoryq', $mlist);
     /* 浏览量排行前7个商品*/
     $view = M('Document')->where("display=1")->order("view desc")->select();
     $this->assign('viewlist', $view);
     /* 标识正确性检测 */
     if (!($id && is_numeric($id))) {
         $this->error('文档ID错误!');
     }
     /* 页码检测 */
     $p = intval($p);
     $p = empty($p) ? 1 : $p;
     /* 获取详细信息 */
     $Document = D('Document');
     $info = $Document->detail($id);
     if (!$info) {
         $this->error($Document->getError());
     }
     /* 分类信息 */
     $category = $this->category($info['category_id']);
     /* 获取模板 */
     if (!empty($info['template'])) {
         //已定制模板
         $tmpl = $info['template'];
     } elseif (!empty($category['template_detail'])) {
         //分类已定制模板
         $tmpl = $category['template_detail'];
     } else {
         //使用默认模板
         $tmpl = 'Article/' . get_document_model($info['model_id'], 'name') . '/detail';
     }
     /* 更新浏览数 */
     $map = array('id' => $id);
     $Document->where($map)->setInc('view');
     /*内容页统计代码实现,tag=3*/
     if (1 == C('IP_TONGJI')) {
         $record = IpLookup("", 3, $id);
     }
     /* 模板赋值并渲染模板 */
     $this->assign('category', $category);
     $this->assign('info', $info);
     $this->assign('page', $p);
     //页码
     $this->display($tmpl);
 }