quanwei
2 days ago 73b874c72ad55eb9eef21c36160ac0de58f0189e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
 
namespace app\shop\controller\takeout;
 
use app\common\library\helper;
use app\shop\controller\Controller;
use app\shop\model\supplier\Supplier as SupplierModel;
use app\shop\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() ?: '操作失败');
    }
}