<?php
// +----------------------------------------------------------------------
// | Yershop 开源网店系统
// +----------------------------------------------------------------------
// | Copyright (c) 2014 http://www.yershop.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: liuwei <1010422715@qq.com>
// +----------------------------------------------------------------------
namespace app\seller\controller;
use think\Controller;
use think\Db;
class Login extends Controller {

/* 登录页面 */
	public function index(){
		  $user=new \app\common\model\User; 
		  $res=$user->login();
		 if($res){
		
				
					//TODO:跳转到登录前页面            
					 $url= url('index/index');
				     $data['url']=$url;
                     $data['code']=1;
				     $this->success("登录成功",$url);
			       
		

			} else { //登录失败
				$this->error("密码或账号错误");
			}

		} else {  	
		      $meta_title = '会员登录';	
			 
			 //显示登录表单
			  return $this->fetch("index/login");
		}
	}
    /* 退出登录 */
    public function logout(){
        if(is_login()){
           $Member=new \app\admin\model\Member;
		   $Member->logout();
            session('[destroy]');
            $this->success('退出成功！', U('index'));
        } else {
            $this->redirect('login');
        }
    }

    public function verify(){
        $verify = new \Think\Verify();
        $verify->entry(1);
    }

}
