瀏覽代碼

[更新]修改商城模块

Anyon 7 年之前
父節點
當前提交
86ad22c3f6
共有 2 個文件被更改,包括 1 次插入8 次删除
  1. 0 5
      application/goods/controller/Cate.php
  2. 1 3
      application/goods/controller/Product.php

+ 0 - 5
application/goods/controller/Cate.php

@@ -45,8 +45,6 @@ class Cate extends BasicAdmin
      */
     public function index()
     {
-        $brands = Db::name('GoodsBrand')->where(['status' => '1'])->order('sort asc,id asc')->select();
-        $this->assign('brands', $brands);
         $this->title = '产品分类';
         $db = Db::name($this->table)->where(['is_deleted' => '0']);
         return parent::_list($db->order('sort asc,id asc'), false);
@@ -100,9 +98,6 @@ class Cate extends BasicAdmin
     protected function _form_filter(&$vo)
     {
         if ($this->request->isGet()) {
-            // 读取所有品牌列表
-            $brands = Db::name('GoodsBrand')->where(['status' => '1'])->order('sort asc,id asc')->select();
-            $this->assign('brands', $brands);
             // 读取上级分类
             $where = ['status' => '1', 'is_deleted' => '0'];
             $_cates = (array)Db::name($this->table)->where($where)->order('sort desc,id desc')->select();

+ 1 - 3
application/goods/controller/Product.php

@@ -122,8 +122,7 @@ class Product extends BasicAdmin
             $goods_id = $this->request->get('id');
             $goods = Db::name($this->table)->where(['id' => $goods_id, 'is_deleted' => '0'])->find();
             empty($goods) && $this->error('需要编辑的产品不存在!');
-            $specWhere = ['goods_id' => $goods_id, 'is_deleted' => '0'];
-            $goods['list'] = Db::name('GoodsList')->where($specWhere)->select();
+            $goods['list'] = Db::name('GoodsList')->where(['goods_id' => $goods_id, 'is_deleted' => '0'])->select();
             $this->_form_assign();
             return $this->fetch('form', ['vo' => $goods, 'title' => '编辑产品']);
         }
@@ -160,7 +159,6 @@ class Product extends BasicAdmin
      */
     protected function _form_assign()
     {
-        // 信息
         list($where, $order) = [['status' => '1', 'is_deleted' => '0'], 'sort asc,id desc'];
         $specs = (array)Db::name('GoodsSpec')->where($where)->order($order)->select();
         $brands = (array)Db::name('GoodsBrand')->where($where)->order($order)->select();