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
4af05bba
Commit
4af05bba
authored
Jun 28, 2019
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
649687aa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
66 additions
and
64 deletions
+66
-64
StatementService.php
application/api_broker/service/StatementService.php
+66
-64
No files found.
application/api_broker/service/StatementService.php
View file @
4af05bba
...
...
@@ -31,6 +31,7 @@ class StatementService
private
$reportModel
;
private
$marchInModel
;
private
$bargainModel
;
private
$partialCommission
;
const
USER_LEVEL_FIST
=
0
;
//经纪人
const
USER_LEVEL_SECOND
=
1
;
//店长
...
...
@@ -46,6 +47,7 @@ class StatementService
$this
->
reportModel
=
new
OReportModel
();
$this
->
marchInModel
=
new
OMarchInModel
();
$this
->
bargainModel
=
new
OBargainModel
();
$this
->
partialCommission
=
new
OPartialCommission
();
}
...
...
@@ -183,8 +185,7 @@ class StatementService
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$result
[
"performance_month"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
$m_partial
=
new
OPartialCommission
();
$real_performanceSum
=
$m_partial
->
getReceived
(
$where_
);
$real_performanceSum
=
$this
->
partialCommission
->
getReceived
(
$where_
);
$result
[
"real_performance_month"
]
=
isset
(
$real_performanceSum
[
0
][
"num"
])
?
$real_performanceSum
[
0
][
"num"
]
:
0
;
//本周业绩
...
...
@@ -247,7 +248,7 @@ class StatementService
$end_time
=
$start_time
;
$where_
[
"agent_id"
]
=
$agent_id
;
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
// dump($where_);
// dump($where_);
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$where_
,
3
);
//1表示业绩 2表示实收
$result
[
"bargain_sum_store"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
...
...
@@ -259,8 +260,8 @@ 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
;
...
...
@@ -293,7 +294,7 @@ class StatementService
$where_
=
[];
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
time
());
// $where_["district_id"] = $district_id;
// $where_["district_id"] = $district_id;
$where_
[
"agent_id"
]
=
$conditions
[
"agent_id"
];
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
...
...
@@ -337,7 +338,7 @@ class StatementService
$where_
=
[];
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
time
());
// $where_["district_id"] = $district_id;
// $where_["district_id"] = $district_id;
$where_
[
"agent_id"
]
=
$conditions
[
"agent_id"
];
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
...
...
@@ -404,7 +405,7 @@ class StatementService
$where_
[
'status'
]
=
array
(
"in"
,
'10, 11, 13, 20'
);
$obargain
=
new
OBargainModel
();
// dump($where_);
// dump($where_);
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$store_list
[
"performance_week"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
...
...
@@ -477,7 +478,7 @@ class StatementService
foreach
(
$results
as
$key
=>
$value
)
{
// dump($value);
// dump($value);
$last_week_total
+=
$value
[
"agent_num"
];
$paramArr
[
"store_id"
]
=
$value
[
"store_id"
];
$paramArr
[
"level"
]
=
array
(
"in"
,
[
20
,
40
]
);
...
...
@@ -572,57 +573,54 @@ class StatementService
}
/**
* 查询业务员日报数据
* @param $agent_id
* @param $site_id
* @return mixed
* @param $agent_level
* @param $store_id
* @param $district_id
* @return mixed user 朱伟
* http://showdoc.tonglianjituan.com/index.php?s=/1&page_id=698
*/
public
function
selectStatementForClerk
(
$agent_id
,
$site_id
)
public
function
selectStatementForClerk
(
$agent_id
,
$agent_level
,
$store_id
,
$district_id
)
{
$time_
=
date
(
"Y-m-d"
,
time
());
$conditions
[
'agent_id'
]
=
$agent_id
;
$conditions
[
'create_time'
]
=
array
(
'between'
,
array
(
$time_
.
" 00:00:00"
,
$time_
.
" 23:59:59"
)
);
/*** 日数据 **/
// 房源
$result
[
"house_num"
]
=
$this
->
housesToAgents
->
getAddHouseNumByAgentId
(
$conditions
);
// 客源
$result
[
"user_num"
]
=
$this
->
userModel
->
getAddUserNumByAgentIdV2
(
$conditions
);
$result
[
"user_num"
]
=
$this
->
userModel
->
getAddUserNumByAgentId
(
$conditions
);
// 带看 (报备)
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$conditions
);
$result
[
"follow_up_num"
]
=
isset
(
$addMarchInNum
[
0
][
"num"
])
?
$addMarchInNum
[
0
][
"num"
]
:
0
;
//跟进
$m_phone_follow_up
=
new
UPhoneFollowUpTemporary
(
$site_id
);
$result
[
"phone_follow_up_num"
]
=
$m_phone_follow_up
->
getFollowTotal
(
$conditions
);
/*** 月数据 **/
// 业绩
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$conditions
,
1
);
//1表示业绩 2表示实收
$result
[
"performance"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
// 本月-业绩
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
time
());
$conditions
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
// 房源
$result
[
"month_house_num"
]
=
$this
->
housesToAgents
->
getAddHouseNumByAgentId
(
$conditions
);
// 客源
$result
[
"month_user_num"
]
=
$this
->
userModel
->
getAddUserNumByAgentIdV2
(
$conditions
);
// 带看 (报备)
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$conditions
);
$result
[
"month_follow_up_num"
]
=
isset
(
$addMarchInNum
[
0
][
"num"
])
?
$addMarchInNum
[
0
][
"num"
]
:
0
;
//业绩
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$conditions
,
1
);
//1表示业绩 2表示实收
$result
[
"month_performance"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//成交单数
$result
[
"performance_for_month"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
// 本月-成交单数
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNumV2
(
$conditions
,
3
);
//1表示业绩 2表示实收
$result
[
"
month_bargain_sum
"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
$result
[
"
bargain_sum_for_month
"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
return
$result
;
}
/**
* 店长日报
6666666
* 店长日报
2019年06月17日 线上
* @param $agent_id
* @param $agent_level
* @param $store_id
...
...
@@ -634,11 +632,10 @@ class StatementService
{
$time_
=
date
(
"Y-m-d"
,
time
());
$agent_res
=
$this
->
getAgentIDsByDistrictId
(
$store_id
,
$agent_level
,
0
);
$agent_res
=
$this
->
getAgentIDsByDistrictId
(
$store_id
,
$agent_level
);
############################## 当日数据 ################################################
$conditions
[
'agent_id'
]
=
array
(
"in"
,
$agent_res
[
'agent_ids'
]
);
$conditions
[
'create_time'
]
=
array
(
'between'
,
array
(
$time_
.
" 00:00:00"
,
$time_
.
" 23:59:59"
)
);
// 房源
$result
[
"team_house_num"
]
=
$this
->
housesToAgents
->
getAddHouseNumByAgentId
(
$conditions
);
...
...
@@ -648,13 +645,13 @@ class StatementService
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$conditions
);
$result
[
"team_follow_up_num"
]
=
isset
(
$addMarchInNum
[
0
][
"num"
])
?
$addMarchInNum
[
0
][
"num"
]
:
0
;
// 业绩
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$conditions
,
1
);
//1表示业绩 2表示实收
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
V3
(
$conditions
,
1
);
//1表示业绩 2表示实收
$result
[
"team_performance"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
// 实收
$
performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$conditions
,
2
);
//1表示业绩 2表示实收
$result
[
"team_real_performance"
]
=
isset
(
$
performanceSum
[
0
][
"num"
])
?
$
performanceSum
[
0
][
"num"
]
:
0
;
$
real_performanceSum
=
$this
->
partialCommission
->
getReceived
(
$conditions
);
$result
[
"team_real_performance"
]
=
isset
(
$
real_performanceSum
[
0
][
"num"
])
?
$real_
performanceSum
[
0
][
"num"
]
:
0
;
// 本月-业绩
############################## 本月数据 ################################################
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
time
());
$conditions
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
...
...
@@ -667,19 +664,16 @@ class StatementService
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$conditions
);
$result
[
"team_month_follow_up_num"
]
=
isset
(
$addMarchInNum
[
0
][
"num"
])
?
$addMarchInNum
[
0
][
"num"
]
:
0
;
// 业绩
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$conditions
,
1
);
//1表示业绩 2表示实收
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
V3
(
$conditions
,
1
);
//1表示业绩 2表示实收
$result
[
"team_month_performance"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
// 实收666666666666
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$conditions
,
2
);
//1表示业绩 2表示实收
$result
[
"team_month_real_performance"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
// 实收
$real_performanceSum
=
$this
->
partialCommission
->
getReceived
(
$conditions
);
$result
[
"team_month_real_performance"
]
=
isset
(
$real_performanceSum
[
0
][
"num"
])
?
$real_performanceSum
[
0
][
"num"
]
:
0
;
// 本月-成交单数
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNumV2
(
$conditions
,
3
);
//1表示业绩 2表示实收
$result
[
"team_month_bargain_sum"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
/**查询店长个人数据**/
#店长个人
############################## 店长个人数据 ################################################
$time_
=
date
(
"Y-m-d"
,
time
());
$conditions
[
'agent_id'
]
=
$agent_id
;
$conditions
[
'create_time'
]
=
array
(
'between'
,
array
(
$time_
.
" 00:00:00"
,
$time_
.
" 23:59:59"
)
);
...
...
@@ -697,7 +691,7 @@ class StatementService
$result
[
"self_phone_follow_up_num"
]
=
$m_phone_follow_up
->
getFollowTotal
(
$conditions
);
/**查询店长旗下业务员数据**/
$agent_res
=
$this
->
getAgentIDsByDistrictId
(
$store_id
,
$agent_level
,
1
);
foreach
(
$agent_res
[
'store_list'
]
as
$k
=>
$v
)
{
$conditions
[
'agent_id'
]
=
$v
[
"id"
];
// 房源
...
...
@@ -708,7 +702,7 @@ class StatementService
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$conditions
);
$agent_res
[
'store_list'
][
$k
][
"follow_up_num"
]
=
isset
(
$addMarchInNum
[
0
][
"num"
])
?
$addMarchInNum
[
0
][
"num"
]
:
0
;
// 业绩
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$conditions
,
1
);
//1表示业绩 2表示实收
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
V3
(
$conditions
,
1
);
//1表示业绩 2表示实收
$agent_res
[
'store_list'
][
$k
][
"performance"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
}
$result
[
"store_list"
]
=
$agent_res
[
'store_list'
];
...
...
@@ -806,34 +800,35 @@ class StatementService
}
/**
* 查询总监日报数据
* @param $agent_id
* 总监日报 2019年06月28日 线上
* @param $agent_level
* @param $store_id
* @param $district_id
* @return mixed
* http://showdoc.tonglianjituan.com/index.php?s=/1&page_id=701
*/
public
function
selectStatementForDistrictWithDay
(
$agent_
id
,
$agent_level
,
$store_id
,
$district_id
)
public
function
selectStatementForDistrictWithDay
(
$agent_
level
,
$district_id
)
{
$agent_res
=
$this
->
getAgentIDsByDistrictId
(
$district_id
,
$agent_level
);
$agent_res
=
$this
->
getAgentIDsByDistrictId
(
$district_id
,
$agent_level
,
0
);
$conditions
[
'agent_id'
]
=
array
(
"in"
,
$agent_res
[
'agent_ids'
]
);
// 本月-业绩
############################## 本月数据 ###############################################
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
time
());
$conditions
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$conditions
,
1
);
//1表示业绩 2表示实收
$result
[
"performance_for_month"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
// 业绩
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNumV3
(
$conditions
,
1
);
//1表示业绩 2表示实收
$result
[
"district_month_performance"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
// 实收
$real_performanceSum
=
$this
->
partialCommission
->
getReceived
(
$conditions
);
$result
[
"district_month_real_performance"
]
=
isset
(
$real_performanceSum
[
0
][
"num"
])
?
$real_performanceSum
[
0
][
"num"
]
:
0
;
// 本月-成交单数
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNumV2
(
$conditions
,
3
);
//1表示业绩 2表示实收
$result
[
"
bargain_sum_for_month
"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
$result
[
"
district_month_bargain_sum
"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//人数
$agent_res
=
$this
->
getAgentIDsByDistrictId
(
$district_id
,
$agent_level
,
1
);
$result
[
"district_team_num"
]
=
$agent_res
[
'store_list_num'
];
return
$result
;
}
...
...
@@ -965,9 +960,10 @@ class StatementService
* 查询门店或者区域下所有经纪人id
* @param $district_or_store_id
* @param $type
* @return string
* @param int $agent_list_type
* @return mixed
*/
public
function
getAgentIDsByDistrictId
(
$district_or_store_id
,
$type
)
public
function
getAgentIDsByDistrictId
(
$district_or_store_id
,
$type
,
$agent_list_type
=
0
)
{
//查询总监下面门店的所有经纪人
$params
=
[];
...
...
@@ -976,12 +972,18 @@ class StatementService
}
else
{
$params
[
"district_id"
]
=
$district_or_store_id
;
}
$params
[
"status"
]
=
0
;
//只查询正常状态的经纪人
if
(
$agent_list_type
==
0
){
//业绩统计 需要包括 0正常 1长假 2离职
$params
[
"status"
]
=
array
(
'in'
,
'0,1,2'
);
}
else
{
//员工列表只显示 0正常
$params
[
"status"
]
=
0
;
}
$agentModel
=
new
AAgents
();
$agentsArr
=
$agentModel
->
getAgentsByStoreId
(
$params
);
$agent_total
=
count
(
$agentsArr
);
$agentIds
=
""
;
if
(
$agent_total
>
0
)
{
$agentIds
=
""
;
foreach
(
$agentsArr
as
$key1
=>
$value1
)
{
$agentIds
.=
$value1
[
"id"
]
.
","
;
}
...
...
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