<?php
// +----------------------------------------------------------------------
// | 全店热恋
// +----------------------------------------------------------------------
// | Author: 自己人
// +----------------------------------------------------------------------
namespace Home\Controller;
use Think\Controller;

class LoveShopController extends BaseController{
	
	/*首页*/
	public function index(){
			 /*if(!$this->isMobile()){
	        		$this->redirect('LoveShop/PcUrl/');
	    	 }*/
	    	$groupId=23; //主推专题组
	 		$groupSpecial=M('shop_group_special');
		    $special=M('shop_special');
		    $groupInfo=$groupSpecial->find($groupId);
		    $groupAllid=$groupInfo['allid'];
	    	/*首次加取5条*/
		    $map['hide']  =  array('eq','0');
		    $map['id']  =  array('in',$groupAllid);
		    $specialList=$special->where($map)->order('id desc')->select();
		    /*自定义店名*/
		    $dealerInfo=$this->DealerInfo;
		    $this->assign(compact('groupInfo','specialList','sig','dealerInfo'));
		    $this->display();
	}

	/*促销*/
	public function cheap(){
		$map['hide']  =  array('eq',0);
		$map['SiteName']  =  array('eq','LV');
		$list=M('shop_cheap')->field('id,imgs,name,tag,shopid,info')->where($map)->select();
		shuffle($list);
		foreach($list as $i=>$v){
				if(!empty($list[$i]['imgs'])){
					$list[$i]['imgs']='/'.dirname($list[$i]['imgs']).'/480_'.basename($list[$i]['imgs']); //获取不同尺寸图片
				}
		     	$shopid=explode(',',$list[$i]['shopid']);
		     	$list[$i]['shopid']=$shopid[0];
		}
		$dealerInfo=$this->DealerInfo;
		$this->assign(compact('list','sig','dealerInfo'));
		$this->display();
	}

	/*PC端*/
	public function PcUrl(){
			$sitename=$this->FromSiteName; //二级域名
			$userinfo=$this->DealerInfo; 
			$this->assign(compact('sitename','userinfo'));
		    $this->display();
	}
	
}