Commit a935f411 authored by zw's avatar zw

业绩订单列表

parent 6c4f82c6
......@@ -84,7 +84,7 @@ class Performance extends Basic
return $this->response("200", "request success", $result);
}
public function orderNoLIst(){
public function orderNoList(){
$params = $this->params;
$params = array(
"agent_id" => 1,
......@@ -92,7 +92,7 @@ class Performance extends Basic
"end_time" => "2018-03-23",
"is_case" => 2,//1经纪人 2案场
"house_id" => 0,
"type" => 1 // 1带看 2进场 3收款 4成交报告
"type" => 2 // 1带看 2进场 3收款 4成交报告
);
if (!isset($params["agent_id"]) || !isset($params["start_time"]) || !isset($params["end_time"]) || !isset($params["type"]) ) {
return $this->response("101", "请求参数错误");
......
......@@ -200,25 +200,26 @@ class PerformanceService
}
/**
* @param $agent_id
* @param $start_time
* @param $end_time
* @param $is_case
* @param $house_id
* @param $type
* @return null
*/
public function orderList($agent_id, $start_time, $end_time, $is_case, $house_id, $type)
{
$result = [];
$params = [];
switch ($is_case) {
case 1:
$params["agent_id"] = $agent_id;
$params['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
$result = $this->nowTimeSum($params);
break;
case
2: //案场
$house_id_arr = [];
case 2: //案场
if ($house_id > 0) { // 如果有传楼盘id证明是筛选
$condition["house_ids"] = $house_id;
$params["house_ids"] = $house_id;
} else {
$vService = new VerifyService();
$house_id_arr = $vService->getCaseHouseIdByAgentId($agent_id);
......@@ -226,18 +227,14 @@ class PerformanceService
foreach ($house_id_arr as $item) {
$ids .= $item["houses_id"] . ",";
}
$ids = rtrim($ids, ",");
$condition["house_ids"] = $ids;
$ids = rtrim($ids, ",");
$params["house_ids"] = $ids;
}
$condition['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
$result = $this->nowTimeSum($condition);
if (count($result) > 0 && $house_id == 0) {
$result["house_arr"] = $house_id_arr;
}
break;
}
$result = $this->getOrderList($params,$type);
if (count($result) > 0) {
return $result;
} else {
......@@ -246,6 +243,35 @@ class PerformanceService
}
private function getOrderList($params, $type)
{
$result = [];
//1带看 2进场 3收款 4成交报告
switch ($type) {
case 1:
$field = "DATE(a.create_time) as create_time,a.user_phone,a.user_name,a.user_id,b.house_id,b.house_title";
$result = $this->reportModel->getAddReportOrderList($field, $params);
break;
case 2:
$field = "DATE(a.create_time) as create_time ,b.house_id,b.house_title,c.user_phone,c.user_name,c.user_id";
$result = $this->marchInModel->getAddMarchInOrderList($field,$params);
break;
case 3:
$field = "DATE(a.create_time) as create_time ,b.house_id,b.house_title,c.user_phone,c.user_name,c.user_id";
$result = $this->payLogModel->getAddPayLogOrderList($field,$params);
break;
case 4:
$field = "DATE(a.create_time) as create_time ,b.house_id,b.house_title,c.user_phone,c.user_name,c.user_id";
$result = $this->bargainModel->getAddBargainOrderList($field,$params);
break;
default:
}
return $result;
}
/**
* @param $params
* @return array
......
......@@ -346,4 +346,27 @@ class OBargainModel extends Model
->where($where_)
->select();
}
public function getAddBargainOrderList($field,$params){
$where_ = [];
if(isset($params["agent_id"])){
$where_["a.agent_id"] = $params["agent_id"];
}
if(isset($params["create_time"])){
$where_["a.create_time"] = $params["create_time"];
}
if(isset($params["house_ids"])){
$where_["b.house_id"] = array("in",$params["house_ids"]);
}
return Db::table($this->table)
->field($field)
->alias("a")
->join("o_order b","a.order_id = b.id","left")
->join("o_report c","b.f_id = c.id","left")
->where($where_)
->select();
}
}
\ No newline at end of file
......@@ -116,4 +116,24 @@ class OMarchInModel extends Model
->select();
}
public function getAddMarchInOrderList($field,$params){
$where_ = [];
if(isset($params["agent_id"])){
$where_["a.reception_id"] = $params["agent_id"];
}
if(isset($params["create_time"])){
$where_["a.create_time"] = $params["create_time"];
}
if(isset($params["house_ids"])){
$where_["b.house_id"] = array("in",$params["house_ids"]);
}
return Db::table($this->table)
->field($field)
->alias("a")
->join("o_order b","a.order_id = b.id","left")
->join("o_report c","b.f_id = c.id","left")
->where($where_)
->select();
}
}
\ No newline at end of file
......@@ -113,4 +113,24 @@ class OPayLogModel extends Model
->where($where_)
->select();
}
public function getAddPayLogOrderList($field,$params){
$where_ = [];
if(isset($params["agent_id"])){
$where_["a.agent_id"] = $params["agent_id"];
}
if(isset($params["create_time"])){
$where_["a.create_time"] = $params["create_time"];
}
if(isset($params["house_ids"])){
$where_["b.house_id"] = array("in",$params["house_ids"]);
}
return Db::table($this->table)
->field($field)
->alias("a")
->join("o_order b","a.order_id = b.id","left")
->join("o_report c","b.f_id = c.id","left")
->where($where_)
->select();
}
}
\ No newline at end of file
......@@ -176,5 +176,24 @@ class OReportModel extends Model
//echo Db::table($this->table)->getLastSql();
return $result;
}
public function getAddReportOrderList($field,$params){
$where_ = [];
if(isset($params["agent_id"])){
$where_["a.report_agent_id"] = $params["agent_id"];
}
if(isset($params["create_time"])){
$where_["a.create_time"] = $params["create_time"];
}
if(isset($params["house_ids"])){
$where_["b.house_id"] = array("in",$params["house_ids"]);
}
$where_["a.status"] = 0;
return Db::table($this->table)
->field($field)
->alias("a")
->join("o_order b","a.id = b.f_id","left")
->where($where_)
->select();
}
}
\ No newline at end of file
......@@ -362,6 +362,7 @@ Route::group('broker', [
'selectPerformanceByTime' => ['api_broker/Performance/selectPerformanceByTime', ['method' => 'get']],
'agentPerformanceBySearch' => ['api_broker/Performance/agentPerformanceBySearch', ['method' => 'get']],
'orderNoList' => ['api_broker/Performance/orderNoList', ['method' => 'get']],
'weekWorkImg' => ['api_broker/Statement/weekWorkImg', ['method' => 'post']], //生成周报和日报图片
'setReportContent' => ['api_broker/Statement/setReportContent', ['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