|
@@ -4,7 +4,7 @@ namespace app\api\controller;
|
|
|
|
|
|
use app\common\model\Category as CategoryModel;
|
|
|
use fast\Tree;
|
|
|
-
|
|
|
+use app\common\Enum\StatusEnum;
|
|
|
/**
|
|
|
* 商品分类
|
|
|
*/
|
|
@@ -20,14 +20,19 @@ class Category extends Base
|
|
|
|
|
|
$list = CategoryModel::relation([
|
|
|
'goods' => function ($query) {
|
|
|
- $query->field('id,title,image,price,sales,views,description,marketprice,createtime')->limit(10);
|
|
|
+ $query->field('id,title,sub_title,image,price,sales,views,description,lineation_price,createtime')->limit(10);
|
|
|
}
|
|
|
- ])->where('pid', 0)->where('isnav', 1)->order('weigh desc,id asc')->select();
|
|
|
+ ])->where('pid', 0)
|
|
|
+ ->where('status',StatusEnum::ENABLED)
|
|
|
+ ->order('weigh desc,id asc')->select();
|
|
|
|
|
|
} else //二级分类 //三级分类
|
|
|
{
|
|
|
$tree = Tree::instance();
|
|
|
- $categoryList = CategoryModel::field('id,pid,name,image')->order('weigh desc,id asc')->where('isnav', 1)->select();
|
|
|
+ $categoryList = CategoryModel::field('id,pid,name,image')
|
|
|
+ ->order('weigh desc,id asc')
|
|
|
+ ->where('status',StatusEnum::ENABLED)
|
|
|
+ ->select();
|
|
|
$tree->init(collection($categoryList)->toArray(), 'pid');
|
|
|
$list = $tree->getTreeArray(0);
|
|
|
|