Commit 07d2bf03 authored by hujun's avatar hujun

特殊权限控制

parent c4245052
...@@ -310,24 +310,8 @@ class Member extends Basic{ ...@@ -310,24 +310,8 @@ class Member extends Basic{
$data = []; $data = [];
if ($this->request->isPost()) { if ($this->request->isPost()) {
//编辑用户 //编辑用户
if (isset($this->params['id'])) { if (empty($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 {
//新增用户 //新增用户
$where['user_phone'] = $this->params['user_phone']; $where['user_phone'] = $this->params['user_phone'];
$num = $this->user->all_user_count($where); $num = $this->user->all_user_count($where);
...@@ -338,12 +322,27 @@ class Member extends Basic{ ...@@ -338,12 +322,27 @@ class Member extends Basic{
$agent_data = $agent->getAgentInfo('name,phone', $this->params['agents_id']); $agent_data = $agent->getAgentInfo('name,phone', $this->params['agents_id']);
$remark = '新增为' . $agent_data['name'] . '-' . $agent_data['phone']; $remark = '新增为' . $agent_data['name'] . '-' . $agent_data['phone'];
$result = $this->user->edit($this->params, $this->params['id']); //新增或编辑 $result = $this->user->edit($this->params, $this->params['id']); //新增或编辑
if ($result == -1) { if ($result == -1) {
return $this->response(101, '该用户已经存在!'); return $this->response(101, '该用户已经存在!');
} }
$this->params['id'] = $result; $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']); $this->operating_records($this->userId, $type=3, $remark, $this->params['id']);
......
...@@ -12,6 +12,7 @@ namespace app\index\extend; ...@@ -12,6 +12,7 @@ namespace app\index\extend;
use app\model\AAgents; use app\model\AAgents;
use app\model\GHousesToAgents; use app\model\GHousesToAgents;
use app\model\GOperatingRecords; use app\model\GOperatingRecords;
use app\model\Users;
use think\Controller; use think\Controller;
use think\Request; use think\Request;
use think\Response; use think\Response;
...@@ -128,15 +129,34 @@ class Basic extends Controller ...@@ -128,15 +129,34 @@ class Basic extends Controller
$is_auth = $agents->agentsAuth($auth_id, $this->userId); $is_auth = $agents->agentsAuth($auth_id, $this->userId);
$is_auth = empty($is_auth['id']) ? 0:1; $is_auth = empty($is_auth['id']) ? 0:1;
//处理盘方编辑商铺
if ($is_auth == 0) { if ($is_auth == 0) {
//处理盘方编辑商铺
if ($requestPath == 'index/houseEdit' && isset($this->params['id'])) { if ($requestPath == 'index/houseEdit' && isset($this->params['id'])) {
$agent = new GHousesToAgents();
$where['houses_id'] = $this->params['id']; if (empty($this->params['id'])) {
$where['type'] = 2; $is_auth = 1;
$where['agents_id'] = $this->userId; } else {
$is_ = $agent->getTotal($where); $agent = new GHousesToAgents();
$is_auth = $is_ > 0 ? 1:0; $where['houses_id'] = $this->params['id'];
$where['type'] = 2;
$where['agents_id'] = $this->userId;
$is_ = $agent->getTotal($where);
$is_auth = $is_ > 0 ? 1:0;
}
}
//处理客方编辑客户
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;
}
} }
} }
......
...@@ -74,7 +74,6 @@ Route::group('index', [ ...@@ -74,7 +74,6 @@ Route::group('index', [
//user列表 //user列表
'users_list' => [ 'index/member/getUserList', [ 'method' => 'get' ] ], 'users_list' => [ 'index/member/getUserList', [ 'method' => 'get' ] ],
'user_add' => [ 'index/member/user_add', [ 'method' => 'post' ] ],
'del_user' => [ 'index/member/delUser', [ 'method' => 'post' ] ], 'del_user' => [ 'index/member/delUser', [ 'method' => 'post' ] ],
'pcAddFollow' => [ 'index/member/pcAddFollow', [ 'method' => 'post' ] ], 'pcAddFollow' => [ 'index/member/pcAddFollow', [ 'method' => 'post' ] ],
'pcEditClient' => [ 'index/member/pcEditClient', [ 'method' => 'post | get' ] ], 'pcEditClient' => [ 'index/member/pcEditClient', [ 'method' => 'post | get' ] ],
......
...@@ -685,6 +685,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'ckfinder', 'ckfinderStart', ...@@ -685,6 +685,7 @@ define(['doT', 'text!temp/user_template_tpl.html', 'ckfinder', 'ckfinderStart',
}, },
add_user: function() { add_user: function() {
var params = {}; var params = {};
params.id = 0;
params.user_name = $("#add_user_form input[name='user_name']").val(); params.user_name = $("#add_user_form input[name='user_name']").val();
params.user_phone = $("#add_user_form input[name='user_phone']").val(); params.user_phone = $("#add_user_form input[name='user_phone']").val();
params.agent_id = user.agent_id; //客方 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