Commit 30f45cc9 authored by clone's avatar clone

1

parent ddf1eb59
......@@ -27,14 +27,16 @@ class OfficeReportService
private $roomModel;
private $roomAgentModel;
private $agentModel;
private $vModel;
function __construct()
{
$this->reportModel = new OfficeOReportModel();
$this->orderModel = new OfficeOrderModel();
$this->roomModel = new OfficeGRoom();
$this->reportModel = new OfficeOReportModel();
$this->orderModel = new OfficeOrderModel();
$this->roomModel = new OfficeGRoom();
$this->roomAgentModel = new OfficeGRoomToAgent();
$this->agentModel = new AAgents();
$this->agentModel = new AAgents();
$this->vModel = new VerifyService();
}
/**
......@@ -121,11 +123,10 @@ class OfficeReportService
{
//todo 获取我报备的我的案场的,
//如果是店长则获取其下所有的经纪人 这里去掉了for190218
$vModel = new VerifyService();
// $agentArr = $vModel->getAgentsByAgentId($params["report_agent_id"]);
$params["agent_id_s"] = array("in", $params["report_agent_id"]);
$caseHouseId = $vModel->getCaseHouseIdByAgentIdV2($params["agent_id_s"]);
$caseHouseId = $this->vModel->getCaseRoomByAgentId($params["agent_id_s"],"1,2,3");
$ids = "";
if (count($caseHouseId) > 0) {
foreach ($caseHouseId as $item) {
......@@ -201,7 +202,6 @@ class OfficeReportService
*/
public function orderListAll($field, $params, $pageNo, $pageSize, $check_type)
{
$vModel = new VerifyService();
$result = [];
switch ($check_type) {
case 1 :
......@@ -209,10 +209,10 @@ class OfficeReportService
break;
case 2 :
case 3 :
$agentArr = $vModel->getAgentsByAgentIdAndType($params["report_agent_id"], $check_type);
$agentArr = $this->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"]);
$caseHouseId = $this->vModel->getCaseRoomByAgentId($params["agent_id_s"],"2,3");
$ids = "";
if (count($caseHouseId) > 0) {
foreach ($caseHouseId as $item) {
......@@ -245,14 +245,13 @@ class OfficeReportService
public function orderListForPc($field, $params, $pageNo, $pageSize)
{
//todo 获取我报备的我的案场的,如果是店长则获取其下所有的经纪人
$vModel = new VerifyService();
$agentArr = $vModel->getAgentsByAgentId($params["report_agent_id"]);
$agentArr = $this->vModel->getAgentsByAgentId($params["report_agent_id"]);
if ($agentArr) {
$params["agent_id_s"] = array("in", $agentArr);
$params["report_agent_id"] = $agentArr;
}
$caseHouseId = $vModel->getCaseHouseIdByAgentId($params["agent_id_s"]);
$caseHouseId = $this->vModel->getCaseRoomByAgentId($params["agent_id_s"],"1");
$ids = "";
if (count($caseHouseId) > 0) {
foreach ($caseHouseId as $item) {
......@@ -419,9 +418,9 @@ class OfficeReportService
//todo 判断是不是案场权限人
$where_["house_id"] = $house_id;
$where_["agent_id"] = $agent_id;
$where_["type"] = 1;
$where_["is_del"] = 0;
$isCase = $this->roomAgentModel->getHouseToAgents("id", $where_);
$where_["type"] = 1;
$where_["is_del"] = 0;
$isCase = $this->roomAgentModel->getHouseToAgents("id", $where_);
if (count($isCase) > 0) {
$result["marchIn"] = true;
$result["collectingBill"] = true;
......@@ -430,26 +429,26 @@ class OfficeReportService
}
} else {
$auth_arr = [
'broker/marchIn',
'broker/collectingBill',
'broker/refund',
'broker/bargain',
'office/marchIn',
'office/collectingBill',
'office/refund',
'office/bargain',
];
$param["name"] = array("in", $auth_arr);
$is_auth = $this->agentModel->agentsAuthIds($agent_id, $param);
if (count($is_auth) > 0) {
foreach ($is_auth as $item) {
if ($item['name'] == "broker/marchIn") {
if ($item['name'] == "office/marchIn") {
$result["marchIn"] = true;
}
if ($item['name'] == "broker/collectingBill") {
if ($item['name'] == "office/collectingBill") {
$result["collectingBill"] = true;
}
if ($item['name'] == "broker/refund") {
if ($item['name'] == "office/refund") {
$result["refund"] = true;
}
if ($item['name'] == "broker/bargain") {
if ($item['name'] == "office/bargain") {
$result["bargain"] = true;
}
}
......
......@@ -4,6 +4,7 @@ namespace app\api_broker\service;
use app\model\AAgents;
use app\model\GHousesToAgents;
use app\model\OfficeGRoomToAgent;
/**
* Created by PhpStorm.
......@@ -298,6 +299,31 @@ class VerifyService
}
/**
* @param $agent_id
* @param $type_str
* @return false|\PDOStatement|string|\think\Collection|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getCaseRoomByAgentId($agent_id,$type_str)
{
$houseToAgentModel = new OfficeGRoomToAgent();
$params["a.agents_id"] = $agent_id;
$params["a.type"] = array("in", $type_str); //案场权限人,盘方和独家
$params["a.is_del"] = 0;
$house_arr = $houseToAgentModel->getHouseByAgentId("a.houses_id,CONCAT(c.address,b.room_number) internal_address", $params);
if (count($house_arr) > 0) {
return $house_arr;
}
return null;
}
/**
* 获取我的盘方和独家
* @param $agent_id
......
......@@ -161,6 +161,14 @@ class OfficeGRoomToAgent extends BaseModel
->select();
}
/**
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getHouseToAgents($field, $params)
{
......@@ -170,4 +178,27 @@ class OfficeGRoomToAgent extends BaseModel
->limit(1)
->select();
}
/**
* @param $field
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getHouseByAgentId($field, $params)
{
$result = Db::name($this->table)
->field($field)
->alias("a")
->join("office_g_room b","a.house=b.id")
->join("office_g_building c","b.building_id=c.id")
->where($params)
->group("a.house_id")
->select();
//echo Db::name($this->table)->getLastSql();
return $result;
}
}
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