Commit e815cbb7 authored by clone's avatar clone

实收记录

parent a3f95ac6
......@@ -423,4 +423,40 @@ class Performance extends Basic
return $this->response("200", "success", $result["date"]);
}
}
/**
* 获取时间段实收数据
* @return \think\Response
*/
public function officialReceiptsList()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/* $params = array(
"type" => 1, //1个人,2经纪人
"agent_id" => 80,
"start_time" => "2018-06-12",
"end_time" => "2018-06-19",
"page_no" => 1,
"page_size" => 15
);*/
$checkResult = $this->validate($params, "PerformanceValidate.verify");
if (true !== $checkResult) {
return $this->response("101", $checkResult);
}
//默认排序一周
$end_day = !empty($params["end_time"]) ? $params["end_time"] : date("Y-m-d", strtotime("-1 day"));
$start_day = !empty($params["start_time"]) ? $params["start_time"] : date("Y-m-d", strtotime("-7 day"));
$page_no = empty($params['page_no']) ? 1 : $params['page_no'];
$page_size = empty($params['page_size']) ? 15 : $params['page_size'];
$result = $this->service_->officialReceipts($params["type"],$params["agent_id"], $start_day, $end_day, $page_no, $page_size);
if ($result["code"] == 101) {
return $this->response("101", $result["date"]);
} else {
return $this->response("200", "success", $result["date"]);
}
}
}
......@@ -725,4 +725,28 @@ class PerformanceService
}
return [ "code" => 200, "date" => $superviseList ];
}
/**
* 获取实收记录
* @param $type
* @param $agent_id
* @param $start_time
* @param $end_time
* @param $page_no
* @param $page_size
* @return array
*/
public function officialReceipts($type, $agent_id, $start_time, $end_time, $page_no, $page_size)
{
$params = $this->getAgentId($agent_id, $type, $start_time, $end_time);
if (!$params)
return [ "code" => 101, "date" => "传入的参数错误" ];
$field = "a.id,c.name,d.store_name,e.district_name,a.practical_fee,a.create_time";
$where_["a.agent_id"] = $params["agent_id"];
$where_["a.create_time"] = $params["create_time"];
$receivedList = $this->bargainModel->getReceivedList($page_no, $page_size, $field, $where_);
return [ "code" => 200, "date" => $receivedList ];
}
}
\ No newline at end of file
......@@ -569,7 +569,7 @@ class OBargainModel extends Model
return Db::table($this->table)
->field($field)
->alias("a")
->join("o_partial_commission b","a.id=b.bargain_id","right")
->join("o_partial_commission b", "a.id=b.bargain_id", "right")
->where($where_)
->group("day")
->select();
......@@ -659,7 +659,7 @@ class OBargainModel extends Model
$date = Db::table($this->table)
->field($field)
->alias("a")
->join("o_partial_commission b","a.id=b.bargain_id","right")
->join("o_partial_commission b", "a.id=b.bargain_id", "right")
->where($where_)
->select();
//echo $this->getLastSql();
......@@ -667,6 +667,31 @@ class OBargainModel extends Model
}
public function getReceivedList($page_no, $page_size, $field, $params)
{
$where_ = [];
if (isset($params["agent_id"])) {
$where_["a.agent_id"] = $params["agent_id"];
}
if (isset($params["create_time"])) {
$where_["b.create_time"] = $params["create_time"];
}
$date = Db::table($this->table)
->field($field)
->alias("a")
->join("o_partial_commission b", "a.id=b.bargain_id", "right")
->join("a_agents c", "a.agent_id=c.id", "left")
->join("a_store d", "c.store_id=d.id", "left")
->join("a_district e", "c.district_id=c.id", "left")
->where($where_)
->page($page_no)
->limit($page_size)
->select();
return $date;
}
public function getAddBargainList($params, $field, $page_no, $page_size)
{
$where_ = [];
......
......@@ -469,6 +469,7 @@ Route::group('broker', [
'paylogList' => [ 'api_broker/Performance/paylogList', [ 'method' => 'POST|GET' ] ], //收款list
'performanceList' => [ 'api_broker/Performance/performanceList', [ 'method' => 'POST|GET' ] ], //业绩list
'superviseList' => [ 'api_broker/Performance/superviseList', [ 'method' => 'POST|GET' ] ], //监督执行list
'officialReceiptsList' => [ 'api_broker/Performance/officialReceiptsList', [ 'method' => 'POST|GET' ] ], //实收list
//user
'returnSearchCondition' => [ 'api_broker/User/returnSearchCondition', [ '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