Commit dae21763 authored by zhuwei's avatar zhuwei

日报或者周报列表

parent 12cbc19e
......@@ -34,40 +34,48 @@ class PerformanceReport extends Basic
{
$params = $this->params;
/*$params = array(
"type" => 0,
);*/
// if (!isset($params["type"])) {
// return $this->response("101", "请求参数错误");
// }
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
$type = !empty($params["type"]) ? $params["type"] : 0;
// 时间筛选
if (!empty($params['start_date']) && !empty($params['end_date'])) {
$where['RAgentReport.create_time'] = ['between', [$params['start_date']. ' 00:00:00', $params['end_date'] . ' 23:59:59']];
}
// 部门筛选
if (!empty($params['district_id'])) {
$where['Agent.district_id'] = $params['district_id'];
}
// 门店筛选
if (!empty($params['store_id'])) {
$where['Agent.store_id'] = $params['store_id'];
}
// 经纪人筛选
if (!empty($params['agent_id'])) {
$where['Agent.id'] = $params['agent_id'];
}
$get_params['RAgentReport.type'] = $type;//类型 0周报 1日报
$get_params['RAgentReport.is_del'] = 0;
$field = 'RAgentReport.id,';
$field .= 'RAgentReport.img_url,';
$field .= 'Agent.name';
$get_params['RAgentReport.type'] = $type;//类型 0周报 1日报
$get_params['RAgentReport.is_del'] = 0;
$order = "RAgentReport.create_time desc";
$res = $this->rAgentReport->getPerformanceReportList($pageNo, $pageSize, $field, $get_params, $order);
// $res_total = $this->aCollectHouse->getCollectListTotal($field,$get_params);
// $look_shop_service = new LookShopService();
// foreach ($res as $key => $val) {
// $isLook = $look_shop_service->isLooked($params["agents_id"], $val["id"]);
// $res[$key]["is_look"] = $isLook;
// $res[$key]["rent_price"] = $val["rent_price"] * 0.01;
// $res[$key]["rent_price"] = $val["rent_price"] * 0.01;
// }
//
return $this->response("200", "成功",$res);
$res_total = $this->rAgentReport->getPerformanceReportListTotal($field,$params,$order);
foreach ($res as $key => $val) {
$url = 'static/week_work_img/' . $val['img_url'];
$res[$key]["img_file_path"] = CURRENT_URL . $url;
}
$data['list'] = $res;
$data['total'] = $res_total;
return $this->response("200", "成功",$data);
}
......
......@@ -31,4 +31,17 @@ class RAgentReport extends BaseModel
//dump($this->getLastSql());
return $result;
}
public function getPerformanceReportListTotal($field,$params,$order)
{
$result = $this
->field($field)
->alias('RAgentReport')
->join('a_agents Agent','RAgentReport.agent_id=Agent.id','left')
->where($params)
->order($order)
->count();
//dump($this->getLastSql());
return $result;
}
}
\ No newline at end of file
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