Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hujun
tl_estate
Commits
7e7680a0
Commit
7e7680a0
authored
Jul 31, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日报带看数修改-改进场数
parent
6eb797fe
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
956 additions
and
9 deletions
+956
-9
Statement.php
application/api_broker/controller/Statement.php
+1
-1
StatementService.php
application/api_broker/service/StatementService.php
+8
-2
Performance.php
application/index/controller/Performance.php
+150
-0
PerformanceService.php
application/index/service/PerformanceService.php
+785
-0
OMarchInModel.php
application/model/OMarchInModel.php
+3
-1
TAgentTotalModel.php
application/model/TAgentTotalModel.php
+2
-4
route.php
application/route.php
+7
-1
No files found.
application/api_broker/controller/Statement.php
View file @
7e7680a0
...
...
@@ -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()),
);*/
...
...
application/api_broker/service/StatementService.php
View file @
7e7680a0
...
...
@@ -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
;
...
...
application/index/controller/Performance.php
0 → 100644
View file @
7e7680a0
<?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
application/index/service/PerformanceService.php
0 → 100644
View file @
7e7680a0
<?php
namespace
app\index\service
;
use
app\model\AAgents
;
use
app\model\ASuperviseModel
;
use
app\model\GHouses
;
use
app\model\GHousesImgs
;
use
app\model\OBargainModel
;
use
app\model\OMarchInModel
;
use
app\model\OPayLogModel
;
use
app\model\OReportModel
;
use
app\model\TAgentTotalModel
;
use
app\model\Users
;
/**
* Created by PhpStorm.
* User: zhuwei
* Date: 2018/7/31
* Time: 上午11:03
*/
class
PerformanceService
{
private
$totalModel
;
private
$agentModel
;
private
$agentsModel
;
private
$tAgentTotalModel
;
private
$houseModel
;
private
$userModel
;
private
$bargainModel
;
private
$reportModel
;
private
$marchInModel
;
private
$payLogModel
;
private
$gHousesImgModel
;
private
$superviseModel
;
public
function
__construct
()
{
$this
->
totalModel
=
new
TAgentTotalModel
();
$this
->
agentModel
=
new
AAgents
();
// $this->agentsModel = new AAgents();
// $this->tAgentTotalModel = new TAgentTotalModel();
// $this->houseModel = new GHouses();
// $this->userModel = new Users();
// $this->bargainModel = new OBargainModel();
// $this->reportModel = new OReportModel();
// $this->marchInModel = new OMarchInModel();
// $this->payLogModel = new OPayLogModel();
// $this->gHousesImgModel = new GHousesImgs();
// $this->superviseModel = new ASuperviseModel();
}
/**
* @param $agent_id
* @param $type
* @param $yesterday
* @param $end_day
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
totalAgent
(
$type
,
$yesterday
,
$end_day
,
$pageNo
,
$pageSize
,
$father_id
)
{
$where_
=
[];
$where_
[
'total_time'
]
=
array
(
'between'
,
array
(
$end_day
,
$yesterday
)
);
if
(
$father_id
){
if
(
$type
==
1
){
$where_
[
'store_id'
]
=
$father_id
;
}
elseif
(
$type
==
2
){
$where_
[
'district_id'
]
=
$father_id
;
}
}
//todo 成交报告数 bargain_sum
//todo 成交报告数其他 bargain_sum
//todo 收款数 paylog
//todo 进场数 march_in_num
//todo 报备数 look_at_num
//todo 新增商铺数 add_house_num
//todo 新增客户数 add_user_num
//todo 团队人数 team_num
$field
=
"agent_id,store_id,district_id,sum(performance) as performance_total,bargain_sum,bargain_sum,paylog,march_in_num,look_at_num,add_house_num,add_user_num"
;
$order
=
"performance_total desc"
;
//dump($where_);
$result
=
$this
->
totalModel
->
getTotalByAgentIdPage
(
$pageNo
,
$pageSize
,
$field
,
$where_
,
$type
,
$order
);
$arr
=
[];
$total
=
$this
->
totalModel
->
getTotalByAgentIdCount
(
$field
,
$where_
,
$type
,
$order
);
$field
=
"a.name,a.img,b.store_name,c.district_name"
;
//dump($result);
foreach
(
$result
as
$key
=>
$value
)
{
switch
(
$type
)
{
case
1
:
$value
[
"index_"
]
=
$key
+
1
;
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
]
]);
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
$info
[
0
][
"name"
];
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$info
[
0
][
"img"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
array_push
(
$arr
,
$value
);
}
break
;
case
2
:
$value
[
"index_"
]
=
$key
+
1
;
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
],
""
]);
$store_name
=
$this
->
agentModel
->
getStoreOrDistrict
([
"store_id"
=>
$value
[
"store_id"
],
"level"
=>
20
]);
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
count
(
$store_name
)
>
0
?
$store_name
[
0
][
"name"
]
:
"---"
;
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$store_name
[
0
][
"img"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
}
//计算门店人数
$params
=
[];
$params
[
'store_id'
]
=
$value
[
"store_id"
];
$value
[
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
array_push
(
$arr
,
$value
);
break
;
case
3
:
$value
[
"index_"
]
=
$key
+
1
;
$info
=
$this
->
agentModel
->
getAgentsInfoByAgentId
(
$field
,
[
"agent_id"
=>
$value
[
"agent_id"
]
]);
$district_name
=
$this
->
agentModel
->
getStoreOrDistrict
([
"district_id"
=>
$value
[
"district_id"
],
"level"
=>
[
"in"
,
"30,40"
]
]);
if
(
count
(
$info
)
>
0
)
{
$value
[
"name"
]
=
count
(
$district_name
)
>
0
?
$district_name
[
0
][
"name"
]
:
"---"
;
$value
[
"img"
]
=
AGENTHEADERIMGURL
.
$district_name
[
0
][
"img"
];
$value
[
"store_name"
]
=
$info
[
0
][
"store_name"
];
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
}
//计算区域人数
$params
=
[];
$params
[
'district_id'
]
=
$value
[
"district_id"
];
$value
[
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
array_push
(
$arr
,
$value
);
break
;
}
}
return
[
'list'
=>
$arr
,
'total'
=>
$total
];
}
// /**
// * @param $agent_id
// * @return mixed|null
// * @throws \think\db\exception\DataNotFoundException
// * @throws \think\db\exception\ModelNotFoundException
// * @throws \think\exception\DbException
// */
// public function getStoreAndDistrict($agent_id)
// {
// $params["agent_id"] = $agent_id;
// $agent_info = $this->agentModel->getAgentById("id,store_id,district_id,level", $params);
// if (count($agent_info) > 0) {
// return $agent_info[0];
// }
// return null;
//
// }
//
// /**
// * 个人业绩
// * @param $agent_id
// * @param $start_time
// * @param $end_time
// * @param $is_case
// * @param $house_id
// * @return array|mixed|null
// */
// public function personagePerformance($agent_id, $start_time, $end_time, $is_case, $house_id)
// {
// $result = [];
// switch ($is_case) {
// case 1:
// $now_date = date("Y-m-d", time());
// if ($start_time == $now_date && $end_time == $now_date) {
// $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, 1);
// } else {
// $field = "agent_id,sum(add_house_num) as add_house_num,sum(add_user_num) as add_user_num,
// sum(performance) as performance,sum(official_receipts) as official_receipts,sum(look_at_num) as look_at_num,
// sum(march_in_num) as march_in_num , sum(paylog) as paylog , sum(bargain_sum) as bargain_sum";
//
// $where_["agent_id"] = $agent_id;
// $where_['total_time'] = array( 'between', array( $start_time, $end_time ) );
//
// $list = $this->totalModel->personagePerformance($field, $where_);
// if (count($list) > 0) {
// $result = $list[0];
// }
// }
// break;
// case 2: //案场
// $house_id_arr = [];
//
// if ($house_id > 0) { // 如果有传楼盘id证明是筛选
// $condition["house_ids"] = $house_id;
// } else {
// $vService = new VerifyService();
// $house_id_arr = $vService->getCaseHouseIdByAgentId($agent_id);
// $ids = "";
// foreach ($house_id_arr as $item) {
// $ids .= $item["houses_id"] . ",";
// }
// $ids = rtrim($ids, ",");
// if (!$ids) { //代表没有案场
// return null;
// }
// $condition["house_ids"] = $ids;
// }
//
// $condition['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
// $result = $this->nowTimeSum($condition, 2);
// if (count($result) > 0 && $house_id == 0) {
// $result["house_arr"] = $house_id_arr;
// }
// break;
// }
//
// if (count($result) > 0) {
// return $result;
// } else {
// return null;
// }
//
// }
//
// /**
// * @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)
// {
// $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" ) );
// break;
// case 2: //案场
// if ($house_id > 0) { // 如果有传楼盘id证明是筛选
// $params["house_ids"] = $house_id;
// } else {
// $vService = new VerifyService();
// $house_id_arr = $vService->getCaseHouseIdByAgentId($agent_id);
// $ids = "";
// foreach ($house_id_arr as $item) {
// $ids .= $item["houses_id"] . ",";
// }
// $ids = rtrim($ids, ",");
// if (!$ids) { //代表没有案场
// return null;
// }
// $params["house_ids"] = $ids;
// }
// $params['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
// break;
// }
//
// $result = $this->getOrderList($params, $type);
// if (count($result) > 0) {
// return $result;
// } else {
// return null;
// }
//
// }
//
// public 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,d.internal_title,d.internal_address";
// $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,d.internal_title,d.internal_address";
// $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,d.internal_title,d.internal_address";
// $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,d.internal_title,d.internal_address";
// $result = $this->bargainModel->getAddBargainOrderList($field, $params);
// break;
// default:
//
// }
// return $result;
//
// }
//
// /**
// * 个人业绩当天业绩统计
// * @param $params
// * @return array
// */
// private function nowTimeSum($params, $type)
// {
// $result = [];
// if ($type == 1) {
// //房源
// $addHouseNum = $this->houseModel->getAddHouseNum($params);
// $result["add_house_num"] = !empty($addHouseNum[0]["num"]) ? $addHouseNum[0]["num"] : 0;
// //客源
// $addUserNum = $this->userModel->getAddUserNum($params);
// $result["add_user_num"] = !empty($addUserNum[0]["num"]) ? $addUserNum[0]["num"] : 0;
// //业绩
// $performanceSum = $this->bargainModel->getAddBargainNum($params, 1);//1表示业绩 2表示实收
// $result["performance"] = !empty($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
// //实收
// $receivedSum = $this->bargainModel->getReceived($params);
// $result["official_receipts"] = !empty($receivedSum[0]["num"]) ? $receivedSum[0]["num"] : 0;
//
// }
//
//
// $reportNum = $this->reportModel->getAddReportNum($params);
// $result["look_at_num"] = !empty($reportNum[0]["num"]) ? $reportNum[0]["num"] : 0;
//
// $addMarchInNum = $this->marchInModel->getAddMarchInNum($params);
// $result["march_in_num"] = !empty($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
//
// $payLogNum = $this->payLogModel->getAddPayLogNum($params);
// $result["paylog"] = !empty($payLogNum[0]["num"]) ? $payLogNum[0]["num"] : 0;
//
// $bargainSum = $this->bargainModel->getAddBargainNum($params, 3);//表示统计
// $result["bargain_sum"] = !empty($bargainSum[0]["num"]) ? $bargainSum[0]["num"] : 0;
// return $result;
// }
//
//
// /**
// * 门店业绩
// * @param $agent_id
// * @param $start_time
// * @param $end_time
// * @return array|false|mixed|null|\PDOStatement|string|\think\Collection
// */
// public function storePerformance($agent_id, $start_time, $end_time)
// {
// //获取经纪人信息
// $result = $this->agentModel->searchAgentsByKeyword("id,store_id,district_id,level", [ "id" => $agent_id ]);
//
// if (count($result) <= 0) {
// return null;
// }
// $type = 0;
//
// if ($result[0]["level"] == 20) {
// $type = 2;
// $params["store_id"] = $result[0]["store_id"];
// } elseif ($result[0]["level"] == 30 || $result[0]["level"] == 40) {
// $type = 3;
// $params["district_id"] = $result[0]["district_id"];
// }
//
// $list = [];
//
// $now_date = date("Y-m-d", time());
//
// if ($start_time == $now_date && $end_time == $now_date) {
//
// $verify = new VerifyService();
// $agent_ids = $verify->getAgentsByAgentId($agent_id);
// $where_["agent_id"] = array( "in", $agent_ids );
// $where_['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
//
// $list = $this->sumDistrictPerformance($where_);
//
// // dump($list);exit;
// } else {
// $field = "sum(add_house_num) as add_house_num,sum(add_user_num) as add_user_num,
// sum(performance) as performance,sum(official_receipts) as official_receipts,sum(look_at_num) as look_at_num,
// sum(march_in_num) as march_in_num,sum(paylog) as paylog,sum(supervision_num) as supervision_num";
//
// $params['total_time'] = array( 'between', array( $start_time, $end_time ) );
//
// $list = $this->totalModel->getTotalByAgentId($field, $params, $type, "");
// // dump($list);
// if (count($list) > 0) {
// $list = $list[0];
// }
// }
//
// if (count($list) > 0) {
// return $list;
// } else {
// return null;
// }
//
// }
//
// /**
// * @param $agent_id
// * @param $is_store
// * @param $start_time
// * @param $end_time
// * @return array|false|null|\PDOStatement|string|\think\Collection
// */
// public function storeSortByDistrictId($agent_id, $is_store, $start_time, $end_time)
// {
//
// $result = $this->agentModel->searchAgentsByKeyword("id,store_id,district_id,level", [ "id" => $agent_id ]);
// //dump($result);
// if (count($result) <= 0) {
// return null;
// }
//
// $verify = new VerifyService();
// $agent_ids = $verify->getAgentsByAgentId($agent_id);
// $params["agent_id"] = array( "in", $agent_ids );
// $list = [];
//
// $now_date = date("Y-m-d", time());
// if ($start_time == $now_date && $end_time == $now_date) {
// $param["id"] = array( "in", $agent_ids );
//
// // 1.获取所有经纪人
// $field = "id as agent_id,store_id";
// $group = "";
// if ($is_store == 2) {
// $group = "store_id";
// }
// $list = $this->agentModel->getAgentsList($field, $param, $group);
// //dump($list);
// foreach ($list as $key => $item) {
// $totalParams['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
// $totalParams['agent_id'] = $item["agent_id"];
// if ($is_store == 2) {
// $agent_ids = $verify->getAgentsByAgentId($item["agent_id"]);
// $totalParams['agent_id'] = array( "in", $agent_ids );
// }
// //房源
// $addHouseNum = $this->houseModel->getAddHouseNum($totalParams);
// $list[$key]["add_house_num"] = isset($addHouseNum[0]["num"]) ? $addHouseNum[0]["num"] : 0;
// //客源
// $addUserNum = $this->userModel->getAddUserNum($totalParams);
// $list[$key]["add_user_num"] = isset($addUserNum[0]["num"]) ? $addUserNum[0]["num"] : 0;
// //进场
//
// $addMarchInNum = $this->marchInModel->getAddMarchInNum($totalParams);
// $list[$key]["march_in_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
// //业绩
// $performanceSum = $this->bargainModel->getAddBargainNum($totalParams, 1);//1表示业绩 2表示实收
// $list[$key]["performance"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
// //实收
// $receivedSum = $this->bargainModel->getAddBargainNum($totalParams, 2);//1表示业绩 2表示实收
// $list[$key]["official_receipts"] = isset($receivedSum[0]["num"]) ? $receivedSum[0]["num"] : 0;
//
// $sum = $list[$key]["add_house_num"] + $list[$key]["add_user_num"] + $list[$key]["march_in_num"] +
// $list[$key]["performance"]
// + $list[$key]["official_receipts"];
// if ($sum <= 0) {
// unset($list[$key]);
// }
// }
//
//
// } else {
//
// $field = "store_id,agent_id,sum(add_house_num) as add_house_num,sum(add_user_num) as add_user_num,sum(march_in_num) as march_in_num,
// sum(performance) as performance,sum(official_receipts) as official_receipts";
//
// $params['total_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
//
// $order = "total_time desc";
// $list = $this->totalModel->getTotalByAgentId($field, $params, $is_store, $order);
// }
//
// if (count($list) > 0) {
// foreach ($list as $key => $item) {
// if($is_store == 2){
// $fields = "a.name,b.store_name";
// }else{
// $fields = "c.name,b.store_name";
// }
//
// $where_["a.store_id"] = $item["store_id"];
// $where_["c.id"] = $item["agent_id"];
// $info = $this->agentModel->getStoreOrAgentInfo($fields, $where_);
// if (count($info) > 0) {
// $list[$key]["store_name"] = $info[0]["store_name"];
// $list[$key]["name"] = $info[0]["name"];
// } else {
// $list[$key]["store_name"] = "--";
// $list[$key]["name"] = "--";
// }
// }
// }
// return $list;
// }
//
// private function sumDistrictPerformance($params)
// {
// $result = [];
// //房源
// $addHouseNum = $this->houseModel->getAddHouseNum($params);
// $result["add_house_num"] = isset($addHouseNum[0]["num"]) ? $addHouseNum[0]["num"] : 0;
//
// //dump($addHouseNum);
// //客源
// $addUserNum = $this->userModel->getAddUserNum($params);
// $result["add_user_num"] = isset($addUserNum[0]["num"]) ? $addUserNum[0]["num"] : 0;
//
// //dump($addUserNum);
// //业绩
// $performanceSum = $this->bargainModel->getAddBargainNum($params, 1);//1表示业绩 2表示实收
// $result["performance"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
//
// //实收
// $receivedSum = $this->bargainModel->getReceived($params);
// $result["official_receipts"] = isset($receivedSum[0]["num"]) ? $receivedSum[0]["num"] : 0;
//
// //dump($receivedSum);
// //约带看
//
// $reportNum = $this->reportModel->getAddReportNum($params);
// $result["look_at_num"] = isset($reportNum[0]["num"]) ? $reportNum[0]["num"] : 0;
//
// //dump($reportNum);
// //进场
//
// $addMarchInNum = $this->marchInModel->getAddMarchInNum($params);
// $result["march_in_num"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
//
// //dump($addMarchInNum);
// //收款
//
// $payLogNum = $this->payLogModel->getAddPayLogNum($params);
// $result["paylog"] = isset($payLogNum[0]["num"]) ? $payLogNum[0]["num"] : 0;
//
// //dump($payLogNum);
// // 监督
// $result["supervision_num"] = $this->superviseModel->getSuperviseListCount( $params);
//
// return $result;
// }
//
// /**
// * 组装请求参数
// * @param $agent_id
// * @param $type
// * @param $start_time
// * @param $end_time
// * @return array
// */
// private function getAgentId($agent_id, $type, $start_time, $end_time)
// {
//
// switch ($type) {
// case 1:
// $params["agent_id"] = $agent_id;
// break;
// case 2:
// $verify = new VerifyService();
// $agent_ids = $verify->getAgentsByAgentId($agent_id);
// $params["agent_id"] = array( "in", $agent_ids );
// break;
// default:
// return null;
// }
// $params['create_time'] = array( 'between', array( $start_time . " 00:00:00", $end_time . " 23:59:59" ) );
//
// return $params;
// }
//
// /**
// * 获取房源数据
// * @param $type
// * @param $agent_id
// * @param $start_time
// * @param $end_time
// * @param $page_no
// * @param $page_size
// * @return array|false|\PDOStatement|string|\think\Collection
// */
// public function getHousingResourceList($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 = "id,internal_title,shop_area_start,shop_area_end,rent_type,rent_price,shop_type,shop_sign";
// $addHouseList = $this->houseModel->getAddHouseList($params, $field, $page_no, $page_size);
// //获取图片信息
// foreach ($addHouseList as $key => $val) {
// $addHouseList[$key]["rent_price"] = $val["rent_price"] * 0.01;
//
// $param["house_id"] = $val["id"];
// $param["img_type"] = 1; //默认主图
// $imgArr = $this->gHousesImgModel->getHouseImages($param, 1);
// $addHouseList[$key]["images"] = !empty($imgArr[0]["img_name"]) ? CK_IMG_URL . 'images/' . $imgArr[0]["img_name"] : null;
// }
// return [ "code" => 200, "date" => $addHouseList ];
// }
//
// /**
// * 获取客源数据
// * @param $type
// * @param $agent_id
// * @param $start_time
// * @param $end_time
// * @param $page_no
// * @param $page_size
// * @return array|false|\PDOStatement|string|\think\Collection
// */
// public function getUserResourceList($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 = "id,user_name,user_phone,user_nick,create_time,agent_id";
// $addUserList = $this->userModel->getAddUserList($params, $field, $page_no, $page_size);
// foreach ($addUserList as $key => $val) {
// if ($val["agent_id"] == $agent_id) {
// $addUserList[$key]["is_my"] = 1;
// } else {
// $addUserList[$key]["is_my"] = 0;
// }
// $addUserList[$key]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $val["user_phone"]);
// }
// return [ "code" => 200, "date" => $addUserList ];
// }
//
// /**
// * 获取带看数据
// * @param $agent_id
// * @param $start_time
// * @param $end_time
// * @param $page_no
// * @param $page_size
// * @return array|false|\PDOStatement|string|\think\Collection
// */
// public function getFollowList($agent_id, $start_time, $end_time, $page_no, $page_size)
// {
//
// $params = $this->getAgentId($agent_id, 2, $start_time, $end_time);
// if (!$params)
// return [ "code" => 101, "date" => "传入的参数错误" ];
// $field = "a.id,a.user_name,a.user_phone,a.predict_see_time,c.internal_title as house_title,c.shop_type";
// $reportList = $this->reportModel->getAddReportList($params, $field, $page_no, $page_size);
// foreach ($reportList as $key => $val) {
// $reportList[$key]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $val["user_phone"]);
// }
// return [ "code" => 200, "date" => $reportList ];
// }
//
// /**
// * 获取进场数据
// * @param $agent_id
// * @param $start_time
// * @param $end_time
// * @param $page_no
// * @param $page_size
// * @return array|false|\PDOStatement|string|\think\Collection
// */
// public function marchInList($agent_id, $start_time, $end_time, $page_no, $page_size)
// {
//
// $params = $this->getAgentId($agent_id, 2, $start_time, $end_time);
// if (!$params)
// return [ "code" => 101, "date" => "传入的参数错误" ];
// $field = "a.id,c.user_name,c.user_phone,c.predict_see_time,b.house_title";
// $addMarchInList = $this->marchInModel->getAddMarchInList($params, $field, $page_no, $page_size);
// //获取图片信息
// foreach ($addMarchInList as $key => $val) {
// $addMarchInList[$key]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $val["user_phone"]);
// }
// return [ "code" => 200, "date" => $addMarchInList ];
// }
//
// /**
// * 获取收款数据
// * @param $agent_id
// * @param $start_time
// * @param $end_time
// * @param $page_no
// * @param $page_size
// * @return array|false|\PDOStatement|string|\think\Collection
// */
// public function paylogList($agent_id, $start_time, $end_time, $page_no, $page_size)
// {
//
// $params = $this->getAgentId($agent_id, 2, $start_time, $end_time);
// if (!$params)
// return [ "code" => 101, "date" => "传入的参数错误" ];
// $field = "a.id,c.user_name,c.user_phone,c.predict_see_time,b.house_title";
// $payLogList = $this->payLogModel->getAddPayLogList($params, $field, $page_no, $page_size);
// //获取图片信息
// foreach ($payLogList as $key => $val) {
// $payLogList[$key]["user_phone"] = preg_replace('/(\d{3})\d{4}(\d{4})/', '$1****$2', $val["user_phone"]);
// }
// return [ "code" => 200, "date" => $payLogList ];
// }
//
// /**
// * 获取业绩数据
// * @param $type
// * @param $agent_id
// * @param $start_time
// * @param $end_time
// * @param $page_no
// * @param $page_size
// * @return array|false|\PDOStatement|string|\think\Collection
// */
// public function performanceList($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,b.name,c.store_name,d.district_name,a.scale_fee,a.create_time";
// $performanceList = $this->bargainModel->getAddBargainList($params, $field, $page_no, $page_size);
//
// return [ "code" => 200, "date" => $performanceList ];
// }
//
// /**
// * 获取监督执行记录
// * @param $agent_id
// * @param $start_time
// * @param $end_time
// * @param $page_no
// * @param $page_size
// * @return array
// */
// public function superviseList($agent_id, $start_time, $end_time, $page_no, $page_size)
// {
// $params = $this->getAgentId($agent_id, 2, $start_time, $end_time);
// if (!$params)
// return [ "code" => 101, "date" => "传入的参数错误" ];
// $field = "a.id,a.agent_id,a.agent_name,a.remark,a.img,a.address,a.create_time";
//
// $where_["a.agent_id"] = $params["agent_id"];
// $where_["a.create_time"] = $params["create_time"];
// $superviseList = $this->superviseModel->findSuperviseList($page_no, $page_size, 'id desc', $field, $where_);
// foreach ($superviseList as $k => $v) {
// $superviseList[$k]['img'] = CK_IMG_URL . 'images/supervise/' . $v['img'];
// }
// 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,b.practical_fee,b.create_time";
//
// $where_["agent_id"] = $params["agent_id"];
// $where_["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
application/model/OMarchInModel.php
View file @
7e7680a0
...
...
@@ -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
;
}
/**
...
...
application/model/TAgentTotalModel.php
View file @
7e7680a0
...
...
@@ -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
;
...
...
application/route.php
View file @
7e7680a0
...
...
@@ -264,12 +264,18 @@ 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'
]
],
//商铺查看日志
'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
]);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment