Commit 9b1b53cc authored by zw's avatar zw

全部带看记录

parent fb390dde
......@@ -107,13 +107,15 @@ class Report extends Basic
*/
public function reportList()
{
/* $params = array(
"agent_id" =>10013,
"type" => 1,//1表示全部 2表示进场 3 表示收款 4成交报告
"page_no"=>1,
"page_size"=>15
);*/
$params = $this->params;
/* $params = array(
"agent_id" =>10013,
"type" => 1,//1表示全部 2表示进场 3 表示收款 4成交报告
"is_all"=>1,//0搜索我自己的,1全部
"page_no"=>1,
"page_size"=>15
);*/
if (!isset($params["agent_id"]) || !isset($params["type"])) {
return $this->response("101", "请求参数错误");
......@@ -125,8 +127,13 @@ class Report extends Basic
$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 = [];
if(isset($params["is_all"]) && $params["is_all"] == 1){
$result = $this->service_->orderListAll($field, $params, $pageNo, $pageSize);
}else{
$result = $this->service_->orderList($field, $params, $pageNo, $pageSize);
}
$result = $this->service_->orderList($field, $params, $pageNo, $pageSize);
if (count($result) > 0) {
return $this->response("200", "request success", $result);
......
......@@ -155,6 +155,45 @@ class ReportService
return null;
}
/**
* 报备订单列表All
* @param $field
* @param $params
* @param $pageNo
* @param $pageSize
* @return mixed|null
* @throws \think\db\exception\BindParamException
* @throws \think\exception\PDOException
*/
public function orderListAll($field, $params, $pageNo, $pageSize)
{
$params = [];
$result = $this->oReportModel->selectReportList($field, $params, $pageNo, $pageSize);
$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"]) . ",";
}
}
}
return $result;
}
return null;
}
/**
* 报备订单列表
* @param $field
......
......@@ -173,12 +173,15 @@ class OReportModel extends Model
*/
public function selectReportList($filed = "id", $params, $pageNo, $pageSize)
{
$report_agent_str = $house_str = "1=1 ";
$start_index = ($pageNo - 1) * $pageSize;
if (isset($params["report_agent_id"])) {
$report_agent_id = $params["report_agent_id"];
$report_agent_str = "a.report_agent_id IN ($report_agent_id )";
}
if (isset($params["house_ids"])) {
$house_ids = $params["house_ids"];
$house_str = "b.house_id IN ($house_ids)";
}
// 约带看时间 开始 结束
......@@ -226,7 +229,7 @@ class OReportModel extends Model
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
RIGHT JOIN `o_march_in` `c` ON `b`.`id` = `c`.`order_id`
WHERE
`a`.`report_agent_id` IN ($report_agent_id )
$report_agent_str
AND `a`.`status` = 0
AND `b`.`is_del` = 0
GROUP BY
......@@ -239,7 +242,7 @@ class OReportModel extends Model
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
RIGHT JOIN `o_march_in` `c` ON `b`.`id` = `c`.`order_id`
WHERE
`b`.`house_id` IN ($house_ids)
$house_str
AND `a`.`status` = 0
AND `b`.`is_del` = 0
GROUP BY
......@@ -259,7 +262,7 @@ class OReportModel extends Model
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
RIGHT JOIN `o_paylog` `c` ON `b`.`id` = `c`.`order_id`
WHERE
`a`.`report_agent_id` IN ($report_agent_id )
$report_agent_str
AND `a`.`status` = 0
AND `b`.`is_del` = 0
GROUP BY
......@@ -274,7 +277,7 @@ class OReportModel extends Model
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
RIGHT JOIN `o_paylog` `c` ON `b`.`id` = `c`.`order_id`
WHERE
`b`.`house_id` IN ($house_ids)
$house_str
AND `a`.`status` = 0
AND `b`.`is_del` = 0
GROUP BY
......@@ -294,7 +297,7 @@ class OReportModel extends Model
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
RIGHT JOIN `o_bargain` `c` ON `b`.`id` = `c`.`order_id`
WHERE
`a`.`report_agent_id` IN ($report_agent_id )
$report_agent_str
AND `a`.`status` = 0
AND `b`.`is_del` = 0
GROUP BY
......@@ -309,7 +312,7 @@ class OReportModel extends Model
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
RIGHT JOIN `o_bargain` `c` ON `b`.`id` = `c`.`order_id`
WHERE
`b`.`house_id` IN ($house_ids)
$house_str
AND `a`.`status` = 0
AND `b`.`is_del` = 0
GROUP BY
......@@ -326,7 +329,7 @@ class OReportModel extends Model
`o_report` `a`
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
WHERE
`a`.`report_agent_id` IN ($report_agent_id )
$report_agent_str
AND `a`.`status` = 0
AND `b`.`is_del` = 0)
UNION
......@@ -336,7 +339,7 @@ class OReportModel extends Model
`o_report` `a`
LEFT JOIN `o_order` `b` ON `a`.`id` = `b`.`f_id`
WHERE
`b`.`house_id` IN ($house_ids)
$house_str
AND `a`.`status` = 0
AND `b`.`is_del` = 0
) ) as aaa $where_params ORDER BY `create_time` DESC limit $start_index,$pageSize";
......
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