<?php
|
|
namespace app\operations\controller\takeout;
|
|
use app\common\library\helper;
|
use app\operations\controller\Controller;
|
use app\operations\model\supplier\Supplier as SupplierModel;
|
use app\operations\model\takeout\Supplier as TakeSupplierModel;
|
|
/**
|
* 商品运营控制器
|
*/
|
class Supplier extends Controller
|
{
|
/**
|
* 列表
|
*/
|
public function index()
|
{
|
$model = new SupplierModel;
|
$list = $model->getList($this->postData());
|
return $this->renderSuccess('', compact('list'));
|
}
|
|
/**
|
* 编辑分销商
|
*/
|
public function edit($shop_supplier_id)
|
{
|
$model = new TakeSupplierModel();
|
if ($this->request->isGet()) {
|
$supplier= TakeSupplierModel::detail($shop_supplier_id);
|
return $this->renderSuccess('', compact('supplier'));
|
}
|
if ($model->edit($this->postData())) {
|
return $this->renderSuccess('操作成功');
|
}
|
return $this->renderError($model->getError() ?: '操作失败');
|
}
|
|
/**
|
* 设置状态
|
*/
|
public function setStatus($ids, $is_takeout)
|
{
|
$model = new TakeSupplierModel();
|
if ($model->setStatus($ids, $is_takeout)) {
|
return $this->renderSuccess('操作成功');
|
}
|
return $this->renderError($model->getError() ?: '操作失败');
|
}
|
}
|