Commit 24848b15 authored by zw's avatar zw

查询当前调整的成交报告

parent 70597021
......@@ -642,6 +642,34 @@ class OrderLog extends Basic
}
/**
* 搜索我的成交报告
* @return \think\Response
*/
public function searchBargainListByOrderId()
{
$params = $this->params;
/* $params = array(
"order_id" => 11231,
);*/
if (!isset($params["order_id"]) ) {
return $this->response("101", "请求参数错误");
}
try {
$result = $this->service_->getBargainListByOrderId($params);
if (count($result) > 0) {
return $this->response("200", "request success", $result);
} else {
return $this->response("200", "request null");
}
} catch (Exception $e) {
return $this->response("101", "request error,msg:" . $e);
}
}
/**
* 搜索经纪人
* @return \think\Response
......
......@@ -1374,6 +1374,42 @@ class OrderLogService
}
/**
* 根据订单id搜索成交报告
* @param $params
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getBargainListByOrderId($order_id)
{
$params["order_id"] = $order_id;
$bargainModel = new OBargainModel();
$filed = "a.id,a.father_id,a.house_number,a.commission,a.agent_id,a.create_time,b.user_phone,b.user_name,b.user_id,c.id as order_id,
d.id as house_id,d.internal_title,d.internal_address";
$result = $bargainModel->selectBargainList($filed, $params,1, 15);
$list = [];
foreach ($result as $k => $v) {
$father_id = $v["father_id"];
if ($father_id > 0 && in_array($father_id, $list)) {
unset($result[$k]);
} else {
$result[$k]["create_time"] = date("Y-m-d", strtotime($v["create_time"]));
$result[$k]["id"] = $v["father_id"] == 0 ? $v["id"] : $v["father_id"];
array_push($list, $father_id);
}
}
$sortResult = [];
foreach ($result as $k => $v) {
$sortResult[] = $v;
}
return $sortResult;
}
private function recursion($params, $cent_commissions, $i)
{
......
......@@ -249,6 +249,9 @@ class OBargainModel extends Model
if (isset($params["account_statement"])) {
$where_["a.account_statement"] = $params["account_statement"];
}
if (isset($params["order_id"])) {
$where_["a.order_id"] = $params["order_id"];
}
if (isset($params["father_id"])) {
$where_["a.father_id"] = $params["father_id"];
......
......@@ -648,6 +648,9 @@ Route::group('broker', [
'searchAgents' => ['api_broker/OrderLog/searchAgents', ['method' => 'get']],
'searchBargainList' => ['api_broker/OrderLog/searchBargainList', ['method' => 'get']],
'searchBargainListByOrderId' => ['api_broker/OrderLog/searchBargainListByOrderId', ['method' => 'get']],
'getListByHouseId' => ['api_broker/OrderLog/getListByHouseId', ['method' => 'get']],
'searchBargainAgents' => ['api_broker/OrderLog/searchBargainAgents', ['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