add-admin-biz_limit
This commit is contained in:
@@ -869,6 +869,10 @@ class Store extends HD_Controller
|
||||
} else {
|
||||
$whre['status > -1'] = null;
|
||||
}
|
||||
if($_SESSION['admin_info']['biz_id']){
|
||||
$biz_ids = implode(',',$_SESSION['admin_info']['biz_id']);
|
||||
$where["id in ($biz_ids)"] = null;
|
||||
}
|
||||
$province_id && $where['province_id'] = $province_id;
|
||||
$city_id && $where['city_id'] = $city_id;
|
||||
$county_id && $where['county_id'] = $county_id;
|
||||
|
||||
@@ -44,6 +44,10 @@ class Customer extends HD_Controller
|
||||
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
|
||||
$where = array('status>=0' => null);
|
||||
if($_SESSION['admin_info']['biz_id']){
|
||||
$biz_ids = implode(',',$_SESSION['admin_info']['biz_id']);
|
||||
$where["biz_id in ($biz_ids)"] = null;
|
||||
}
|
||||
if (false == strpos($_SERVER['HTTP_HOST'], 'dev')) {//dev时不限制
|
||||
$where['biz_id<>'] = 1;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ class Admin extends HD_Controller {
|
||||
$this->load->model('sys/Sys_category_model','sysCate');
|
||||
$this->load->model('sys/Sys_city_model','sysCity');
|
||||
$this->load->model('app/app_model');
|
||||
$this->load->model('biz/biz_model');
|
||||
}
|
||||
|
||||
public function index()
|
||||
@@ -83,6 +84,14 @@ class Admin extends HD_Controller {
|
||||
$this->data = $this->_get_info();
|
||||
$data = $this->sysAdmin->get(['id' => $id]);
|
||||
$json = (array)json_decode($data['other_json']);
|
||||
//获取已选门店
|
||||
if($json['biz_id']){
|
||||
$ids = implode(',',$json['biz_id']);
|
||||
$where = [
|
||||
"id in ($ids)" => null
|
||||
];
|
||||
$this->data['selectBiz'] = $this->biz_model->select($where,'','','','id,biz_name as title');
|
||||
}
|
||||
$this->data['username'] = $data['username'];
|
||||
$this->data['role_id'] = $data['role_id'];
|
||||
$this->data['mobile'] = $data['mobile'];
|
||||
@@ -127,11 +136,13 @@ class Admin extends HD_Controller {
|
||||
}
|
||||
//输入流数据获取
|
||||
$input = $this->_get_input();
|
||||
$other_json = [];
|
||||
$input['biz_id'] && $other_json['biz_id'] = $input['biz_id'];
|
||||
$insert = [
|
||||
'username' => $input['username'],
|
||||
'mobile' => $input['mobile'],
|
||||
'role_id' => $input['role'],
|
||||
'other_json' => json_encode([]),
|
||||
'other_json' => json_encode($other_json,JSON_UNESCAPED_UNICODE),
|
||||
'password' => password_hash($input['password1'],PASSWORD_BCRYPT),
|
||||
'c_time' => time(),
|
||||
];
|
||||
@@ -148,11 +159,13 @@ class Admin extends HD_Controller {
|
||||
}
|
||||
//输入流数据获取
|
||||
$input = $this->_get_input();
|
||||
$other_json = [];
|
||||
$input['biz_id'] && $other_json['biz_id'] = $input['biz_id'];
|
||||
$upd = [
|
||||
'username' => $input['username'],
|
||||
'mobile' => $input['mobile'],
|
||||
'role_id' => $input['role'],
|
||||
'other_json' => json_encode([]),
|
||||
'other_json' => json_encode($other_json,JSON_UNESCAPED_UNICODE),
|
||||
];
|
||||
if($this->sysAdmin->update($upd,['id' => $input['id']])) {
|
||||
return $this->show_json(SYS_CODE_SUCCESS,'修改成功!');
|
||||
@@ -242,6 +255,7 @@ class Admin extends HD_Controller {
|
||||
'role' => $this->input->post('role'),
|
||||
'password1' => trim($this->input->post('password1')),
|
||||
'password2' => trim($this->input->post('password2')),
|
||||
'biz_id' => $this->input->post('biz_id'),
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -86,6 +86,10 @@ class OrdersList
|
||||
$view = 'receiver/orders/lists';
|
||||
}
|
||||
$where['biz_id!='] = 1;
|
||||
if($_SESSION['admin_info']['biz_id']){
|
||||
$biz_ids = implode(',',$_SESSION['admin_info']['biz_id']);
|
||||
$where["biz_id in ($biz_ids)"] = null;
|
||||
}
|
||||
if ($params['cf_title']) {
|
||||
$where['rid in (select id from lc_receiver_customers where cf_title = "' . $params['cf_title'] . '")'] = null;
|
||||
}
|
||||
@@ -242,6 +246,10 @@ class OrdersList
|
||||
"$t2.status>=" => 0,
|
||||
"$t2.biz_id!=" => 1,
|
||||
];
|
||||
if($_SESSION['admin_info']['biz_id']){
|
||||
$biz_ids = implode(',',$_SESSION['admin_info']['biz_id']);
|
||||
$where["$t2.biz_id in ($biz_ids)"] = null;
|
||||
}
|
||||
if ($params['cf_title']) {
|
||||
$where[$t2.'.rid in (select id from lc_receiver_customers where cf_title = "' . $params['cf_title'] . '")'] = null;
|
||||
}
|
||||
@@ -437,6 +445,10 @@ class OrdersList
|
||||
"$t2.status>=" => 0,
|
||||
"$t2.biz_id!=" => 1,
|
||||
];
|
||||
if($_SESSION['admin_info']['biz_id']){
|
||||
$biz_ids = implode(',',$_SESSION['admin_info']['biz_id']);
|
||||
$where["$t2.biz_id in ($biz_ids)"] = null;
|
||||
}
|
||||
if ($params['cf_title']) {
|
||||
$where[$t2.'.rid in (select id from lc_receiver_customers where cf_title = "' . $params['cf_title'] . '")'] = null;
|
||||
}
|
||||
@@ -586,6 +598,10 @@ class OrdersList
|
||||
"$t2.status>=" => 0,
|
||||
"$t2.biz_id!=" => 1,
|
||||
];
|
||||
if($_SESSION['admin_info']['biz_id']){
|
||||
$biz_ids = implode(',',$_SESSION['admin_info']['biz_id']);
|
||||
$where["$t2.biz_id in ($biz_ids)"] = null;
|
||||
}
|
||||
if ($params['cf_title']) {
|
||||
$where[$t2.'.rid in (select id from lc_receiver_customers where cf_title = "' . $params['cf_title'] . '")'] = null;
|
||||
}
|
||||
@@ -753,6 +769,10 @@ class OrdersList
|
||||
"$t2.status>=" => 0,
|
||||
"$t2.biz_id!=" => 1,
|
||||
];
|
||||
if($_SESSION['admin_info']['biz_id']){
|
||||
$biz_ids = implode(',',$_SESSION['admin_info']['biz_id']);
|
||||
$where["$t2.biz_id in ($biz_ids)"] = null;
|
||||
}
|
||||
if ($params['cf_title']) {
|
||||
$where[$t2.'.rid in (select id from lc_receiver_customers where cf_title = "' . $params['cf_title'] . '")'] = null;
|
||||
}
|
||||
@@ -920,6 +940,10 @@ class OrdersList
|
||||
"$t2.status>=" => 0,
|
||||
"$t2.biz_id!=" => 1,
|
||||
];
|
||||
if($_SESSION['admin_info']['biz_id']){
|
||||
$biz_ids = implode(',',$_SESSION['admin_info']['biz_id']);
|
||||
$where["$t2.biz_id in ($biz_ids)"] = null;
|
||||
}
|
||||
if ($params['cf_title']) {
|
||||
$where[$t2.'.rid in (select id from lc_receiver_customers where cf_title = "' . $params['cf_title'] . '")'] = null;
|
||||
}
|
||||
@@ -1087,6 +1111,10 @@ class OrdersList
|
||||
"$t2.status>=" => 0,
|
||||
"$t2.biz_id!=" => 1,
|
||||
];
|
||||
if($_SESSION['admin_info']['biz_id']){
|
||||
$biz_ids = implode(',',$_SESSION['admin_info']['biz_id']);
|
||||
$where["$t2.biz_id in ($biz_ids)"] = null;
|
||||
}
|
||||
if ($params['cf_title']) {
|
||||
$where[$t2.'.rid in (select id from lc_receiver_customers where cf_title = "' . $params['cf_title'] . '")'] = null;
|
||||
}
|
||||
|
||||
@@ -53,6 +53,33 @@
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">门店:</label>
|
||||
<div class="am-para-inline">
|
||||
<div>
|
||||
<select style="width:100px;display:inline" v-model="city_id">
|
||||
<option value="">选择城市</option>
|
||||
<option :value="v.id" v-for="(v,i) in cityAry">{{v.name}}</option>
|
||||
</select>
|
||||
<select style="width:150px;display:inline" v-model="county_id">
|
||||
<option value="">行政区</option>
|
||||
<option :value="v.id" v-for="(v,i) in countyAry">{{v.name}}</option>
|
||||
</select>
|
||||
</div>
|
||||
<div style="min-width:90%">
|
||||
<template v-for="(item,key) in bizAry">
|
||||
<input type="checkbox" @click="addBiz(key)" :checked="item.selected"> {{item.title}}
|
||||
</template>
|
||||
<div style="font-weight:normal" class="mt5">
|
||||
<div class="am-para-inline" v-for="(item,key) in selectBiz">
|
||||
<span class="label label-default">{{item.title}}</span>
|
||||
<input type="hidden" :value="item.id" name="biz_id[]">
|
||||
<a href="javascript:void(0);" class="label label-default" @click="delBiz(key)"><i class="fa fa-remove"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group" style="margin-bottom: 2rem">
|
||||
<button class="am-btn ml20 am-btn-sm am-btn-success w100" style="margin-left: 3.5rem" type="submit">保存</button>
|
||||
</div>
|
||||
@@ -63,17 +90,92 @@
|
||||
data: {
|
||||
role_id: '',
|
||||
role: <?=json_encode($this->data['role'])?>,
|
||||
city_id:'<?=$city_id?>',
|
||||
county_id: '<?=$county_id?>',
|
||||
cityAry:[],
|
||||
countyAry:[],
|
||||
bizAry:[],
|
||||
selectBiz:<?=$selectBiz ? json_encode($selectBiz,JSON_UNESCAPED_UNICODE) : '[]'?>,
|
||||
},
|
||||
created: function(index) {
|
||||
if('edit' == '<?=$url?>') {
|
||||
this.role_id = '<?=$this->data['role_id']?>';
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
this.init_citys();
|
||||
},
|
||||
methods: {
|
||||
init_citys: function () {
|
||||
var vm = this;
|
||||
$.get('/common/area',{'id':350,'key':'city','type':1},function(response){
|
||||
if (response.code == 1) {
|
||||
vm.cityAry = response.data;
|
||||
}
|
||||
});
|
||||
},
|
||||
setCate: function(index) {
|
||||
},
|
||||
setCity: function(index) {
|
||||
},
|
||||
addBiz:function(index){
|
||||
var in_arr = false
|
||||
var that = this
|
||||
if(!that.bizAry[index]['selected']){
|
||||
that.bizAry[index]['selected'] = 1
|
||||
$.each(that.selectBiz,function(key,val){
|
||||
if(that.bizAry[index]['id']==val['id']){
|
||||
in_arr = true
|
||||
}
|
||||
})
|
||||
if(!in_arr){
|
||||
that.selectBiz.push(this.bizAry[index]);
|
||||
}
|
||||
}
|
||||
},
|
||||
delBiz:function(index){
|
||||
var that = this
|
||||
$.each(that.bizAry,function(key,val){
|
||||
if(val['id']==that.selectBiz[index]['id']){
|
||||
that.bizAry[key]['selected'] = ''
|
||||
}
|
||||
})
|
||||
this.selectBiz.splice(index,1)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'city_id': function (nv, ov) {
|
||||
var that = this;
|
||||
if (nv == '') {
|
||||
that.countyAry = [];
|
||||
that.county_id = '';
|
||||
} else {
|
||||
$.get('/common/area',{'id':nv,'key':'county','type':1},function(response){
|
||||
if (response.code == 1) {
|
||||
that.countyAry = response.data;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'county_id': function (nv, ov) {
|
||||
var that = this;
|
||||
$.post('/biz/store/store/json_lists',{city_id:that.city_id,county_id:that.county_id,status:1},function(response){
|
||||
if (response.code == 1) {
|
||||
$.each(response.data.list,function(key,val){
|
||||
response.data.list[key]['selected'] = ''
|
||||
if(that.selectBiz){
|
||||
$.each(that.selectBiz,function(k,v){
|
||||
if(v['id']==val['id']){
|
||||
response.data.list[key]['selected'] = 1
|
||||
return false
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
that.bizAry = response.data.list;
|
||||
}
|
||||
});
|
||||
},
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@
|
||||
-- Table:lc_sys_admin
|
||||
-- ---------------------------
|
||||
-- other_json:{"cate_id":[1,27], "city_id":["350200", "350500"], "platfrom_id":[0, 1], "app_id":[1,2]}
|
||||
-- cate_id:可操作行业,city_id:可操作城市,platfrom_id:可登录平台,app_id:可操作应用
|
||||
-- cate_id:可操作行业,city_id:可操作城市,platfrom_id:可登录平台,app_id:可操作应用,biz_id: 可操作门店
|
||||
-- ---------------------------
|
||||
drop table if exists lc_sys_admin;
|
||||
create table lc_sys_admin(
|
||||
|
||||
Reference in New Issue
Block a user