Commit 88d7150c authored by hujun's avatar hujun

特殊权限处理

parent dab5ff36
...@@ -17,6 +17,8 @@ use app\model\AAgents; ...@@ -17,6 +17,8 @@ use app\model\AAgents;
use app\model\GHouses; use app\model\GHouses;
use app\model\GHousesToAgents; use app\model\GHousesToAgents;
use app\model\GOperatingRecords; use app\model\GOperatingRecords;
use app\model\OfficeGRoom;
use app\model\OfficeGRoomToAgent;
use app\model\Users; use app\model\Users;
use think\Config; use think\Config;
use think\Controller; use think\Controller;
...@@ -200,7 +202,6 @@ class Basic extends Controller ...@@ -200,7 +202,6 @@ class Basic extends Controller
if (empty($this->params['id'])) { if (empty($this->params['id'])) {
$is_auth = 1; $is_auth = 1;
} else { } else {
$agent_house = new GHousesToAgents();
$where['houses_id'] = $this->params['id']; $where['houses_id'] = $this->params['id'];
$where['type'] = 2; $where['type'] = 2;
$where['agents_id'] = $this->userId; $where['agents_id'] = $this->userId;
...@@ -241,6 +242,52 @@ class Basic extends Controller ...@@ -241,6 +242,52 @@ class Basic extends Controller
} }
} }
//处理盘方编辑商铺
if ($requestPath == 'office_index/houseEdit' && isset($this->params['id'])) {
$agent_house = new OfficeGRoomToAgent();
if (empty($this->params['id'])) {
$is_auth = 1;
} else {
$where['houses_id'] = $this->params['id'];
$where['type'] = 2;
$where['agents_id'] = $this->userId;
$where['is_del'] = 0;
$is_ = $agent_house->getTotal($where);
$is_auth = $is_ > 0 ? 1:0;
}
//处理店长权限
if (!$is_auth) {
$where_agent['a.houses_id'] = $this->params['id'];
$where_agent['a.type'] = 2;
$where_agent['a.is_del'] = 0;
$store_id_arr = $agent_house->getAgentsByRoomColumn('b.store_id', $where_agent);
if (!empty($store_id_arr)) {
$store_id = implode(',', array_unique($store_id_arr));
}
if (!empty($store_id)) {
$agents = new AAgents();
$is_ = $agents->getTotal(['store_id'=>['in', $store_id], 'id'=>$this->userId, 'level'=>20]);
$is_auth = $is_ > 0 ? 1:0;
}
}
//有VIP盘权限处理
if (!$is_auth) {
$m_house = new OfficeGRoom();
$is_vip = $m_house->getFieldOneValue('is_vip', ['id'=>$this->params['id']]);
if ($is_vip) {
$check_auth = new VipService();
$check_rule = $check_auth->checkRule($this->userId, 'office_index/vipHouse');
if (!$check_rule) {
$is_auth = 1;
}
}
}
}
//处理客方编辑、跟进、公客客户 //处理客方编辑、跟进、公客客户
if (($requestPath == 'index/pcEditClient' || $requestPath == 'index/pcAddFollow' || $requestPath == 'index/useraction_search') && isset($this->params['id'])) { if (($requestPath == 'index/pcEditClient' || $requestPath == 'index/pcAddFollow' || $requestPath == 'index/useraction_search') && isset($this->params['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