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
41e77800
Commit
41e77800
authored
Jun 19, 2019
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
日报修改
parent
861a30ba
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
16 deletions
+58
-16
StatementService.php
application/api_broker/service/StatementService.php
+19
-16
OBargainModel.php
application/model/OBargainModel.php
+39
-0
No files found.
application/api_broker/service/StatementService.php
View file @
41e77800
...
@@ -631,11 +631,10 @@ class StatementService
...
@@ -631,11 +631,10 @@ class StatementService
{
{
$time_
=
date
(
"Y-m-d"
,
time
());
$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
[
'agent_id'
]
=
array
(
"in"
,
$agent_res
[
'agent_ids'
]
);
$conditions
[
'create_time'
]
=
array
(
'between'
,
array
(
$time_
.
" 00:00:00"
,
$time_
.
" 23:59:59"
)
);
$conditions
[
'create_time'
]
=
array
(
'between'
,
array
(
$time_
.
" 00:00:00"
,
$time_
.
" 23:59:59"
)
);
// 房源
// 房源
$result
[
"team_house_num"
]
=
$this
->
housesToAgents
->
getAddHouseNumByAgentId
(
$conditions
);
$result
[
"team_house_num"
]
=
$this
->
housesToAgents
->
getAddHouseNumByAgentId
(
$conditions
);
...
@@ -645,13 +644,13 @@ class StatementService
...
@@ -645,13 +644,13 @@ class StatementService
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$conditions
);
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$conditions
);
$result
[
"team_follow_up_num"
]
=
isset
(
$addMarchInNum
[
0
][
"num"
])
?
$addMarchInNum
[
0
][
"num"
]
:
0
;
$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
;
$result
[
"team_performance"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
// 实收
// 实收
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$conditions
,
2
);
//1表示业绩 2表示实收
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$conditions
,
2
);
//1表示业绩 2表示实收
$result
[
"team_real_performance"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
$result
[
"team_real_performance"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
// 本月-业绩
############################## 本月数据 ################################################
$start_time
=
date
(
"Y-m-01"
,
time
());
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
time
());
$conditions
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$conditions
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
...
@@ -664,19 +663,16 @@ class StatementService
...
@@ -664,19 +663,16 @@ class StatementService
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$conditions
);
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$conditions
);
$result
[
"team_month_follow_up_num"
]
=
isset
(
$addMarchInNum
[
0
][
"num"
])
?
$addMarchInNum
[
0
][
"num"
]
:
0
;
$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
;
$result
[
"team_month_performance"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
// 实收666666666666
// 实收666666666666
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$conditions
,
2
);
//1表示业绩 2表示实收
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$conditions
,
2
);
//1表示业绩 2表示实收
$result
[
"team_month_real_performance"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
$result
[
"team_month_real_performance"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
// 本月-成交单数
// 本月-成交单数
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNumV2
(
$conditions
,
3
);
//1表示业绩 2表示实收
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNumV2
(
$conditions
,
3
);
//1表示业绩 2表示实收
$result
[
"team_month_bargain_sum"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
$result
[
"team_month_bargain_sum"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
/**查询店长个人数据**/
############################## 店长个人数据 ################################################
#店长个人
$time_
=
date
(
"Y-m-d"
,
time
());
$time_
=
date
(
"Y-m-d"
,
time
());
$conditions
[
'agent_id'
]
=
$agent_id
;
$conditions
[
'agent_id'
]
=
$agent_id
;
$conditions
[
'create_time'
]
=
array
(
'between'
,
array
(
$time_
.
" 00:00:00"
,
$time_
.
" 23:59:59"
)
);
$conditions
[
'create_time'
]
=
array
(
'between'
,
array
(
$time_
.
" 00:00:00"
,
$time_
.
" 23:59:59"
)
);
...
@@ -694,7 +690,7 @@ class StatementService
...
@@ -694,7 +690,7 @@ class StatementService
$result
[
"self_phone_follow_up_num"
]
=
$m_phone_follow_up
->
getFollowTotal
(
$conditions
);
$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
)
{
foreach
(
$agent_res
[
'store_list'
]
as
$k
=>
$v
)
{
$conditions
[
'agent_id'
]
=
$v
[
"id"
];
$conditions
[
'agent_id'
]
=
$v
[
"id"
];
// 房源
// 房源
...
@@ -705,7 +701,7 @@ class StatementService
...
@@ -705,7 +701,7 @@ class StatementService
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$conditions
);
$addMarchInNum
=
$this
->
marchInModel
->
getAddMarchInNum
(
$conditions
);
$agent_res
[
'store_list'
][
$k
][
"follow_up_num"
]
=
isset
(
$addMarchInNum
[
0
][
"num"
])
?
$addMarchInNum
[
0
][
"num"
]
:
0
;
$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
;
$agent_res
[
'store_list'
][
$k
][
"performance"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
}
}
$result
[
"store_list"
]
=
$agent_res
[
'store_list'
];
$result
[
"store_list"
]
=
$agent_res
[
'store_list'
];
...
@@ -962,9 +958,10 @@ class StatementService
...
@@ -962,9 +958,10 @@ class StatementService
* 查询门店或者区域下所有经纪人id
* 查询门店或者区域下所有经纪人id
* @param $district_or_store_id
* @param $district_or_store_id
* @param $type
* @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
=
[];
$params
=
[];
...
@@ -973,12 +970,18 @@ class StatementService
...
@@ -973,12 +970,18 @@ class StatementService
}
else
{
}
else
{
$params
[
"district_id"
]
=
$district_or_store_id
;
$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
();
$agentModel
=
new
AAgents
();
$agentsArr
=
$agentModel
->
getAgentsByStoreId
(
$params
);
$agentsArr
=
$agentModel
->
getAgentsByStoreId
(
$params
);
$agent_total
=
count
(
$agentsArr
);
$agent_total
=
count
(
$agentsArr
);
$agentIds
=
""
;
if
(
$agent_total
>
0
)
{
if
(
$agent_total
>
0
)
{
$agentIds
=
""
;
foreach
(
$agentsArr
as
$key1
=>
$value1
)
{
foreach
(
$agentsArr
as
$key1
=>
$value1
)
{
$agentIds
.=
$value1
[
"id"
]
.
","
;
$agentIds
.=
$value1
[
"id"
]
.
","
;
}
}
...
...
application/model/OBargainModel.php
View file @
41e77800
...
@@ -825,6 +825,45 @@ class OBargainModel extends Model
...
@@ -825,6 +825,45 @@ class OBargainModel extends Model
->
select
();
->
select
();
return
$return
;
return
$return
;
}
}
public
function
getAddBargainNumV3
(
$params
,
$type
)
{
$where_
=
[];
$field
=
""
;
$join
=
[];
if
(
$type
==
1
)
{
$field
=
"sum(scale_fee) as num"
;
$where_
[
"a.status"
]
=
array
(
"in"
,
'10,11,13'
);
}
elseif
(
$type
==
2
)
{
$field
=
"sum(practical_fee) as num"
;
}
elseif
(
$type
==
3
)
{
$field
=
"count(1) as num"
;
$where_
[
"a.role"
]
=
3
;
//必须是反签方
$where_
[
"a.status"
]
=
array
(
"in"
,
'10,11,13'
);
}
if
(
isset
(
$params
[
"agent_id"
]))
{
$where_
[
"a.agent_id"
]
=
$params
[
"agent_id"
];
}
if
(
isset
(
$params
[
"create_time"
]))
{
$where_
[
"a.create_time"
]
=
$params
[
"create_time"
];
}
if
(
isset
(
$params
[
"house_ids"
]))
{
$where_
[
"b.house_id"
]
=
array
(
"in"
,
$params
[
"house_ids"
]
);
array_push
(
$join
,
[
' o_order b'
,
'a.order_id = b.id'
,
'left'
]);
}
$return
=
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
alias
(
"a"
)
->
join
(
$join
)
->
where
(
$where_
)
->
select
();
return
$return
;
}
/**
/**
* @param $params
* @param $params
* @return false|\PDOStatement|string|\think\Collection
* @return false|\PDOStatement|string|\think\Collection
...
...
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