quanwei
2025-12-04 12913c1069347ea4b1f6ab87f480da0f8d8c646a
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
53
54
55
<?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() ?: '操作失败');
    }
}