Commit edd3a129 authored by zhuwei's avatar zhuwei

1

parent 9a95a88d
...@@ -131,12 +131,12 @@ class Report extends Basic ...@@ -131,12 +131,12 @@ class Report extends Basic
$params["report_agent_id"] = $params["agent_id"]; $params["report_agent_id"] = $params["agent_id"];
$result = []; $result = [];
if(isset($params["is_all"]) && $params["is_all"] == 1){ if(isset($params["is_all"]) && $params["is_all"] == 1){
$vip = new VipService(); $check_type = $this->service_->getCheckType($this->agentId);
$check = $vip->vip($this->agentId, 'index/inspectionRecordAll'); $check_type = 1;
if ($check) { if ($check_type == 0) {
return $this->response(101, "暂无权限"); return $this->response(101, "暂无权限");
} }
$result = $this->service_->orderListAll($field, $params, $pageNo, $pageSize,1); $result = $this->service_->orderListAll($field, $params, $pageNo, $pageSize,$check_type);
}else{ }else{
$result = $this->service_->orderList($field, $params, $pageNo, $pageSize); $result = $this->service_->orderList($field, $params, $pageNo, $pageSize);
} }
...@@ -149,59 +149,27 @@ class Report extends Basic ...@@ -149,59 +149,27 @@ class Report extends Basic
} }
} }
public function reportListV2()
/**
* 获取权限
* @return int|\think\Response
*/
public function getCheckType()
{ {
$params = $this->params; $params = $this->params;
$params = array( // $params = array(
"agent_id" => 5741, // "agent_id" => 5741,
"type" => 2,//1表示全部 2表示进场 3 表示收款 4成交报告 // );
"is_all" => 1,//0搜索我自己的,1全部
"page_no" => 1,
"page_size" => 15
);
if (!isset($params["agent_id"]) || !isset($params["type"])) { if (!isset($params["agent_id"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
$result = $this->service_->getCheckType($this->agentId);
$pageNo = empty($params['page_no']) ? 1 : $params['page_no']; if ($result == 0) {
$pageSize = empty($params['page_size']) ? 15 : $params['page_size']; return $this->response(101, "暂无权限");
$field = "a.id,a.user_id,a.user_phone,a.user_name,a.predict_see_time,a.create_time,b.id as order_id,b.order_no,
b.house_id,b.house_title";
$params["report_agent_id"] = $params["agent_id"];
$result = [];
$check_type = 0;
if(isset($params["is_all"]) && $params["is_all"] == 1){
$vip = new VipService();
if($vip->vip($this->agentId, 'inspectionRecordAll/3')){//代表公司
$check_type = 1;
}
if($vip->vip($this->agentId, 'inspectionRecordDistrict/2')){//代表部门
$check_type = 2;
}
if($vip->vip($this->agentId, 'inspectionRecordStore/1')){//代表门店
$check_type = 3;
}
$check_type = 1;
if ($check_type == 0) {
return $this->response(101, "暂无权限");
}
$result = $this->service_->orderListAll($field, $params, $pageNo, $pageSize,$check_type);
}else{
$result = $this->service_->orderList($field, $params, $pageNo, $pageSize);
}
if (count($result) > 0) {
return $this->response("200", "request success", ['list'=>$result,'check_type'=>$check_type]);
} else { } else {
return $this->response("200", "request null"); return $result;
} }
} }
......
...@@ -363,4 +363,26 @@ class ReportService ...@@ -363,4 +363,26 @@ class ReportService
return $param; return $param;
} }
/**
* 获取权限
* @param $agent_id
* @return int
*/
public function getCheckType($agent_id)
{
$vip = new VipService();
if($vip->vip($agent_id, 'inspectionRecordAll/3')){//代表公司
return 1;
}
if($vip->vip($agent_id, 'inspectionRecordDistrict/2')){//代表部门
return 2;
}
if($vip->vip($agent_id, 'inspectionRecordStore/1')){//代表门店
return 3;
}
return 0;
}
} }
\ No newline at end of file
...@@ -644,7 +644,7 @@ Route::group('broker', [ ...@@ -644,7 +644,7 @@ Route::group('broker', [
'reportList' => ['api_broker/Report/reportList', ['method' => 'get']], 'reportList' => ['api_broker/Report/reportList', ['method' => 'get']],
'reportListV2' => ['api_broker/Report/reportListV2', ['method' => 'get']], 'getCheckType' => ['api_broker/Report/getCheckType', ['method' => 'get']],
'reportListForPc' => ['api_broker/Report/reportListForPc', ['method' => 'get']], 'reportListForPc' => ['api_broker/Report/reportListForPc', ['method' => 'get']],
'orderDetail' => ['api_broker/OrderLog/orderDetail', ['method' => 'get|post']], 'orderDetail' => ['api_broker/OrderLog/orderDetail', ['method' => 'get|post']],
......
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