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
2c2e42a5
Commit
2c2e42a5
authored
Aug 15, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
e58196c0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
71 additions
and
45 deletions
+71
-45
PerformanceService.php
application/index/service/PerformanceService.php
+71
-45
No files found.
application/index/service/PerformanceService.php
View file @
2c2e42a5
...
...
@@ -51,7 +51,7 @@ class PerformanceService
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
totalAgent
(
$type
,
$yesterday
,
$end_day
,
$father_id
)
public
function
totalAgent
(
$type
,
$yesterday
,
$end_day
,
$
pageNo
,
$pageSize
,
$
father_id
)
{
$where_
=
[];
$where_
[
'total_time'
]
=
array
(
'between'
,
array
(
$end_day
,
$yesterday
)
);
...
...
@@ -63,14 +63,40 @@ class PerformanceService
}
}
$where_
=
[];
/*
$where_ = [];
$where_['a.create_time'] = array( 'between', array( $end_day . " 00:00:00", $yesterday . " 23:59:59" ) );
$field = "b.id as agent_id,b.store_id,b.district_id,sum(a.scale_fee) as performance_total";
$order = "performance_total desc";
$result
=
$this
->
bargainModel
->
getTotalByAgentId
(
$field
,
$where_
,
$type
,
$order
);
$result = $this->bargainModel->getTotalByAgentId($field, $where_, $type, $order);
*/
$where_
[
'total_time'
]
=
array
(
'between'
,
array
(
$end_day
,
$yesterday
)
);
//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,
sum(bargain_sum) as bargain_sum_total,
sum(paylog) as paylog_total,
sum(march_in_num) as march_in_num_total,
sum(look_at_num) as look_at_num_total,
sum(add_house_num) as add_house_num_total,
sum(add_user_num) as add_user_num_total
"
;
// $field = "agent_id,store_id,district_id,sum(performance) as performance_total";
$order
=
"performance_total desc"
;
//dump($where_);
$result
=
$this
->
totalModel
->
getTotalByAgentId
(
$field
,
$where_
,
$type
,
$order
);
//dump($result);
$arr
=
[];
// $total = $this->totalModel->getTotalByAgentIdCount($field, $where_, $type, $order);
// $field = "a.name,a.img,b.store_name,c.district_name";
...
...
@@ -89,41 +115,41 @@ class PerformanceService
$value
[
"district_name"
]
=
$info
[
0
][
"district_name"
];
//todo 计算当日业绩 performance_total
$where_
=
[];
/*
$where_ = [];
//$where_["district_id"] = $district_id;
$where_["agent_id"] = $value["agent_id"];
$where_['create_time'] = array( 'between', array( $end_day . " 00:00:00", $yesterday . " 23:59:59" ) );
$obargain = new OBargainModel();
//dump($where_);
//dump($where_);
*/
//todo 计算当日成交单数 bargain_sum
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
3
);
//1表示业绩 2表示实收
$value
[
"bargain_sum_total"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
/*
$performanceSum = $obargain->getAddBargainNum($where_, 3);//1表示业绩 2表示实收
$value["bargain_sum_total"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
*/
//todo 计算当日收款数 paylog
$receivedSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$where_
,
2
);
//1表示业绩 2表示实收
$value
[
"paylog_total"
]
=
isset
(
$receivedSum
[
0
][
"num"
])
?
$receivedSum
[
0
][
"num"
]
:
0
;
/*
$receivedSum = $this->bargainModel->getAddBargainNum($where_, 2);//1表示业绩 2表示实收
$value["paylog_total"] = isset($receivedSum[0]["num"]) ? $receivedSum[0]["num"] : 0;
*/
//todo 计算当日进场数 march_in_num
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$where_
);
$value
[
"march_in_num_total"
]
=
isset
(
$addMarchInNum
[
0
][
"num"
])
?
$addMarchInNum
[
0
][
"num"
]
:
0
;
/*
$addMarchInNum = $this->marchInModel->getAddMarchInNum($where_);
$value["march_in_num_total"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
*/
//todo 计算当日报备数 look_at_num
$reportNum
=
$this
->
reportModel
->
getAddReportNum
(
$where_
);
$value
[
"look_at_num_total"
]
=
isset
(
$reportNum
[
0
][
"num"
])
?
$reportNum
[
0
][
"num"
]
:
0
;
/*
$reportNum = $this->reportModel->getAddReportNum($where_);
$value["look_at_num_total"] = isset($reportNum[0]["num"]) ? $reportNum[0]["num"] : 0;
*/
//todo 计算当日新增商铺数 add_house_num
$addHouseNum
=
$this
->
houseModel
->
getAddHouseNum
(
$where_
);
$value
[
"add_house_num_total"
]
=
isset
(
$addHouseNum
[
0
][
"num"
])
?
$addHouseNum
[
0
][
"num"
]
:
0
;
/*
$addHouseNum = $this->houseModel->getAddHouseNum($where_);
$value["add_house_num_total"] = isset($addHouseNum[0]["num"]) ? $addHouseNum[0]["num"] : 0;
*/
//todo 计算当日新增客户数 add_user_num
$addUserNum
=
$this
->
userModel
->
getAddUserNum
(
$where_
);
$value
[
"add_user_num_total"
]
=
isset
(
$addUserNum
[
0
][
"num"
])
?
$addUserNum
[
0
][
"num"
]
:
0
;
/*
$addUserNum = $this->userModel->getAddUserNum($where_);
$value["add_user_num_total"] = isset($addUserNum[0]["num"]) ? $addUserNum[0]["num"] : 0;
*/
array_push
(
$arr
,
$value
);
}
...
...
@@ -146,7 +172,7 @@ class PerformanceService
$value
[
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
//查询总监下面门店的所有经纪人
$params
=
[];
/*
$params = [];
$params['store_id'] = $value["store_id"];
$params["status"] = 0; //只查询正常状态的经纪人
$agentsArr = $this->agentModel->getAgentsByStoreId($params);
...
...
@@ -165,36 +191,36 @@ class PerformanceService
$where_["agent_id"] = array( "in", $agentIds );
$where_['create_time'] = array( 'between', array( $end_day . " 00:00:00", $yesterday . " 23:59:59" ) );
$obargain = new OBargainModel();
//dump($where_);
//dump($where_);
*/
//todo 计算当日成交单数 bargain_sum
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
3
);
//1表示业绩 2表示实收
$value
[
"bargain_sum_total"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
/*
$performanceSum = $obargain->getAddBargainNum($where_, 3);//1表示业绩 2表示实收
$value["bargain_sum_total"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
*/
//todo 计算当日收款数 paylog
$receivedSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$where_
,
2
);
//1表示业绩 2表示实收
$value
[
"paylog_total"
]
=
isset
(
$receivedSum
[
0
][
"num"
])
?
$receivedSum
[
0
][
"num"
]
:
0
;
/*
$receivedSum = $this->bargainModel->getAddBargainNum($where_, 2);//1表示业绩 2表示实收
$value["paylog_total"] = isset($receivedSum[0]["num"]) ? $receivedSum[0]["num"] : 0;
*/
//todo 计算当日进场数 march_in_num
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$where_
);
$value
[
"march_in_num_total"
]
=
isset
(
$addMarchInNum
[
0
][
"num"
])
?
$addMarchInNum
[
0
][
"num"
]
:
0
;
/*
$addMarchInNum = $this->marchInModel->getAddMarchInNum($where_);
$value["march_in_num_total"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
*/
//todo 计算当日报备数 look_at_num
$reportNum
=
$this
->
reportModel
->
getAddReportNum
(
$where_
);
$value
[
"look_at_num_total"
]
=
isset
(
$reportNum
[
0
][
"num"
])
?
$reportNum
[
0
][
"num"
]
:
0
;
/*
$reportNum = $this->reportModel->getAddReportNum($where_);
$value["look_at_num_total"] = isset($reportNum[0]["num"]) ? $reportNum[0]["num"] : 0;
*/
//todo 计算当日新增商铺数 add_house_num
$addHouseNum
=
$this
->
houseModel
->
getAddHouseNum
(
$where_
);
$value
[
"add_house_num_total"
]
=
isset
(
$addHouseNum
[
0
][
"num"
])
?
$addHouseNum
[
0
][
"num"
]
:
0
;
/*
$addHouseNum = $this->houseModel->getAddHouseNum($where_);
$value["add_house_num_total"] = isset($addHouseNum[0]["num"]) ? $addHouseNum[0]["num"] : 0;
*/
//todo 计算当日新增客户数 add_user_num
$addUserNum
=
$this
->
userModel
->
getAddUserNum
(
$where_
);
$value
[
"add_user_num_total"
]
=
isset
(
$addUserNum
[
0
][
"num"
])
?
$addUserNum
[
0
][
"num"
]
:
0
;
/*
$addUserNum = $this->userModel->getAddUserNum($where_);
$value["add_user_num_total"] = isset($addUserNum[0]["num"]) ? $addUserNum[0]["num"] : 0;
*/
//dump($value);
array_push
(
$arr
,
$value
);
...
...
@@ -217,7 +243,7 @@ class PerformanceService
$value
[
"team_num"
]
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
//查询总监下面门店的所有经纪人
$params
=
[];
/*
$params = [];
$params["district_id"] = $value["district_id"];
$params["status"] = 0; //只查询正常状态的经纪人
$agentsArr = $this->agentModel->getAgentsByStoreId($params);
...
...
@@ -236,36 +262,36 @@ class PerformanceService
//$where_["district_id"] = $district_id;
$where_["agent_id"] = array( "in", $agentIds );
$where_['create_time'] = array( 'between', array( $end_day . " 00:00:00", $yesterday . " 23:59:59" ) );
$obargain
=
new
OBargainModel
();
$obargain = new OBargainModel();
*/
//todo 计算当日成交单数 bargain_sum
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
3
);
//1表示业绩 2表示实收
$value
[
"bargain_sum_total"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
/*
$performanceSum = $obargain->getAddBargainNum($where_, 3);//1表示业绩 2表示实收
$value["bargain_sum_total"] = isset($performanceSum[0]["num"]) ? $performanceSum[0]["num"] : 0;
*/
//todo 计算当日收款数 paylog
$receivedSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$where_
,
2
);
//1表示业绩 2表示实收
$value
[
"paylog_total"
]
=
isset
(
$receivedSum
[
0
][
"num"
])
?
$receivedSum
[
0
][
"num"
]
:
0
;
/*
$receivedSum = $this->bargainModel->getAddBargainNum($where_, 2);//1表示业绩 2表示实收
$value["paylog_total"] = isset($receivedSum[0]["num"]) ? $receivedSum[0]["num"] : 0;
*/
//todo 计算当日进场数 march_in_num
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$where_
);
$value
[
"march_in_num_total"
]
=
isset
(
$addMarchInNum
[
0
][
"num"
])
?
$addMarchInNum
[
0
][
"num"
]
:
0
;
/*
$addMarchInNum = $this->marchInModel->getAddMarchInNum($where_);
$value["march_in_num_total"] = isset($addMarchInNum[0]["num"]) ? $addMarchInNum[0]["num"] : 0;
*/
//todo 计算当日报备数 look_at_num
$reportNum
=
$this
->
reportModel
->
getAddReportNum
(
$where_
);
$value
[
"look_at_num_total"
]
=
isset
(
$reportNum
[
0
][
"num"
])
?
$reportNum
[
0
][
"num"
]
:
0
;
/*
$reportNum = $this->reportModel->getAddReportNum($where_);
$value["look_at_num_total"] = isset($reportNum[0]["num"]) ? $reportNum[0]["num"] : 0;
*/
//todo 计算当日新增商铺数 add_house_num
$addHouseNum
=
$this
->
houseModel
->
getAddHouseNum
(
$where_
);
$value
[
"add_house_num_total"
]
=
isset
(
$addHouseNum
[
0
][
"num"
])
?
$addHouseNum
[
0
][
"num"
]
:
0
;
/*
$addHouseNum = $this->houseModel->getAddHouseNum($where_);
$value["add_house_num_total"] = isset($addHouseNum[0]["num"]) ? $addHouseNum[0]["num"] : 0;
*/
//todo 计算当日新增客户数 add_user_num
$addUserNum
=
$this
->
userModel
->
getAddUserNum
(
$where_
);
$value
[
"add_user_num_total"
]
=
isset
(
$addUserNum
[
0
][
"num"
])
?
$addUserNum
[
0
][
"num"
]
:
0
;
/*
$addUserNum = $this->userModel->getAddUserNum($where_);
$value["add_user_num_total"] = isset($addUserNum[0]["num"]) ? $addUserNum[0]["num"] : 0;
*/
array_push
(
$arr
,
$value
);
break
;
}
...
...
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