作者 Cool

商家、商品功能调整

@@ -7,6 +7,8 @@ use app\api\model\Store; @@ -7,6 +7,8 @@ use app\api\model\Store;
7 use app\common\controller\Backend; 7 use app\common\controller\Backend;
8 use app\admin\model\Litestorespec as SpecModel; 8 use app\admin\model\Litestorespec as SpecModel;
9 use app\admin\model\Litestorespecvalue as SpecValueModel; 9 use app\admin\model\Litestorespecvalue as SpecValueModel;
  10 +use think\Db;
  11 +
10 /** 12 /**
11 * 13 *
12 * 14 *
@@ -21,8 +23,8 @@ class Litestoregoods extends Backend @@ -21,8 +23,8 @@ class Litestoregoods extends Backend
21 * @var \app\admin\model\Litestoregoods 23 * @var \app\admin\model\Litestoregoods
22 */ 24 */
23 protected $model = null; 25 protected $model = null;
24 - protected $dataLimit = true;  
25 - protected $dataLimitField = 'store_id'; 26 + protected $admin_id;
  27 + protected $group_id;
26 protected $multiFields = 'is_recommend'; 28 protected $multiFields = 'is_recommend';
27 protected $noNeedRight = ['selectpage']; 29 protected $noNeedRight = ['selectpage'];
28 30
@@ -42,7 +44,7 @@ class Litestoregoods extends Backend @@ -42,7 +44,7 @@ class Litestoregoods extends Backend
42 $this->view->assign("spec_attr", ''); 44 $this->view->assign("spec_attr", '');
43 $this->view->assign("spec_list", ''); 45 $this->view->assign("spec_list", '');
44 $auth_group = new AuthGroupAccess(); 46 $auth_group = new AuthGroupAccess();
45 - $admin_id = session('admin.id'); 47 + $this->admin_id = $admin_id = session('admin.id');
46 $group_id = $auth_group->where(['uid'=>$admin_id,'group_id'=>1])->count(); 48 $group_id = $auth_group->where(['uid'=>$admin_id,'group_id'=>1])->count();
47 $store = ''; 49 $store = '';
48 if($group_id == 1) { 50 if($group_id == 1) {
@@ -77,15 +79,26 @@ class Litestoregoods extends Backend @@ -77,15 +79,26 @@ class Litestoregoods extends Backend
77 { 79 {
78 return $this->selectpage(); 80 return $this->selectpage();
79 } 81 }
  82 + $where_g = [];
  83 + $auth_group = new AuthGroupAccess();
  84 + $group = $auth_group->where(['uid'=>$this->admin_id,'group_id'=>4])->count();
  85 + if($group) {
  86 + $store = Db::name('store')->where('admin_id',$this->admin_id)->value('id');
  87 + $where_g = [
  88 + 'store_id' => $store
  89 + ];
  90 + }
80 list($where, $sort, $order, $offset, $limit) = $this->buildparams(); 91 list($where, $sort, $order, $offset, $limit) = $this->buildparams();
81 $total = $this->model 92 $total = $this->model
82 ->with(['category','freight']) 93 ->with(['category','freight'])
  94 + ->where($where_g)
83 ->where($where) 95 ->where($where)
84 ->order($sort, $order) 96 ->order($sort, $order)
85 ->count(); 97 ->count();
86 98
87 $list = $this->model 99 $list = $this->model
88 ->with(['category','freight']) 100 ->with(['category','freight'])
  101 + ->where($where_g)
89 ->where($where) 102 ->where($where)
90 ->order($sort, $order) 103 ->order($sort, $order)
91 ->limit($offset, $limit) 104 ->limit($offset, $limit)
@@ -139,6 +139,7 @@ class Store extends Backend @@ -139,6 +139,7 @@ class Store extends Backend
139 $result_admin = $admin_model->isUpdate(false)->save($admin_data); 139 $result_admin = $admin_model->isUpdate(false)->save($admin_data);
140 $auth_group_data['uid'] = $admin_model->id; 140 $auth_group_data['uid'] = $admin_model->id;
141 $result_auth_group = $auth_group_model->isUpdate(false)->save($auth_group_data); 141 $result_auth_group = $auth_group_model->isUpdate(false)->save($auth_group_data);
  142 + $row->allowField(true)->isUpdate(true)->save(['admin_id'=>$admin_model->id]);
142 } 143 }
143 if($params['status'] == 4) { 144 if($params['status'] == 4) {
144 // 审核不通过,执行退款操作 145 // 审核不通过,执行退款操作
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 <select name="row[store_id]" id="" data-rule="required" class="form-control"> 7 <select name="row[store_id]" id="" data-rule="required" class="form-control">
8 <option value="">选择商家</option> 8 <option value="">选择商家</option>
9 {foreach name="store" item="vo"} 9 {foreach name="store" item="vo"}
10 - <option value="{vo.admin_id}">{$vo.store_name}</option> 10 + <option value="{vo.id}">{$vo.store_name}</option>
11 {/foreach} 11 {/foreach}
12 </select> 12 </select>
13 </div> 13 </div>
@@ -6,7 +6,7 @@ @@ -6,7 +6,7 @@
6 <div class="col-xs-12 col-sm-8"> 6 <div class="col-xs-12 col-sm-8">
7 <select name="row[store_id]" id="" data-rule="required" class="form-control"> 7 <select name="row[store_id]" id="" data-rule="required" class="form-control">
8 {foreach name="store" item="vo"} 8 {foreach name="store" item="vo"}
9 - <option value="{$vo.admin_id}" {eq name="vo.admin_id" value="$row.store_id"}selected{/eq}>{$vo.store_name}</option> 9 + <option value="{$vo.id}" {eq name="vo.id" value="$row.store_id"}selected{/eq}>{$vo.store_name}</option>
10 {/foreach} 10 {/foreach}
11 </select> 11 </select>
12 </div> 12 </div>