Commit 37311b9c authored by zw's avatar zw

统计

parent b142c709
......@@ -115,6 +115,42 @@ class Report extends Basic
}
}
/**
* 获取报备列表 pc
*
* @return \think\Response
*/
public function reportListForPc()
{
/* $params = array(
"agent_id" =>10013,
"type" => 1,//1表示全部 2表示进场 3 表示收款 4成交报告
"page_no"=>1,
"page_size"=>15
);*/
$params = $this->params;
if (!isset($params["agent_id"]) || !isset($params["type"])) {
return $this->response("101", "请求参数错误");
}
$pageNo = empty($params['page_no']) ? 1 : $params['page_no'];
$pageSize = empty($params['page_size']) ? 15 : $params['page_size'];
$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 = $this->service_->orderListForPc($field, $params, $pageNo, $pageSize);
if (count($result) > 0) {
return $this->response("200", "request success", $result);
} else {
return $this->response("200", "request null");
}
}
/**
......
......@@ -160,6 +160,66 @@ class ReportService
return null;
}
/**
* 报备订单列表
* @param $field
* @param $params
* @param $pageNo
* @param $pageSize
* @return mixed|null
* @throws \think\db\exception\BindParamException
* @throws \think\exception\PDOException
*/
public function orderListForPc($field, $params, $pageNo, $pageSize)
{
//todo 获取我报备的我的案场的,如果是店长则获取其下所有的经纪人
$vModel = new VerifyService();
$agentArr = $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"]);
$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);
$count = $this->oReportModel->selectReportCount($field,$params);
$ids_str = "";
if (count($result) > 0) {
foreach ($result as $k => $v) {
//$result[$k]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $v["user_phone"]);
$ids_str .= $v["order_id"] . ",";
}
$ids_str = rtrim($ids_str, ",");
$sign_arr = $this->orderSign($ids_str);
foreach ($result as $k => $v) {
$result[$k]["sign"] = "";
foreach ($sign_arr as $value) {
if ($v["order_id"] == $value["order_id"]) {
$result[$k]["sign"] .= $this->signTitle($value["type"]) . ",";
}
}
}
$data["result"] = $result;
$data["total"] = $count[0]["total"];
return $data;
}
return null;
}
public function orderSign($ids_str)
{
......
......@@ -428,6 +428,7 @@ Route::group('broker', [
'reportList' => [ 'api_broker/Report/reportList', [ 'method' => 'get' ] ],
'reportListForPc' => [ 'api_broker/Report/reportListForPc', [ 'method' => 'get' ] ],
'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