Commit ddf1eb59 authored by clone's avatar clone

1

parent 42a3d28c
...@@ -210,6 +210,9 @@ class OfficeReport extends Basic ...@@ -210,6 +210,9 @@ class OfficeReport extends Basic
/** /**
* 权限判定 * 权限判定
* @return \think\Response * @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function appAgentAuth() public function appAgentAuth()
{ {
...@@ -222,62 +225,11 @@ class OfficeReport extends Basic ...@@ -222,62 +225,11 @@ class OfficeReport extends Basic
if (!isset($params["agent_id"])) { if (!isset($params["agent_id"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
if (isset($params["house_id"])) { $agent_id = $params["agent_id"];
$agent_id = $params["agent_id"]; $house_id = isset($params["house_id"]) ? $params["house_id"] : 0;
$house_id = $params["house_id"];
//todo 判断是不是案场权限人
$agentToHouseModel = new GHousesToAgents();
$where_["houses_id"] = $house_id;
$where_["agents_id"] = $agent_id;
$where_["type"] = 1;
$where_["is_del"] = 0;
$isCase = $agentToHouseModel->getHouseToAgents("id", $where_);
$result["marchIn"] = $result["collectingBill"] = $result["refund"] = $result["bargain"] = false;
if (count($isCase) > 0) {
$result["marchIn"] = true;
$result["collectingBill"] = true;
$result["refund"] = true;
$result["bargain"] = true;
return $this->response("200", "request success", $result);
}
}
$auth_arr = [ $result = $this->service_->appAgentAuth($agent_id,$house_id);
/*'broker/report', return $this->response("200", "request null",$result);
'broker/addFollowUp',*/
'broker/marchIn',
'broker/collectingBill',
'broker/refund',
'broker/bargain',
/* 'broker/statusBargain',*/
];
$param["name"] = array( "in", $auth_arr );
$agents = new AAgents();
$is_auth = $agents->agentsAuthIds($params["agent_id"], $param);
if (count($is_auth) > 0) {
foreach ($is_auth as $item) {
if ($item['name'] == "broker/marchIn") {
$result["marchIn"] = true;
}
if ($item['name'] == "broker/collectingBill") {
$result["collectingBill"] = true;
}
if ($item['name'] == "broker/refund") {
$result["refund"] = true;
}
if ($item['name'] == "broker/bargain") {
$result["bargain"] = true;
}
}
return $this->response("200", "request success", $result);
}
return $this->response("200", "request null");
} }
......
...@@ -3,9 +3,11 @@ ...@@ -3,9 +3,11 @@
namespace app\api_broker\service; namespace app\api_broker\service;
use app\api\untils\GeTuiUtils; use app\api\untils\GeTuiUtils;
use app\model\AAgents;
use app\model\GHouses; use app\model\GHouses;
use app\model\GHousesToAgents; use app\model\GHousesToAgents;
use app\model\OfficeGRoom; use app\model\OfficeGRoom;
use app\model\OfficeGRoomToAgent;
use app\model\OfficeOrderModel; use app\model\OfficeOrderModel;
use app\model\OfficeOReportModel; use app\model\OfficeOReportModel;
use app\model\Users; use app\model\Users;
...@@ -22,11 +24,17 @@ class OfficeReportService ...@@ -22,11 +24,17 @@ class OfficeReportService
private $reportModel; private $reportModel;
private $orderModel; private $orderModel;
private $roomModel;
private $roomAgentModel;
private $agentModel;
function __construct() function __construct()
{ {
$this->reportModel = new OfficeOReportModel(); $this->reportModel = new OfficeOReportModel();
$this->orderModel = new OfficeOrderModel(); $this->orderModel = new OfficeOrderModel();
$this->roomModel = new OfficeGRoom();
$this->roomAgentModel = new OfficeGRoomToAgent();
$this->agentModel = new AAgents();
} }
/** /**
...@@ -102,8 +110,11 @@ class OfficeReportService ...@@ -102,8 +110,11 @@ class OfficeReportService
* @param $params * @param $params
* @param $pageNo * @param $pageNo
* @param $pageSize * @param $pageSize
* @return mixed|null * @return mixed
* @throws \think\db\exception\BindParamException * @throws \think\db\exception\BindParamException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\PDOException * @throws \think\exception\PDOException
*/ */
public function orderList($field, $params, $pageNo, $pageSize) public function orderList($field, $params, $pageNo, $pageSize)
...@@ -279,9 +290,8 @@ class OfficeReportService ...@@ -279,9 +290,8 @@ class OfficeReportService
*/ */
public function houseInfo($house_id_str) public function houseInfo($house_id_str)
{ {
$houseModel = new GHouses(); $params["a.id"] = array("in", ($house_id_str));
$params["id"] = array("in", ($house_id_str)); return $this->roomModel->getHouseInfo("a.id,CONCAT(b.address,a.room_number) internal_address", $params);
return $houseModel->getHouseInfo("id,internal_address", $params);
} }
public function signTitle($type) public function signTitle($type)
...@@ -356,7 +366,7 @@ class OfficeReportService ...@@ -356,7 +366,7 @@ class OfficeReportService
private function orderBin($order_no, $f_id, $house_id) private function orderBin($order_no, $f_id, $house_id)
{ {
$roomModel = new OfficeGRoom(); $roomModel = new OfficeGRoom();
$houseResult = $roomModel->getHouseDetail("a.id,c.title,c.address,a.room_number", ["id" => $house_id]); $houseResult = $roomModel->getHouseDetail("a.id,c.title,c.address,a.room_number", ["a.id" => $house_id]);
$house_title = count($houseResult) > 0 ? $houseResult["address"] . " " . $houseResult["room_number"] : null; $house_title = count($houseResult) > 0 ? $houseResult["address"] . " " . $houseResult["room_number"] : null;
$param["order_no"] = $order_no; $param["order_no"] = $order_no;
$param["f_id"] = $f_id; $param["f_id"] = $f_id;
...@@ -389,4 +399,64 @@ class OfficeReportService ...@@ -389,4 +399,64 @@ class OfficeReportService
} }
return 0; return 0;
} }
/**
* @param $agent_id
* @param $house_id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function appAgentAuth($agent_id, $house_id)
{
$result["marchIn"] = false;
$result["collectingBill"] = false;
$result["refund"] = false;
$result["bargain"] = false;
if ($house_id > 0) {
//todo 判断是不是案场权限人
$where_["house_id"] = $house_id;
$where_["agent_id"] = $agent_id;
$where_["type"] = 1;
$where_["is_del"] = 0;
$isCase = $this->roomAgentModel->getHouseToAgents("id", $where_);
if (count($isCase) > 0) {
$result["marchIn"] = true;
$result["collectingBill"] = true;
$result["refund"] = true;
$result["bargain"] = true;
}
} else {
$auth_arr = [
'broker/marchIn',
'broker/collectingBill',
'broker/refund',
'broker/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") {
$result["marchIn"] = true;
}
if ($item['name'] == "broker/collectingBill") {
$result["collectingBill"] = true;
}
if ($item['name'] == "broker/refund") {
$result["refund"] = true;
}
if ($item['name'] == "broker/bargain") {
$result["bargain"] = true;
}
}
}
}
return $result;
}
} }
\ No newline at end of file
...@@ -436,4 +436,25 @@ class OfficeGRoom extends BaseModel ...@@ -436,4 +436,25 @@ class OfficeGRoom extends BaseModel
->where($params) ->where($params)
->find(); ->find();
} }
/**
* @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 getHouseInfo($field, $params)
{
$result = Db::table($this->table)
->field($field)
->alias("a")
->join("office_g_building b","a.building_id=a.id")
->where($params)
->select();
return $result;
}
} }
...@@ -160,4 +160,14 @@ class OfficeGRoomToAgent extends BaseModel ...@@ -160,4 +160,14 @@ class OfficeGRoomToAgent extends BaseModel
->where($params) ->where($params)
->select(); ->select();
} }
public function getHouseToAgents($field, $params)
{
return Db::table($this->table)
->field($field)
->where($params)
->limit(1)
->select();
}
} }
...@@ -65,18 +65,22 @@ class OfficeOrderModel extends Model ...@@ -65,18 +65,22 @@ class OfficeOrderModel extends Model
return $result; return $result;
} }
/** /**
* @param $ids * @param $ids
* @return false|\PDOStatement|string|\think\Collection * @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/ */
public function selectSign($ids) public function selectSign($ids)
{ {
return $this->db_ return $this->db_
->field('id as order_id,1 as type') ->field('id as order_id,1 as type')
->where("id", "in", 0) ->where("id", "in", 0)
->union('SELECT order_id,2 as type FROM o_march_in where order_id in (' . $ids . ') group by order_id') ->union('SELECT order_id,2 as type FROM office_o_march_in where order_id in (' . $ids . ') group by order_id')
->union('SELECT order_id,3 as type FROM o_paylog where order_id in (' . $ids . ') group by order_id') ->union('SELECT order_id,3 as type FROM office_o_paylog where order_id in (' . $ids . ') group by order_id')
->union('SELECT order_id,4 as type FROM o_bargain where order_id in (' . $ids . ') group by order_id') ->union('SELECT order_id,4 as type FROM office_o_bargain where order_id in (' . $ids . ') group by order_id')
->select(); ->select();
} }
......
...@@ -986,6 +986,8 @@ Route::group('office', [ ...@@ -986,6 +986,8 @@ Route::group('office', [
'reportList' => ['api_broker/OfficeReport/reportList', ['method' => 'get']], 'reportList' => ['api_broker/OfficeReport/reportList', ['method' => 'get']],
'getCheckType' => ['api_broker/OfficeReport/getCheckType', ['method' => 'get|post']], 'getCheckType' => ['api_broker/OfficeReport/getCheckType', ['method' => 'get|post']],
'reportListForPc' => ['api_broker/OfficeReport/reportListForPc', ['method' => 'get']], 'reportListForPc' => ['api_broker/OfficeReport/reportListForPc', ['method' => 'get']],
'appAgentAuth' => ['api_broker/OfficeReport/appAgentAuth', ['method' => 'get']],
'getRoomListByReport' => ['api_broker/OfficeRoom/getRoomListByReport', ['method' => 'get|post']], 'getRoomListByReport' => ['api_broker/OfficeRoom/getRoomListByReport', ['method' => 'get|post']],
'addShopFollowUp' => ['api_broker/OfficeRoom/addShopFollowUp', ['method' => 'get|post']], 'addShopFollowUp' => ['api_broker/OfficeRoom/addShopFollowUp', ['method' => 'get|post']],
'getMyBuildingRoom' => ['api_broker/OfficeRoom/getMyBuildingRoom', ['method' => 'get|post']], 'getMyBuildingRoom' => ['api_broker/OfficeRoom/getMyBuildingRoom', ['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