Commit 7e7680a0 authored by zhuwei's avatar zhuwei

日报带看数修改-改进场数

parent 6eb797fe
......@@ -36,7 +36,7 @@ class Statement extends Basic
header('Access-Control-Allow-Origin:*');
$params = $this->params;
/*$params = array(
"agent_id" => 5739,//5739 总监 5740店长
"agent_id" => 3742,//5739 总监 5740店长
"time_start" => date("Y-m-d", time()),
"time_end" => date("Y-m-d", time()),
);*/
......
......@@ -6,6 +6,7 @@ use app\model\AAgents;
use app\model\FollowUpLogModel;
use app\model\GHouses;
use app\model\OBargainModel;
use app\model\OMarchInModel;
use app\model\OReportModel;
use app\model\Users;
......@@ -24,6 +25,7 @@ class StatementService
private $userModel;
private $followUpModel;
private $reportModel;
private $marchInModel;
const USER_LEVEL_FIST = 0; //经纪人
const USER_LEVEL_SECOND = 1; //店长
......@@ -36,6 +38,7 @@ class StatementService
$this->userModel = new Users();
$this->followUpModel = new FollowUpLogModel();
$this->reportModel = new OReportModel();
$this->marchInModel = new OMarchInModel();
}
/**
......@@ -224,9 +227,12 @@ class StatementService
$where_["agent_id"] = $agent_id;
$where_['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
//dump($where_);
$reportNum = $this->reportModel->getAddReportNum($where_);
$result["look_at_num_day_store"] = isset($reportNum[0]["num"]) ? $reportNum[0]["num"] : 0;
// $reportNum = $this->reportModel->getAddReportNum($where_);
// $result["look_at_num_day_store"] = isset($reportNum[0]["num"]) ? $reportNum[0]["num"] : 0;
$addMarchInNum = $this->marchInModel->getAddMarchInNum($where_);
$result["look_at_num_day_store"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
//dump($addMarchInNum);
//todo
$result["store_list"] = $store_list;
$result["district_list"] = $district_list;
......
<?php
namespace app\index\controller;
/**
* Created by PhpStorm.
* User: zhuwei
* Date: 2018/7/31
* Time: 上午10:18
*/
use app\index\extend\Basic;
use app\index\service\PerformanceService;
use think\Request;
class Performance extends Basic
{
private $service_;
function __construct(Request $request = null)
{
parent::__construct($request);
$this->service_ = new PerformanceService();
}
//TODO 区域业绩排行 District
/**
* 区域业绩排行
*/
public function selectDistrictPerformance()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
// $params = array(
// "type" => 3, //1表示个人业绩排行 2门店 3区域
//// "end_day" => "",
//// "start_day" =>"",
// );
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
//默认排序一周 2018-07-18改为本月
$end_day = !empty($params["end_day"]) ? $params["end_day"] : date("Y-m-d", strtotime("-1 day"));
$start_day = !empty($params["start_day"]) ? $params["start_day"] : date("Y-m-01", time());
$list = $this->service_->totalAgent($params["type"], $end_day, $start_day,$pageNo,$pageSize);
//dump($list);
if (count($list) > 0) {
$result["list"] = $list['list'];
$result["total"] = $list['total'];
$result["start_time"] = $start_day;
$result["end_time"] = $end_day;
return $this->response("200", "request success", $result);
}
return $this->response("200", "request null");
}
//TODO 门店排行 Store
/**
* 门店排行
*/
public function selectStorePerformance()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
// $params = array(
// "type" => 2, //1表示个人业绩排行 2门店 3区域
// "father_id" => 4,
// // "start_day" =>"",
// );
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
//默认排序一周 2018-07-18改为本月
$end_day = !empty($params["end_day"]) ? $params["end_day"] : date("Y-m-d", strtotime("-1 day"));
$start_day = !empty($params["start_day"]) ? $params["start_day"] : date("Y-m-01", time());
$father_id = !empty($params["father_id"]) ? $params["father_id"] : '' ;
$list = $this->service_->totalAgent($params["type"], $end_day, $start_day,$pageNo,$pageSize,$father_id);
//dump($list);
if (count($list) > 0) {
$result["list"] = $list['list'];
$result["total"] = $list['total'];
$result["start_time"] = $start_day;
$result["end_time"] = $end_day;
return $this->response("200", "request success", $result);
}
return $this->response("200", "request null");
}
//TODO 个人业绩排行 Individual
/**
* 个人业绩排行
*/
public function selectIndividualPerformance()
{
header('Access-Control-Allow-Origin:*');
$params = $this->params;
// $params = array(
// "type" => 1, //1表示个人业绩排行 2门店 3区域
// // "end_day" => "",
// // "start_day" =>"",
// );
$pageNo = empty($this->params['pageNo']) ? 1 : $this->params['pageNo'];
$pageSize = empty($this->params['pageSize']) ? 15 : $this->params['pageSize'];
//默认排序一周 2018-07-18改为本月
$end_day = !empty($params["end_day"]) ? $params["end_day"] : date("Y-m-d", strtotime("-1 day"));
$start_day = !empty($params["start_day"]) ? $params["start_day"] : date("Y-m-01", time());
$father_id = !empty($params["father_id"]) ? $params["father_id"] : '' ;
$list = $this->service_->totalAgent($params["type"], $end_day, $start_day,$pageNo,$pageSize,$father_id);
//dump($list);
if (count($list) > 0) {
$result["list"] = $list['list'];
$result["total"] = $list['total'];
$result["start_time"] = $start_day;
$result["end_time"] = $end_day;
return $this->response("200", "request success", $result);
}
return $this->response("200", "request null");
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -133,12 +133,14 @@ class OMarchInModel extends Model
if (isset($params["house_ids"])) {
$where_["b.house_id"] = array( "in", $params["house_ids"] );
}
return Db::table($this->table)
$return = Db::table($this->table)
->field($field)
->alias("a")
->join("o_order b", "a.order_id = b.id", "left")
->where($where_)
->select();
dump($this->getLastSql($return));
return $return;
}
/**
......
......@@ -93,7 +93,7 @@ class TAgentTotalModel extends Model
}
public function getTotalByAgentIdPage($pageNo,$pageSize,$field ,$params, $type ,$order = "",$having)
public function getTotalByAgentIdPage($pageNo,$pageSize,$field ,$params, $type ,$order = "")
{
$group_ = "";
switch ($type) {
......@@ -113,14 +113,13 @@ class TAgentTotalModel extends Model
->where($params)
->group($group_)
->order($order)
->having($having)
->select();
// echo $this->db_->getLastSql();
return $result;
}
public function getTotalByAgentIdCount($field ,$params, $type ,$order = "",$having)
public function getTotalByAgentIdCount($field ,$params, $type ,$order = "")
{
$group_ = "";
switch ($type) {
......@@ -140,7 +139,6 @@ class TAgentTotalModel extends Model
->where($params)
->group($group_)
->order($order)
->having($having)
->count();
// echo $this->db_->getLastSql();
return $result;
......
......@@ -264,10 +264,16 @@ Route::group('index', [
'followUpList' => [ 'index/HouseFollowUp/followUpList', [ 'method' => 'GET' ] ],//商铺跟进liu
'inspectionRecordList' => [ 'index/InspectionRecord/inspectionRecordList', [ 'method' => 'GET' ] ],//约带看记录liu
'realtimePerformance' => [ 'index/RealTimePerformance/realtimePerformanceList', [ 'method' => 'GET' ] ],//实时业绩liu
'shopinspectionLog' => [ 'index/ShopInspectionLog/shopinspectionLogList', [ 'method' => 'GET' ] ],//商铺查看日志liu
'shopinspectionLog' => [ 'index/ShopInspectionLog/shopinspectionLogList', [ 'method' => 'POST|GET' ] ],//商铺查看日志liu
'lookShopIndex' => [ 'index/LookShop/lookShopIndex', [ 'method' => 'GET' ] ],//商铺查看日志
'lookShopIndex' => [ 'index/LookShop/lookShopIndex', [ 'method' => 'GET' ] ],//商铺查看日志
'selectDistrictPerformance' => [ 'index/Performance/selectDistrictPerformance', [ 'method' => 'POST|GET' ] ], //区域业绩排行 朱伟 2018-07-31
'selectStorePerformance' => [ 'index/Performance/selectStorePerformance', [ 'method' => 'POST|GET' ] ], //门店业绩排行 朱伟 2018-07-31
'selectIndividualPerformance' => [ 'index/Performance/selectIndividualPerformance', [ 'method' => 'POST|GET' ] ], //个人业绩排行 朱伟 2018-07-31
]);
......
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