assign('rank_switch',$rank_switch); $this->assign('mz_switch',$mz_switch); /*--制作自定义导航--*/ $ms=M('store_footer')->where('store_id',getMobileStoId())->field('id') ->where('is_use',1)->find(); if($ms){ $pa='/public/template/footer/'.getMobileStoId().'/'.$ms['id'].'.html'; if(!file_exists(ROOT_PATH.$pa)) { $pa="public/empty";} else{ $pa=".".$pa; } $this->assign('fcustom_footer', $pa); }else{ $this->assign('fcustom_footer', 'public/empty'); } } public function template() { $stoid=getMobileStoId(); // if($stoid!=1 && $stoid!=23 && $stoid!=39) { // if (!strstr($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger')) { // echo "
请在微信浏览器中打开!
"; // die; // // } // } //delFile2(TEMP_PATH . "/" . getAdmStoId()); $stoid=I('stoid'); $sn = I('sn'); $rm=M('store_module')->where('template_sn',$sn)->where('store_id',$stoid)->find(); $title=$rm['page_title']; $descr=$rm['page_describe']; /*--文件路径--*/ $p="./public/template/feature/".$stoid.'/'.$sn.".html"; $bk=$rm['bkcolor']; if(!file_exists(ROOT_PATH."/public/template/feature/".$stoid.'/'.$sn.".html")){ echo "
未找到模板文件!
"; return; } $user = session('user'); $rank_switch = tpCache('shopping.rank_switch',$stoid);//等级价格 $mz_switch = tpCache('shopping.is_beauty',$stoid);//美妆价格 $this->assign('rank_switch',$rank_switch); $this->assign('mz_switch',$mz_switch); if (!empty($rank_switch)){ $rand_end= empty($user['card_expiredate'])?0:strtotime($user['card_expiredate']); $card_field=$user['card_field']; if($rand_end>0){ $card_field=$rand_end>time()?$user['card_field']:0; } $this->assign('rank_field',$user['card_field']); //----读取等级卡标签--- $all_card=get_plus_price_arr($stoid); if($all_card) { $this->assign('all_card',$all_card); foreach ($all_card as $kl => $vl) { if ($vl) { switch ($vl['CorrPrice']) { case "Price1": $new_card_dd['cardprice1'] = $vl['CardName']; break; case "Price2": $new_card_dd['cardprice2'] = $vl['CardName']; break; case "Price3": $new_card_dd['cardprice3'] = $vl['CardName']; break; } } } $card_label = $new_card_dd[$card_field]; $len = mb_strlen($card_label, "utf-8"); if ($len > 4) $card_label = mb_substr($card_label, 0, 4, "utf-8"); $this->assign('card_label', $card_label); } } if (!empty($mz_switch)){ $this->assign('mz_vip',$user['is_mzvip']); } $this->assign('p', $p); $this->assign('title', $title); $this->assign('descr', $descr); $this->assign('bk', $bk); $this->assign('isright', $rm['isright']); $this->assign('moddesc',$rm['page_describe']); if(empty($stoid)) return $this->fetch(); else return $this->fetch("",$stoid,0); } public function manatemplate() { /*--删除手机展示缓存--*/ delFile2(TEMP_PATH."/manager_template"); $sn = I('sn'); $rm=M('store_module')->where('template_sn',$sn)->find(); $title=$rm['page_title']; $descr=$rm['page_describe']; /*--文件路径--*/ $p="./public/template/feature/".$sn.".html"; $str=$p; $this->assign('str', $str); $this->assign('title', $title); $this->assign('descr', $descr); $this->assign('isright', $rm['isright']); $bk=$rm['bkcolor']; $this->assign('bk', $bk); return $this->fetch("","manager_template"); } public function s_manatemplate() { if (!strstr($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger')) { echo "
请在微信浏览器中打开!
"; die; } /*--删除手机展示缓存--*/ delFile2(TEMP_PATH."/manager_template"); $sn = I('sn'); $rm=M('store_module')->where('template_sn',$sn)->find(); $title=$rm['page_title']; $descr=$rm['page_describe']; /*--文件路径--*/ $p="./public/template/feature/".$sn.".html"; $str=$p; $this->assign('str', $str); $this->assign('title', $title); $this->assign('descr', $descr); $this->assign('isright', $rm['isright']); $bk=$rm['bkcolor']; $this->assign('bk', $bk); return $this->fetch("manatemplate",'manager_template',0); } /*------------------------加载更多的control方法--------------------*/ /*--商品分组,手动选择--*/ public function getmoreid(){ /*--第几页,限制多少条---*/ $p=I("p/d"); $limit=I('lim/d'); $stoid=I('stoid/d',1); $colnum=I('col/d'); $goodstit=I('isgoodstit'); $goodsprice=I('isgoodsprice'); $goodsnum=I('isgoodsnum'); $goodicon=I('tgoodicon/d'); $styleicon=I('tstyleicon/d'); $customicon=I('customiconurl'); $position=I('tposition/d'); $noboder=I('noboder/d'); $user = session('user'); $rank_switch = tpCache('shopping.rank_switch',$stoid);//等级价格 $mz_switch = tpCache('shopping.is_beauty',$stoid);//美妆价格 $this->assign('rank_switch',$rank_switch); $this->assign('mz_switch',$mz_switch); if (!empty($rank_switch)){ $rand_end= empty($user['card_expiredate'])?0:strtotime($user['card_expiredate']); $card_field=$user['card_field']; if($rand_end>0){ $card_field=$rand_end>time()?$user['card_field']:0; } $this->assign('rank_field',$user['card_field']); //----读取等级卡标签--- $all_card=get_plus_price_arr($stoid); if($all_card) { $this->assign('all_card',$all_card); foreach ($all_card as $kl => $vl) { if ($vl) { switch ($vl['CorrPrice']) { case "Price1": $new_card_dd['cardprice1'] = $vl['CardName']; break; case "Price2": $new_card_dd['cardprice2'] = $vl['CardName']; break; case "Price3": $new_card_dd['cardprice3'] = $vl['CardName']; break; } } } $card_label = $new_card_dd[$card_field]; $len = mb_strlen($card_label, "utf-8"); if ($len > 4) $card_label = mb_substr($card_label, 0, 4, "utf-8"); $this->assign('card_label', $card_label); } } if (!empty($mz_switch)){ $this->assign('mz_vip',$user['is_mzvip']); } /*--id集合--*/ $idlist=I("idl"); $arr =explode(",",$idlist); $mc=M("goods")->where("goods_id in($idlist) and is_on_sale=1 and store_id=".$stoid)->count('goods_id'); /*---给数组加数据,同时剔除下架的商品---*/ $marr=M("goods")->where("goods_id in($idlist) and store_id=".$stoid)->select(); $arrtemp=[]; $isshow=0; if($marr) { foreach ($arr as $k => $v) { foreach ($marr as $kk => $vv) { if ($v == $vv['goods_id']) { if($vv['is_on_sale']==1){ $arrtemp[] = $vv; } break; } } } /*---判断是否还有更多按钮---*/ $end=$mc; if($mc > $p*$limit){ $isshow=1; $end=$p*$limit; } $fir=($p-1)*$limit; for($o=$fir;$o<$end;$o++){ $narr[]= $arrtemp[$o]; } $this->assign('data',$narr); $this->assign('colnum',$colnum); $this->assign('goodstit',$goodstit); $this->assign('goodsprice',$goodsprice); $this->assign('goodsnum',$goodsnum); $this->assign('goodicon',$goodicon); $this->assign('styleicon',$styleicon); $this->assign('customicon',$customicon); $this->assign('position',$position); $this->assign('noboder',$noboder); $htm = $this->fetch("ajax_getmoreid", $stoid); return json(['code'=>1,'isshow'=>$isshow,'htm'=>$htm]); }else{ return json(['code'=>-1,'isshow'=>$isshow]); } } /*---更多商品分类---*/ public function getmorecatetype() { /*--第几页,限制多少条---*/ $p=I("p/d"); $limit=I('lim/d'); $goodsclass=I('tgoodsclass/d',0); $stoid=I('stoid/d',1); $colnum=I('col/d'); $goodstit=I('isgoodstit'); $goodsprice=I('isgoodsprice'); $goodsnum=I('isgoodsnum'); $goodicon=I('tgoodicon/d'); $styleicon=I('tstyleicon/d'); $customicon=I('customiconurl'); $position=I('tposition/d'); $noboder=I('noboder/d'); $user = session('user'); $rank_switch = tpCache('shopping.rank_switch',$stoid);//等级价格 $mz_switch = tpCache('shopping.is_beauty',$stoid);//美妆价格 $this->assign('rank_switch',$rank_switch); $this->assign('mz_switch',$mz_switch); if (!empty($rank_switch)){ $rand_end= empty($user['card_expiredate'])?0:strtotime($user['card_expiredate']); $card_field=$user['card_field']; if($rand_end>0){ $card_field=$rand_end>time()?$user['card_field']:0; } $this->assign('rank_field',$user['card_field']); //----读取等级卡标签--- $all_card=get_plus_price_arr($stoid); if($all_card) { $this->assign('all_card',$all_card); foreach ($all_card as $kl => $vl) { if ($vl) { switch ($vl['CorrPrice']) { case "Price1": $new_card_dd['cardprice1'] = $vl['CardName']; break; case "Price2": $new_card_dd['cardprice2'] = $vl['CardName']; break; case "Price3": $new_card_dd['cardprice3'] = $vl['CardName']; break; } } } $card_label = $new_card_dd[$card_field]; $len = mb_strlen($card_label, "utf-8"); if ($len > 4) $card_label = mb_substr($card_label, 0, 4, "utf-8"); $this->assign('card_label', $card_label); } } if (!empty($mz_switch)){ $this->assign('mz_vip',$user['is_mzvip']); } $where = " is_on_sale=1"; switch ($goodsclass) { case 1://推荐 $where .= " and is_recommend=1"; break; case 2://热销 $where .= " and is_hot=1"; break; case 3://新品 $where .= " and is_new=1"; break; case 4://促销 $where .= " and prom_type=3"; break; }; $t=time(); $mc=M("goods")->where($where) ->where(' on_time<' . $t . ' and (down_time>' . $t . ' or down_time=0)') ->where("store_id = ".$stoid)->count("goods_id"); /*---判断是否还有更多按钮---*/ $isshow=0; if($mc>$p*$limit){ $isshow=1; } $fir=($p-1)*$limit; $str=''.$fir.','.$limit.''; $narr=M("goods")->where($where) ->where("store_id=".$stoid) ->where(' on_time<' . $t . ' and (down_time>' . $t . ' or down_time=0)') ->limit($str)->order("sort")->select(); if($narr) { $this->assign('data', $narr); $this->assign('colnum',$colnum); $this->assign('goodstit',$goodstit); $this->assign('goodsprice',$goodsprice); $this->assign('goodsnum',$goodsnum); $this->assign('goodicon',$goodicon); $this->assign('styleicon',$styleicon); $this->assign('customicon',$customicon); $this->assign('position',$position); $this->assign('noboder',$noboder); $htm = $this->fetch("ajax_getmoreid", $stoid); return json(['code' => 1, 'isshow' => $isshow, 'htm' => $htm]); }else{ return json(['code'=>-1,'isshow'=>$isshow]); } } /*--商品分组--*/ public function getmoregroup(){ /*--第几页,限制多少条---*/ $p=I("p/d"); $limit=I('lim/d'); $stoid=I('stoid/d',1); $colnum=I('col/d'); $goodstit=I('isgoodstit'); $goodsprice=I('isgoodsprice'); $goodsnum=I('isgoodsnum'); $goodicon=I('tgoodicon/d'); $styleicon=I('tstyleicon/d'); $customicon=I('customiconurl'); $position=I('tposition/d'); $noboder=I('noboder/d'); $user = session('user'); $rank_switch = tpCache('shopping.rank_switch',$stoid);//等级价格 $mz_switch = tpCache('shopping.is_beauty',$stoid);//美妆价格 $this->assign('rank_switch',$rank_switch); $this->assign('mz_switch',$mz_switch); if (!empty($rank_switch)){ $rand_end= empty($user['card_expiredate'])?0:strtotime($user['card_expiredate']); $card_field=$user['card_field']; if($rand_end>0){ $card_field=$rand_end>time()?$user['card_field']:0; } $this->assign('rank_field',$user['card_field']); //----读取等级卡标签--- $all_card=get_plus_price_arr($stoid); if($all_card) { $this->assign('all_card',$all_card); foreach ($all_card as $kl => $vl) { if ($vl) { switch ($vl['CorrPrice']) { case "Price1": $new_card_dd['cardprice1'] = $vl['CardName']; break; case "Price2": $new_card_dd['cardprice2'] = $vl['CardName']; break; case "Price3": $new_card_dd['cardprice3'] = $vl['CardName']; break; } } } $card_label = $new_card_dd[$card_field]; $len = mb_strlen($card_label, "utf-8"); if ($len > 4) $card_label = mb_substr($card_label, 0, 4, "utf-8"); $this->assign('card_label', $card_label); } } if (!empty($mz_switch)){ $this->assign('mz_vip',$user['is_mzvip']); } /*--id集合--*/ $grid=I("tgrid"); $gr=M("goods_group")->where("gpid=".$grid." and store_id=".$stoid)->find(); $idlist=$gr['gp_goodslist']; $t=time(); $arr =explode(",",$idlist); $mc=M("goods")->where("goods_id in(".$idlist.") and is_on_sale=1 and store_id=".$stoid) ->where(' on_time<' . $t . ' and (down_time>' . $t . ' or down_time=0)') ->count('goods_id'); /*---给数组加数据,同时剔除下架的商品---*/ $marr=M("goods")->where("goods_id in(".$idlist.") and store_id=".$stoid) ->where(' on_time<' . $t . ' and (down_time>' . $t . ' or down_time=0)') ->select(); $arrtemp=[]; $isshow=0; if($marr) { foreach ($marr as $k => $v) { foreach ($arr as $kk => $vv) { if ($vv == $v[goods_id]) { if($v[is_on_sale]==1){ $arrtemp[] = $v; } break; } } } /*---判断是否还有更多按钮---*/ $end=$mc; if($mc>$p*$limit){ $isshow=1; $end=$p*$limit; } $fir=($p-1)*$limit; for($o=$fir;$o<$end;$o++){ $narr[]= $arrtemp[$o]; } $this->assign('data',$narr); $this->assign('colnum',$colnum); $this->assign('goodstit',$goodstit); $this->assign('goodsprice',$goodsprice); $this->assign('goodsnum',$goodsnum); $this->assign('goodicon',$goodicon); $this->assign('styleicon',$styleicon); $this->assign('customicon',$customicon); $this->assign('position',$position); $this->assign('noboder',$noboder); $htm = $this->fetch("ajax_getmoreid", $stoid); return json(['code'=>1,'isshow'=>$isshow,'htm'=>$htm]); }else{ return json(['code'=>-1,'isshow'=>$isshow]); } } /*--导航预览--*/ public function nav_template() { $stoid=I('stoid'); /*--文件路径--*/ $p="./public/template/footer/sfooter.html"; $this->assign('p', $p); $this->assign('title', "导航预览"); $this->assign('descr', "导航预览"); $this->assign('bk', "#f8f8f8"); if(empty($stoid)) return $this->fetch(); else return $this->fetch("",$stoid); } }