<?php
|
|
namespace app\shop\controller\plus\goodstore;
|
|
use app\common\library\helper;
|
use app\shop\controller\Controller;
|
use app\shop\model\store\Store as StoreModel;
|
use app\shop\model\plus\goodstore\Store as GoodStoreModel;
|
use app\shop\model\supplier\Category as CategoryModel;
|
|
/**
|
* 商品运营控制器
|
*/
|
class Store extends Controller
|
{
|
/**
|
* 商品列表
|
*/
|
public function index()
|
{
|
$model = new StoreModel;
|
$list = $model->getList(array_merge(['status' => -1], $this->postData()));
|
// 自营分类
|
$category = CategoryModel::getALL();
|
return $this->renderSuccess('', compact('list', 'category'));
|
}
|
|
/**
|
* 编辑分销商
|
*/
|
public function edit($store_id)
|
{
|
$model = new GoodStoreModel();
|
if ($this->request->isGet()) {
|
$good_store= GoodStoreModel::detail($store_id);
|
return $this->renderSuccess('', compact('good_store'));
|
}
|
if ($model->edit($this->postData())) {
|
return $this->renderSuccess('操作成功');
|
}
|
return $this->renderError($model->getError() ?: '操作失败');
|
}
|
|
/**
|
* 设置状态
|
*/
|
public function setStatus($storeIds, $is_good)
|
{
|
$model = new GoodStoreModel();
|
if ($model->setStatus($storeIds, $is_good)) {
|
return $this->renderSuccess('操作成功');
|
}
|
return $this->renderError($model->getError() ?: '操作失败');
|
}
|
}
|