where(['status'=>1])->order('sort asc,id asc')->select(); foreach ($cats as $k=>$v) { $start=strtotime(date("Y-m-d {$v['start']}")); $end=strtotime(date("Y-m-d {$v['end']}")); /*未开始*/ if(time()<$start) { $cats[$k]['jctime1']=$start-time(); $cats[$k]['flag']=1; }elseif(time()>=$start && time()<$end) { $cats[$k]['jctime1']=$end-time(); $cats[$k]['flag']=2; }else{ $cats[$k]['flag']=0; $cats[$k]['jctime1']=0; } } $sinfo=db('studio')->where(['title'=>$this->auth->login_studio])->find(); $awards = \app\common\model\Trade::getAwardTotal(); $counts = \app\common\model\Trade::getReleaseTotal($this->auth->id); $awards = [ 'total'=> isset($awards['total'])? $awards['total'] : 0, 'total_usdt'=> isset($awards['total_usdt'])? $awards['total_usdt'] : 0, 'release_total_usdt'=> isset($counts['total'])? $counts['total'] : 0, 'surplus_usdt'=> isset($counts['surplus_usdt'])? $counts['surplus_usdt'] : 0, 'release_usdt'=> isset($counts['release_usdt'])? $counts['release_usdt'] : 0, ]; $this->view->assign('awards', $awards); $this->view->assign('cats', $cats); $this->view->assign('logo', Image::makeLogo($sinfo['name'])); return $this->fetch(); } function goodslist() { $catid=input('catid'); $login_studio=$this->auth->login_studio; $studio=db('studio')->where(['title'=>$login_studio])->find(); if(time()>=strtotime(date("Y-m-d {$studio['start']}")) && time()<= strtotime(date("Y-m-d {$studio['end']}")) ) { $status='营业中'; }elseif(time()< strtotime(date("Y-m-d {$studio['start']}"))){ $status='停业中'; }elseif(time() > strtotime(date("Y-m-d {$studio['end']}"))){ $status='停业中'; } $isappoint=db('studio_user')->where(['sid'=>$studio['id'],'userid'=>$this->auth->id])->find(); if($isappoint) { $flag=0; }else{ $flag=1; } $startTimeText = isset($studio['start'])? $studio['start'] : 0; $endTime = isset($studio['end'])? $studio['end'] : 0; $startTime = $startTimeText? strtotime(date('Y-m-d').' '.$startTimeText) : 0; $endTime = $endTime? strtotime(date('Y-m-d').' '.$endTime) : 0; $expired = $startTime > time()? $startTime - time() : 0; if($endTime <= time()){ $startTime = strtotime(date('Y-m-d',strtotime(date('Y-m-d'))+86400).' '.$startTimeText); $expired = $startTime > time()? $startTime - time() : 0; } $this->view->assign([ 'title'=>get_table_column('goods_cats',$catid,'name'), 'expired'=> $expired, 'catid'=>$catid, 'studio'=>$studio, 'status'=>$status, 'flag'=>$flag, ]); return $this->fetch(); } /* 商品详情 */ function goodsdetailed() { $id=input('id'); $info=db('goods')->where(['id'=>$id])->find(); if(!empty($info['images'])) { $images=$info['image'].','.$info['images']; $info['img']=explode(',', $images); }else{ $info['img']=[$info['image']]; } $this->view->assign([ "info"=>$info, ]); return $this->fetch(); } /* 商品详情 */ function goodsdetailed1() { $id=input('id'); $info=db('goods')->where(['id'=>$id])->find(); if(!empty($info['images'])) { $images=$info['image'].','.$info['images']; $info['img']=explode(',', $images); }else{ $info['img']=[$info['image']]; } $this->view->assign([ "info"=>$info, ]); return $this->fetch(); } /* 评论 */ function appraise() { $goodsid=input('goodsid'); $this->view->assign('goodsid',$goodsid); return $this->fetch(); } /* 购物车 */ function cart() { return $this->fetch(); } }