作者 anyv
1 个管道 的构建 通过 耗费 1 秒

9

... ... @@ -25,11 +25,11 @@ class ClassifyController extends WeChatBaseController{
$classify_id = $this -> request -> param();
if($classify_id){
//获取指定分类商品
$data_goods = Db::name('goods') -> alias('a') -> field("a.*,b.name") -> join('classification b','a.classify_id = b.id','LEFT') -> where("a.type = 1 and a.classify_id =".$classify_id['classify_id']) -> select() -> toArray();
$data_goods = Db::name('goods') -> alias('a') -> field("a.*,b.name") -> join('classification b','a.classify_id = b.id','LEFT') -> where("a.type = 1 and a.is_out = 1 and a.classify_id =".$classify_id['classify_id']) -> select() -> toArray();
$this -> assign('class',$classify_id['classify_id']);
}else{
//获取默认分类商品
$data_goods = Db::name('goods') -> alias('a') -> field("a.*,b.name") -> join('classification b','a.classify_id = b.id','LEFT') -> where("a.type = 1 and a.classify_id =".$data_classify[0]['id']) -> select() -> toArray();
$data_goods = Db::name('goods') -> alias('a') -> field("a.*,b.name") -> join('classification b','a.classify_id = b.id','LEFT') -> where("a.type = 1 and a.is_out = 1 and a.classify_id =".$data_classify[0]['id']) -> select() -> toArray();
$this -> assign('class',$data_classify[0]['id']);
}
foreach($data_goods as $key => $val){
... ... @@ -50,7 +50,7 @@ class ClassifyController extends WeChatBaseController{
public function classify_goods(){
$classify_id = $_POST['classify_id'];
$data_classify_goods = Db::name('goods') -> alias('a') -> field("a.*,b.name") -> join('classification b','a.classify_id = b.id','LEFT') -> where("a.type = 1 and a.classify_id =".$classify_id) -> select() -> toArray();
$data_classify_goods = Db::name('goods') -> alias('a') -> field("a.*,b.name") -> join('classification b','a.classify_id = b.id','LEFT') -> where("a.type = 1 and a.is_out = 1 and a.classify_id =".$classify_id) -> select() -> toArray();
foreach($data_classify_goods as $key => $val){
$price = explode('.',$data_classify_goods[$key]['price']);
$data_classify_goods[$key]['price0'] = $price[0];
... ... @@ -68,7 +68,7 @@ class ClassifyController extends WeChatBaseController{
$label_id = $_POST['label_id'];
$classify_id = $_POST['classify_id'];
$data_classify_lable_goods = Db::name('goods') -> alias('a') -> field("a.*") -> join('goods_label b','a.id = b.goods_id','LEFT') -> where("a.type = 1 and a.classify_id =".$classify_id." and b.label_id =".$label_id) -> select() -> toArray();
$data_classify_lable_goods = Db::name('goods') -> alias('a') -> field("a.*") -> join('goods_label b','a.id = b.goods_id','LEFT') -> where("a.type = 1 and a.is_out = 1 and a.classify_id =".$classify_id." and b.label_id =".$label_id) -> select() -> toArray();
$data_classify_name = Db::name('classification') -> where('id',$classify_id) -> find();
foreach($data_classify_lable_goods as $key => $val){
$price = explode('.',$data_classify_lable_goods[$key]['price']);
... ... @@ -87,7 +87,8 @@ class ClassifyController extends WeChatBaseController{
public function classify_sales(){
$where = [
'a.type' => 1
'a.type' => 1,
'a.is_out' => 1
];
if(!empty($_POST['classify_id'])){
$where['a.classify_id'] = $_POST['classify_id'];
... ... @@ -114,7 +115,8 @@ class ClassifyController extends WeChatBaseController{
public function classify_price(){
$where = [
'a.type' => 1
'a.type' => 1,
'a.is_out' => 1
];
if(!empty($_POST['classify_id'])){
$where['classify_id'] = $_POST['classify_id'];
... ...
... ... @@ -177,10 +177,12 @@
<img src="__TMPL__/public/assets/images/17.png" alt="">
<p>购物车</p>
</li>
<li>
<img src="__TMPL__/public/assets/images/18.png" alt="">
<p>我的</p>
</li>
<a href="{:url('/')}">
<li>
<img src="__TMPL__/public/assets/images/18.png" alt="">
<p>我的</p>
</li>
</a>
</ul>
</div>
</div>
... ...