Commit 9f5357ab authored by zhuwei's avatar zhuwei

权限判断

parent 46c179c5
...@@ -4,6 +4,8 @@ namespace app\api_broker\controller; ...@@ -4,6 +4,8 @@ namespace app\api_broker\controller;
use app\api_broker\extend\Basic; use app\api_broker\extend\Basic;
use app\api_broker\service\BargainService; use app\api_broker\service\BargainService;
use app\api_broker\service\RedisCacheService;
use app\api_broker\service\VerifyService;
use app\model\AAgents; use app\model\AAgents;
use think\Log; use think\Log;
use think\Request; use think\Request;
...@@ -94,19 +96,39 @@ class Bargain extends Basic ...@@ -94,19 +96,39 @@ class Bargain extends Basic
$is_my_correlation = $params["is_my_correlation"]; $is_my_correlation = $params["is_my_correlation"];
$keyword = empty($params["keyword"]) ? "" : $params["keyword"]; $keyword = empty($params["keyword"]) ? "" : $params["keyword"];
$bargain_id = empty($params['bargain_id']) ? '':$params['bargain_id']; $bargain_id = empty($params['bargain_id']) ? '':$params['bargain_id'];
/*业务员不允许点击查看全部成交报告 start*/
$agent_field = "a.level";
$agent_res = $this->agentModel->getAgentsInfoByAgentId($agent_field, [ "agent_id" => $submit_agent_id ]);
if(($agent_res[0]['level'] == 10) && ($is_my_correlation == 0)){ /*权限 start*/
$is_can_look_res = $this->isCanLook($params["submit_agent_id"],$is_my_correlation);
if($is_can_look_res){
return $this->response("101", "暂无权限!"); return $this->response("101", "暂无权限!");
} }
/*业务员不允许点击查看全部成交报告 end*/ /*权限 end*/
$result = $this->service_->getBargainList($pageNo, $pageSize, $submit_agent_id, $status, $is_my_correlation, $keyword, $bargain_id); $result = $this->service_->getBargainList($pageNo, $pageSize, $submit_agent_id, $status, $is_my_correlation, $keyword, $bargain_id);
return $this->response("200", "success", $result); return $this->response("200", "success", $result);
} }
/**
* 权限判断
* @param $agent_id
* @param $is_my_correlation
* @return array
*/
public function isCanLook($agent_id,$is_my_correlation){
$redis = new RedisCacheService();
//排除 总负责人等角色
$agent_data = $redis->getRedisCache(2, $agent_id);
$auth_rule_id = $agent_data['auth_group_id'];
if (!in_array($auth_rule_id, [1,2,22,23,25,26])) {
$agent_field = "a.level";
$agent_res = $this->agentModel->getAgentsInfoByAgentId($agent_field, [ "agent_id" => $agent_id ]);
if(($agent_res[0]['level'] == 10) && ($is_my_correlation == 0)){
return ['code'=>101,'msg'=>'暂无权限!'];
}
return [];
}
}
/** /**
* 调整 搜索成交报告id * 调整 搜索成交报告id
* @return \think\Response * @return \think\Response
......
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