Commit ddb31b73 authored by clone's avatar clone

1

parent 380d15fc
......@@ -112,13 +112,13 @@ class Report extends Basic
public function reportList()
{
$params = $this->params;
/* $params = array(
"agent_id" =>1,
"type" => 2,//1表示全部 2表示进场 3 表示收款 4成交报告
"is_all"=>1,//0搜索我自己的,1全部
$params = array(
"agent_id" =>6562,
"type" => 1,//1表示全部 2表示进场 3 表示收款 4成交报告
"is_all"=>0,//0搜索我自己的,1全部
"page_no"=>1,
"page_size"=>15
);*/
);
if (!isset($params["agent_id"]) || !isset($params["type"])) {
......@@ -140,6 +140,7 @@ class Report extends Basic
$check_type = 1;
if ($agents_data["level"] < 30) {
$check_type = $this->service_->getCheckType($this->agentId);
echo $check_type;
if ($check_type == 0) {
return $this->response(101, "暂无权限");
}
......
......@@ -45,9 +45,9 @@ class ReportService
if (count($userArr) > 0) {
$userResult["user_phone"] = $userArr["user_phone"];
if (empty($userArr['user_name'])) {
$userResult["user_name"] = $userArr["user_nick"];
$userResult["user_name"] = $userArr["user_nick"];
} else {
$userResult["user_name"] = $userArr["user_name"];
$userResult["user_name"] = $userArr["user_name"];
}
} else {
return null;
......@@ -86,7 +86,7 @@ class ReportService
foreach ($house_arr as $k => $v) {
//todo 批量插入到数据库
if($v <= 0){
if ($v <= 0) {
break;
}
$order_no = $this->createOrderNumber();
......@@ -112,29 +112,21 @@ class ReportService
{
//todo 获取我报备的我的案场的,
//如果是店长则获取其下所有的经纪人 这里去掉了for190218
$agentModel = new AAgents();
$agents_data = $agentModel->getAgentInfo('id,level', $params["agent_id"]);
if($agents_data["level"] == 30 || $agents_data["level"] == 40 ) {
$vModel = new VerifyService();
$params["agent_id_s"] = array("in", $params["report_agent_id"]);
$caseHouseId = $vModel->getCaseHouseIdByAgentIdV2($params["agent_id_s"]);
$ids = "";
if (count($caseHouseId) > 0) {
foreach ($caseHouseId as $item) {
$ids .= $item["houses_id"] . ",";
}
}
$ids = rtrim($ids, ",");
$ids = $ids ? $ids : 0;
$params["house_ids"] = $ids;
$vModel = new VerifyService();
$params["agent_id_s"] = array("in", $params["report_agent_id"]);
$result = $this->oReportModel->selectReportList($field, $params, $pageNo, $pageSize);
}else{
$result = $this->oReportModel->selectReportListAll($field, $params, $pageNo, $pageSize,1);
$caseHouseId = $vModel->getCaseHouseIdByAgentIdV2($params["agent_id_s"]);
$ids = "";
if (count($caseHouseId) > 0) {
foreach ($caseHouseId as $item) {
$ids .= $item["houses_id"] . ",";
}
}
$ids = rtrim($ids, ",");
$ids = $ids ? $ids : 0;
$params["house_ids"] = $ids;
$result = $this->oReportModel->selectReportList($field, $params, $pageNo, $pageSize);
return $this->returnResult($result);
}
......@@ -146,25 +138,26 @@ class ReportService
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function returnResult($result){
$ids_str = "";
public function returnResult($result)
{
$ids_str = "";
$house_id_str = "";
if (count($result) > 0) {
foreach ($result as $k => $v) {
$order_id = 0;
if(isset($v["order_id"])){
if (isset($v["order_id"])) {
$order_id = $v["order_id"];
}else{
} else {
$order_id = $v["id"];
}
$ids_str .= $order_id . ",";
$ids_str .= $order_id . ",";
$house_id_str .= $v["house_id"] . ",";
}
$ids_str = rtrim($ids_str, ",");
$ids_str = rtrim($ids_str, ",");
$house_id_str = rtrim($house_id_str, ",");
$sign_arr = $this->orderSign($ids_str);
$sign_arr = $this->orderSign($ids_str);
$house_arr = $this->houseInfo($house_id_str);
foreach ($result as $k => $v) {
......@@ -182,8 +175,9 @@ class ReportService
}
}
return $result;
return $result;
}
/**
* 报备订单列表All
* @param $field
......@@ -194,9 +188,9 @@ class ReportService
* @throws \think\db\exception\BindParamException
* @throws \think\exception\PDOException
*/
public function orderListAll($field, $params, $pageNo, $pageSize,$check_type)
public function orderListAll($field, $params, $pageNo, $pageSize, $check_type)
{
$vModel = new VerifyService();
$vModel = new VerifyService();
$result = [];
switch ($check_type) {
case 1 :
......@@ -204,19 +198,19 @@ class ReportService
break;
case 2 :
case 3 :
$agentArr = $vModel->getAgentsByAgentIdAndType($params["report_agent_id"], $check_type);
$params["agent_id_s"] = array( "in", $agentArr);
$agentArr = $vModel->getAgentsByAgentIdAndType($params["report_agent_id"], $check_type);
$params["agent_id_s"] = array("in", $agentArr);
$params["report_agent_id"] = $agentArr;
$caseHouseId = $vModel->getPanpartyAndExclusiveHouseIdByAgentId($params["agent_id_s"]);
$ids = "";
$caseHouseId = $vModel->getPanpartyAndExclusiveHouseIdByAgentId($params["agent_id_s"]);
$ids = "";
if (count($caseHouseId) > 0) {
foreach ($caseHouseId as $item) {
$ids .= $item["houses_id"] . ",";
}
}
$ids = rtrim($ids, ",");
$ids = $ids ? $ids : 0;
$ids = rtrim($ids, ",");
$ids = $ids ? $ids : 0;
$params["house_ids"] = $ids;
$result = $this->oReportModel->selectReportList($field, $params, $pageNo, $pageSize);
......@@ -242,9 +236,9 @@ class ReportService
*/
public function houseInfo($house_id_str)
{
$houseModel = new GHouses();
$params["id"] = array("in",($house_id_str));
return $houseModel->getHouseInfo("id,internal_address",$params);
$houseModel = new GHouses();
$params["id"] = array("in", ($house_id_str));
return $houseModel->getHouseInfo("id,internal_address", $params);
}
public function signTitle($type)
......@@ -319,7 +313,7 @@ class ReportService
private function orderBin($order_no, $f_id, $house_id)
{
$houseModel = new GHouses();
$houseResult = $houseModel->getHouseDetail("id,internal_title", [ "id" => $house_id ]);
$houseResult = $houseModel->getHouseDetail("id,internal_title", ["id" => $house_id]);
$house_title = count($houseResult) > 0 && isset($houseResult["internal_title"]) ? $houseResult["internal_title"] : null;
$param["order_no"] = $order_no;
$param["f_id"] = $f_id;
......@@ -339,15 +333,15 @@ class ReportService
public function getCheckType($agent_id)
{
$vip = new VipService();
if($vip->vip($agent_id, 'index/inspectionRecordAll/3') == 0){//代表公司
if ($vip->vip($agent_id, 'index/inspectionRecordAll/3') == 0) {//代表公司
return 1;
}
if($vip->vip($agent_id, 'index/inspectionRecordDistrict/2') == 0){//代表部门
if ($vip->vip($agent_id, 'index/inspectionRecordDistrict/2') == 0) {//代表部门
return 2;
}
if($vip->vip($agent_id, 'index/inspectionRecordStore/1') == 0){//代表门店
if ($vip->vip($agent_id, 'index/inspectionRecordStore/1') == 0) {//代表门店
return 3;
}
return 0;
......
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