Commit db99575f authored by clone's avatar clone

1

parent 878f0f50
...@@ -4,6 +4,7 @@ namespace app\api_broker\controller; ...@@ -4,6 +4,7 @@ namespace app\api_broker\controller;
use app\api_broker\extend\Basic; use app\api_broker\extend\Basic;
use app\api_broker\service\LookShopService; use app\api_broker\service\LookShopService;
use app\api_broker\service\OrderLogService;
use app\api_broker\service\VerifyService; use app\api_broker\service\VerifyService;
use app\api_broker\service\VipService; use app\api_broker\service\VipService;
use app\index\service\HouseService; use app\index\service\HouseService;
...@@ -1363,4 +1364,26 @@ class Shop extends Basic ...@@ -1363,4 +1364,26 @@ class Shop extends Basic
return $this->response("200", "success", $logArr); return $this->response("200", "success", $logArr);
} }
/**
* 商铺详情页带看动态
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getReportListByHouseId()
{
$params = $this->params;
$house_id = $params["house_id"];
if (!$house_id) {
return $this->response("101", "请求参数错误");
}
$orderLogService = new OrderLogService();
$houseArr = $orderLogService->selectReportListByHouseId($house_id);
if (count($houseArr) > 0) {
return $this->response("200", "success", $houseArr);
}
return $this->response("101", "null");
}
} }
...@@ -1080,6 +1080,117 @@ class OrderLogService ...@@ -1080,6 +1080,117 @@ class OrderLogService
return $this->sortByTime($result); return $this->sortByTime($result);
} }
/**
* 最新 商铺动态时间轴
* @param $house_id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function selectReportListByHouseId($house_id)
{
$result = [];
$sort = 0;
//todo 1.验证订单是否存在
$oReportModel = new OReportModel();
$oMarchInModel = new OMarchInModel();
$oPayLogModel = new OPayLogModel();
$oRefundModel = new ORefundModel();
$oBargainModel = new OBargainModel();
$field_report = "a.id,a.user_id,a.create_time,a.predict_see_time,a.intro,b.id as order_id,b.house_id,b.house_title,c.id as agent_id,c.name,c.img,d.store_name";
$reportData = $oReportModel->selectReportByUserId($field_report, ["house_id" => $house_id]);
$order_ids = $report_ids = "";
//报备
foreach ($reportData as $k => $v) {
$v["step_name"] = "report";
//$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
$house_title = $v['house_title'];
$v["step"] = "报备【id:" . $v['house_id'] . " " . $house_title . "】";
$result[$sort++] = $v;
$order_ids .= $v["order_id"] . ",";
$report_ids .= $v["id"] . ",";
}
$order_ids = rtrim($order_ids, ",");
$report_ids = rtrim($report_ids, ",");
$orderParams["order_id"] = array("in", $order_ids);
$reportParams["report_id"] = array("in", $report_ids);
$tree = [];
foreach ($reportData as $i => $j) {
$tree[$j["id"]] = $j;
}
//进场 march in
$field_march_in = "a.id,a.reception_id,a.report_id,a.create_time,b.id as order_id,b.house_id,b.house_title,c.id as agent_id,c.name,c.img,d.store_name";
$marchInData = $oMarchInModel->getMarchInListByOrderId($field_march_in, $orderParams);
if (count($marchInData) > 0) {
foreach ($marchInData as $k => $v) {
$v["step_name"] = "march_in";
$v["user_id"] = $tree[$v["report_id"]]["user_id"];
//$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
$house_title = $v['house_title'];
$v["step"] = "进场【id:" . $v['house_id'] . " " . $house_title . "】";
$result[$sort++] = $v;
}
}
//收款
$field_pay_log = "a.id,a.create_time,a.report_id,b.id as order_id,b.house_id,b.house_title,c.id as agent_id,c.name,c.img,d.store_name";
$payLogData = $oPayLogModel->getPayLogByOrderId($field_pay_log, $orderParams);
if (count($payLogData) > 0) {
foreach ($payLogData as $k => $v) {
$v["step_name"] = "pay_log";
$v["user_id"] = $tree[$v["report_id"]]["user_id"];
//$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
$house_title = $v['house_title'];
$v["step"] = "收款【id:" . $v['house_id'] . " " . $house_title . "】";
$result[$sort++] = $v;
}
}
//退款
$field_refund = "a.id,a.create_time,a.report_id,b.id as order_id,b.house_id,b.house_title,c.id as agent_id,c.name,c.img,d.store_name";
$refundData = $oRefundModel->getRefundByOrderId($field_refund, $orderParams);
if (count($refundData) > 0) {
foreach ($refundData as $k => $v) {
$v["step_name"] = "refund";
$v["user_id"] = $tree[$v["report_id"]]["user_id"];
//$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
$house_title = $v['house_title'];
$v["step"] = "退款【id:" . $v['house_id'] . " " . $house_title . "】";
$result[$sort++] = $v;
}
}
//成交报告
$field_bargain = "a.id,a.create_time,a.report_id,a.house_number,a.is_open,b.id as order_id,b.house_id,b.house_title,c.id as agent_id,c.name,c.img,d.store_name";
$bargainData = $oBargainModel->getBargainByOrderId($field_bargain, $orderParams);
if (count($bargainData) > 0) {
foreach ($bargainData as $k => $v) {
$v["step_name"] = "bargain";
$v["user_id"] = $tree[$v["report_id"]]["user_id"];
//$house_title = mb_substr($v['house_title'], 0, 3, 'utf-8') . "***";
$house_title = $v['house_title'];
$v["step"] = "成交报告【id:" . $v['house_id'] . " " . $house_title . "】";
$result[$sort++] = $v;
}
}
return $this->sortByTime($result);
}
/** /**
* 查询流程 商铺动态 * 查询流程 商铺动态
......
...@@ -998,6 +998,7 @@ Route::group('broker', [ ...@@ -998,6 +998,7 @@ Route::group('broker', [
'addApplies' => ['api_broker/AppointmentShop/addApplies', ['method' => 'POST']],//我的客户预约转为 'addApplies' => ['api_broker/AppointmentShop/addApplies', ['method' => 'POST']],//我的客户预约转为
'addFollow' => ['api_broker/AppointmentShop/addFollow', ['method' => 'POST']],//我的客户跟进 'addFollow' => ['api_broker/AppointmentShop/addFollow', ['method' => 'POST']],//我的客户跟进
'getHouseAddress' => ['api_broker/shop/getHouseAddress', ['method' => 'get']], //搜索商铺地址 'getHouseAddress' => ['api_broker/shop/getHouseAddress', ['method' => 'get']], //搜索商铺地址
'getReportListByHouseId' => ['api_broker/shop/getReportListByHouseId', ['method' => 'get']], //商铺时间轴
//业绩日报周报重写 //业绩日报周报重写
......
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