<?php
namespace app\index\controller;
use think\Controller;
use think\Db;
/*
首页等页面
*/
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2020 http://myucms.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: 梦雨 <50361804@qq.com>
// +----------------------------------------------------------------------
class Index extends Controller
{
    //首页
    public function index()
    {
        return view();
    }
	//列表
    public function lists()
    {
		$c=Db::name('cateShop')->where(array('alias'=>input('alias')))->find();
        $this->assign('c',$c);
          
        return view();
    }
	//详情
    public function item()
    {
    	
		$c=Db::name('shop')->where(array('id'=>input('id'),'open'=>1))->find();
        $this->assign('c',$c);
        if (empty($c['id'])) {
            return $this->error('亲！你迷路了');
        }
         Db::name('shop')->where('id', input('id'))->setInc('view', 1);
         
    	//足迹添加
    	 if (session('userid')) {
           
       //查询是否有记录
       if (fun_st('foot',array('tid'=>input('id'),'uid'=>session('userid')))!=0) {
       	Db::name('foot')->where(array('tid'=>input('id'),'uid'=>session('userid')))->setInc('view', 1);
       } else {
 
    $data['uid'] = session('userid');
        $data['time'] = time();
        $data['open'] = 1;
        $data['tid'] = input('id');
 
           Db::name('foot')->insert($data);
    	 }
    }
        return view();
    }
    //注册
    public function reg()
    {
        return view();
    }
    //登陆
    public function login()
    {
    	if (session('userid') != '') {
            $this->error('您已登录',url('index/index/index'));
        }
        return view();
    }
    //找回密码
    public function forget()
    {
        return view();
    }
    //搜索
    public function  soso()
    {
        return view();
    }
    //文章列表
    public function  article()
    {
        return view();
    }
	//文章详情
    public function html()
    {
    	
		$c=Db::name('article')->where(array('id'=>input('id'),'open'=>1))->find();
        $this->assign('c',$c);
        if (empty($c['id'])) {
            return $this->error('亲！你迷路了');
        }
         Db::name('article')->where('id', input('id'))->setInc('view', 1);
         
        return view();
    }
}