|
@@ -25,6 +25,7 @@ class Goods extends Backend
|
|
|
parent::_initialize();
|
|
|
$this->model = new \app\admin\model\Goods;
|
|
|
$this->assign('status',\app\admin\model\Goods::getStatus());
|
|
|
+ $this->assign('category',\app\common\model\Category::mall());
|
|
|
|
|
|
}
|
|
|
|
|
@@ -46,7 +47,7 @@ class Goods extends Backend
|
|
|
public function index()
|
|
|
{
|
|
|
//当前是否为关联查询
|
|
|
- $this->relationSearch = false;
|
|
|
+ $this->relationSearch = true;
|
|
|
//设置过滤方法
|
|
|
$this->request->filter(['strip_tags', 'trim']);
|
|
|
if ($this->request->isAjax()) {
|
|
@@ -57,7 +58,7 @@ class Goods extends Backend
|
|
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
|
|
|
|
$list = $this->model
|
|
|
-
|
|
|
+ ->with(['category'])
|
|
|
->where($where)
|
|
|
->order($sort, $order)
|
|
|
->paginate($limit);
|
|
@@ -98,6 +99,7 @@ class Goods extends Backend
|
|
|
$data['logo']=array_filter(explode(',',$data['logo']??''));
|
|
|
$this->validate($data,[
|
|
|
'name|商品名称'=>['require'],
|
|
|
+ 'category_id|商品分类'=>['require'],
|
|
|
'brand|品牌'=>['require'],
|
|
|
'amount|售价'=>['require','float','gt:0'],
|
|
|
'is_kill'=>['require'],
|