Commit e6f722df authored by clone's avatar clone

修改

parent 17074204
...@@ -358,12 +358,12 @@ class OrderLog extends Basic ...@@ -358,12 +358,12 @@ class OrderLog extends Basic
public function searchAgents() public function searchAgents()
{ {
$params = $this->params; $params = $this->params;
/* $params = array( $params = array(
"submit_agent_id" => 1, "submit_agent_id" => 1,
"keyword" => "138", "keyword" => "157",
"page_no" => 1, "page_no" => 1,
"page_size" => 15 "page_size" => 15
);*/ );
if (!isset($params["submit_agent_id"]) || !isset($params["keyword"])) { if (!isset($params["submit_agent_id"]) || !isset($params["keyword"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
......
...@@ -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\PerformanceService; use app\api_broker\service\PerformanceService;
use Think\Exception;
use think\Request; use think\Request;
/** /**
...@@ -26,7 +27,7 @@ class Performance extends Basic ...@@ -26,7 +27,7 @@ class Performance extends Basic
} }
/** /**
* 业绩列表 * 业绩汇总,
* @return \think\Response * @return \think\Response
* @throws \think\db\exception\DataNotFoundException * @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException * @throws \think\db\exception\ModelNotFoundException
...@@ -38,19 +39,22 @@ class Performance extends Basic ...@@ -38,19 +39,22 @@ class Performance extends Basic
/* $params = array( /* $params = array(
"agent_id" => 1, "agent_id" => 1,
"type" => 1, //1表示个人业绩排行 2门店 3区域 "type" => 1, //1表示个人业绩排行 2门店 3区域
"end_day" => "",
"start_day" =>""
);*/ );*/
if (!isset($params["agent_id"]) || !isset($params["type"])) { if (!isset($params["agent_id"]) || !isset($params["type"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
$yesterday = date("Y-m-d", strtotime("-1 day")); //默认排序一周
$end_day = date("Y-m-d", strtotime("-7 day")); $end_day = isset($params["end_day"]) ? $params["end_day"] : date("Y-m-d", strtotime("-1 day"));
$start_day = isset($params["start_day"]) ? $params["start_day"] : date("Y-m-d", strtotime("-7 day"));
$list = $this->service_->totalAgent($params["agent_id"], $params["type"], $yesterday, $end_day); $list = $this->service_->totalAgent($params["agent_id"], $params["type"], $end_day, $start_day);
//dump($list); //dump($list);
if (count($list) > 0) { if (count($list) > 0) {
$result["list"] = $list; $result["list"] = $list;
$result["start_time"] = $yesterday; $result["start_time"] = $start_day;
$result["end_time"] = $end_day; $result["end_time"] = $end_day;
return $this->response("200", "request success", $result); return $this->response("200", "request success", $result);
} }
...@@ -64,13 +68,13 @@ class Performance extends Basic ...@@ -64,13 +68,13 @@ class Performance extends Basic
public function agentPerformanceBySearch() public function agentPerformanceBySearch()
{ {
$params = $this->params; $params = $this->params;
/* $params = array( /* $params = array(
"agent_id" => 1, "agent_id" => 1,
"start_time" => "2018-03-23", "start_time" => "2018-03-23",
"end_time" => "2018-03-23", "end_time" => "2018-03-23",
"is_case" => 2,//1经纪人 2案场 "is_case" => 2,//1经纪人 2案场
"house_id" => 0 "house_id" => 0
);*/ );*/
if (!isset($params["agent_id"]) || !isset($params["start_time"]) || !isset($params["end_time"])) { if (!isset($params["agent_id"]) || !isset($params["start_time"]) || !isset($params["end_time"])) {
return $this->response("101", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
...@@ -78,23 +82,44 @@ class Performance extends Basic ...@@ -78,23 +82,44 @@ class Performance extends Basic
if (isset($params["house_id"])) { if (isset($params["house_id"])) {
$house_id = $params["house_id"]; $house_id = $params["house_id"];
} }
$result = $this->service_->personagePerformance($params["agent_id"], $params["start_time"], $params["end_time"], try {
$params["is_case"], $house_id); $result = $this->service_->personagePerformance($params["agent_id"], $params["start_time"], $params["end_time"],
$params["is_case"], $house_id);
return $this->response("200", "request success", $result);
} catch (Exception $exception) {
return $this->response("101", "request error,msg:" . $exception);
}
return $this->response("200", "request success", $result);
} }
public function orderNoList(){
public function storePerformanceBySearch()
{
$params = $this->params; $params = $this->params;
$params = array( $params = array(
"agent_id" => 1, "agent_id" => 1,
"start_time" => "2018-03-23", "start_time" => "2018-03-23",
"end_time" => "2018-03-23", "end_time" => "2018-03-23",
"is_case" => 2,//1经纪人 2案场 );
"house_id" => 0,
"type" => 2 // 1带看 2进场 3收款 4成交报告 }
);
if (!isset($params["agent_id"]) || !isset($params["start_time"]) || !isset($params["end_time"]) || !isset($params["type"]) ) { /**
* 各个状态的订单列表暂不分页,
* @return \think\Response
*/
public function orderNoList()
{
$params = $this->params;
$params = array(
"agent_id" => 1,
"start_time" => "2018-03-23",
"end_time" => "2018-03-23",
"is_case" => 2,//1经纪人 2案场
"house_id" => 0,
"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", "请求参数错误"); return $this->response("101", "请求参数错误");
} }
...@@ -102,9 +127,14 @@ class Performance extends Basic ...@@ -102,9 +127,14 @@ class Performance extends Basic
if (isset($params["house_id"])) { if (isset($params["house_id"])) {
$house_id = $params["house_id"]; $house_id = $params["house_id"];
} }
$result = $this->service_->orderList($params["agent_id"], $params["start_time"], $params["end_time"], try {
$params["is_case"], $house_id , $params["type"]); $result = $this->service_->orderList($params["agent_id"], $params["start_time"], $params["end_time"],
$params["is_case"], $house_id, $params["type"]);
return $this->response("200", "request success", $result);
return $this->response("200", "request success", $result); } catch (Exception $exception) {
return $this->response("101", "request error,msg:" . $exception);
}
} }
} }
...@@ -249,20 +249,20 @@ class PerformanceService ...@@ -249,20 +249,20 @@ class PerformanceService
//1带看 2进场 3收款 4成交报告 //1带看 2进场 3收款 4成交报告
switch ($type) { switch ($type) {
case 1: 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"; $field = "DATE(a.create_time) as create_time,a.user_phone,a.user_name,a.user_id,b.house_id,d.internal_title,d.internal_address";
$result = $this->reportModel->getAddReportOrderList($field, $params); $result = $this->reportModel->getAddReportOrderList($field, $params);
break; break;
case 2: 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"; $field = "DATE(a.create_time) as create_time ,b.house_id,b.house_title,c.user_phone,c.user_name,c.user_id,d.internal_title,d.internal_address";
$result = $this->marchInModel->getAddMarchInOrderList($field,$params); $result = $this->marchInModel->getAddMarchInOrderList($field,$params);
break; break;
case 3: 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"; $field = "DATE(a.create_time) as create_time ,b.house_id,b.house_title,c.user_phone,c.user_name,c.user_id,d.internal_title,d.internal_address";
$result = $this->payLogModel->getAddPayLogOrderList($field,$params); $result = $this->payLogModel->getAddPayLogOrderList($field,$params);
break; break;
case 4: 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"; $field = "DATE(a.create_time) as create_time ,b.house_id,b.house_title,c.user_phone,c.user_name,c.user_id,d.internal_title,d.internal_address";
$result = $this->bargainModel->getAddBargainOrderList($field,$params); $result = $this->bargainModel->getAddBargainOrderList($field,$params);
break; break;
default: default:
......
...@@ -366,6 +366,7 @@ class OBargainModel extends Model ...@@ -366,6 +366,7 @@ class OBargainModel extends Model
->alias("a") ->alias("a")
->join("o_order b","a.order_id = b.id","left") ->join("o_order b","a.order_id = b.id","left")
->join("o_report c","b.f_id = c.id","left") ->join("o_report c","b.f_id = c.id","left")
->join('g_houses d','b.house_id = d.id','left')
->where($where_) ->where($where_)
->select(); ->select();
} }
......
...@@ -132,6 +132,7 @@ class OMarchInModel extends Model ...@@ -132,6 +132,7 @@ class OMarchInModel extends Model
->alias("a") ->alias("a")
->join("o_order b","a.order_id = b.id","left") ->join("o_order b","a.order_id = b.id","left")
->join("o_report c","b.f_id = c.id","left") ->join("o_report c","b.f_id = c.id","left")
->join('g_houses d','b.house_id = d.id','left')
->where($where_) ->where($where_)
->select(); ->select();
} }
......
...@@ -130,6 +130,7 @@ class OPayLogModel extends Model ...@@ -130,6 +130,7 @@ class OPayLogModel extends Model
->alias("a") ->alias("a")
->join("o_order b","a.order_id = b.id","left") ->join("o_order b","a.order_id = b.id","left")
->join("o_report c","b.f_id = c.id","left") ->join("o_report c","b.f_id = c.id","left")
->join('g_houses d','b.house_id = d.id','left')
->where($where_) ->where($where_)
->select(); ->select();
} }
......
...@@ -192,6 +192,7 @@ class OReportModel extends Model ...@@ -192,6 +192,7 @@ class OReportModel extends Model
->field($field) ->field($field)
->alias("a") ->alias("a")
->join("o_order b","a.id = b.f_id","left") ->join("o_order b","a.id = b.f_id","left")
->join('g_houses d','b.house_id = d.id','left')
->where($where_) ->where($where_)
->select(); ->select();
} }
......
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