Commit 07d2bf03 authored by hujun's avatar hujun

特殊权限控制

parent c4245052
......@@ -310,24 +310,8 @@ class Member extends Basic{
$data = [];
if ($this->request->isPost()) {
//编辑用户
if (isset($this->params['id'])) {
$user_data = $this->user->getUserById('id,agent_id', $this->params['id']);
if (empty($user_data)) {
return $this->response(101, '没有用户信息');
} else {
//是否修改客方
if ($this->params['agents_id'] != $user_data['agent_id']) {
$agent = new AAgents();
$agent_data = $agent->getAgentInfo('name,phone', $this->params['agents_id']);
$remark = '修改为' . $agent_data['name'] . '-' . $agent_data['phone'];
} else {
$remark = '用户编辑';
}
$data['start'] = $this->user->edit($this->params, $this->params['id']); //新增或编辑
}
} else {
if (empty($this->params['id'])) {
//新增用户
$where['user_phone'] = $this->params['user_phone'];
$num = $this->user->all_user_count($where);
......@@ -344,6 +328,21 @@ class Member extends Basic{
}
$this->params['id'] = $result;
} else {
$user_data = $this->user->getUserById('id,agent_id', $this->params['id']);
if (empty($user_data)) {
return $this->response(101, '没有用户信息');
} else {
//是否修改客方
if ($this->params['agents_id'] != $user_data['agent_id']) {
$agent = new AAgents();
$agent_data = $agent->getAgentInfo('name,phone', $this->params['agents_id']);
$remark = '修改为' . $agent_data['name'] . '-' . $agent_data['phone'];
} else {
$remark = '用户编辑';
}
$data['start'] = $this->user->edit($this->params, $this->params['id']); //新增或编辑
}
}
$this->operating_records($this->userId, $type=3, $remark, $this->params['id']);
......
......@@ -12,6 +12,7 @@ namespace app\index\extend;
use app\model\AAgents;
use app\model\GHousesToAgents;
use app\model\GOperatingRecords;
use app\model\Users;
use think\Controller;
use think\Request;
use think\Response;
......@@ -128,9 +129,13 @@ class Basic extends Controller
$is_auth = $agents->agentsAuth($auth_id, $this->userId);
$is_auth = empty($is_auth['id']) ? 0:1;
//处理盘方编辑商铺
if ($is_auth == 0) {
//处理盘方编辑商铺
if ($requestPath == 'index/houseEdit' && isset($this->params['id'])) {
if (empty($this->params['id'])) {
$is_auth = 1;
} else {
$agent = new GHousesToAgents();
$where['houses_id'] = $this->params['id'];
$where['type'] = 2;
......@@ -140,6 +145,21 @@ class Basic extends Controller
}
}
//处理客方编辑客户
if ($requestPath == 'index/pcEditClient' && isset($this->params['id'])) {
if (empty($this->params['id'])) {
$is_auth = 1;
} else {
$m_user = new Users();
$where['agent_id'] = $this->userId;
$where['id'] = $this->params['id'];
$is_ = $m_user->getUserAgentTotal($where);
$is_auth = $is_ > 0 ? 1:0;
}
}
}
if (empty($is_auth) && $this->userId != 1) {
if($this->request->isAjax()){
echo json_encode(array( "code" => "300", "msg" => "没有权限!", "data" => [], "type" => "json" ));exit;
......
......@@ -74,7 +74,6 @@ Route::group('index', [
//user列表
'users_list' => [ 'index/member/getUserList', [ 'method' => 'get' ] ],
'user_add' => [ 'index/member/user_add', [ 'method' => 'post' ] ],
'del_user' => [ 'index/member/delUser', [ 'method' => 'post' ] ],
'pcAddFollow' => [ 'index/member/pcAddFollow', [ 'method' => 'post' ] ],
'pcEditClient' => [ 'index/member/pcEditClient', [ 'method' => 'post | get' ] ],
......
......@@ -685,6 +685,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'ckfinder', 'ckfinderStart',
},
add_user: function() {
var params = {};
params.id = 0;
params.user_name = $("#add_user_form input[name='user_name']").val();
params.user_phone = $("#add_user_form input[name='user_phone']").val();
params.agent_id = user.agent_id; //客方
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment