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
b8471731
Commit
b8471731
authored
Jul 22, 2018
by
zhuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
业绩
parent
259549dd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
10 deletions
+57
-10
StatementService.php
application/api_broker/service/StatementService.php
+57
-10
No files found.
application/api_broker/service/StatementService.php
View file @
b8471731
...
...
@@ -235,14 +235,38 @@ class StatementService
if
(
$user_type
==
2
)
{
//如果是总监
//todo 判断是日报还是周报
if
(
$day_or_week
==
'day'
)
{
//日报
//dump($day_or_week);
//todo 本月业绩
$where_
=
[];
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
time
());
//$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"
)
);
$obargain
=
new
OBargainModel
();
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$result
[
"director_performance_month"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//todo 完成单数
$where_
=
[];
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
time
());
// $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"
)
);
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
3
);
//1表示业绩 2表示实收
$result
[
"director_bargain_sum_store"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
}
else
{
//周报
//todo 本月业绩
$where_
=
[];
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$where_
[
"district_id"
]
=
$district_id
;
$end_time
=
date
(
"Y-m-d"
,
time
());
// $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"
)
);
$obargain
=
new
OBargainModel
();
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
...
...
@@ -252,7 +276,8 @@ class StatementService
$where_
=
[];
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-14 day"
));
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$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"
)
);
$obargain
=
new
OBargainModel
();
...
...
@@ -262,7 +287,8 @@ class StatementService
$where_
=
[];
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$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"
)
);
$obargain
=
new
OBargainModel
();
...
...
@@ -273,7 +299,9 @@ 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"
)
);
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
3
);
//1表示业绩 2表示实收
...
...
@@ -361,6 +389,8 @@ class StatementService
//dump($results);
$last_week_total
=
0
;
foreach
(
$results
as
$key
=>
$value
)
{
// dump($value);
$last_week_total
+=
$value
[
"agent_num"
];
$paramArr
[
"store_id"
]
=
$value
[
"store_id"
];
...
...
@@ -375,20 +405,37 @@ class StatementService
}
if
(
$day_or_week
==
'week'
)
{
//查询总监下面门店的所有经纪人
$params
=
[];
$params
[
"store_id"
]
=
$value
[
"store_id"
];
$params
[
"status"
]
=
0
;
//只查询正常状态的经纪人
$agentsArr
=
$this
->
agentModel
->
getAgentsByStoreId
(
$params
);
$agent_total
=
count
(
$agentsArr
);
if
(
$agent_total
>
0
)
{
$agentIds
=
""
;
foreach
(
$agentsArr
as
$key1
=>
$value1
)
{
$agentIds
.=
$value1
[
"id"
]
.
","
;
}
$agentIds
=
rtrim
(
$agentIds
,
","
);
//经纪人ID集合
}
//查询总监下面门店的所有经纪人 end
//todo 本月业绩
$where_
=
[];
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
;
$where_
[
"
store_id"
]
=
$value
[
"store_id"
]
;
$end_time
=
date
(
"Y-m-d"
,
time
())
;
$where_
[
"
agent_id"
]
=
array
(
"in"
,
$agentIds
)
;
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$obargain
=
new
OBargainModel
();
//dump($where_);
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$results
[
$key
][
"director_performance_month"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//todo 上周业绩
$where_
=
[];
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-14 day"
));
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$where_
[
"
store_id"
]
=
$value
[
"store_id"
]
;
$where_
[
"
agent_id"
]
=
array
(
"in"
,
$agentIds
)
;
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$results
[
$key
][
"director_last_week_performance_num"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
...
...
@@ -396,7 +443,7 @@ class StatementService
$where_
=
[];
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$end_time
=
date
(
"Y-m-d"
,
time
());
$where_
[
"
store_id"
]
=
$value
[
"store_id"
]
;
$where_
[
"
agent_id"
]
=
array
(
"in"
,
$agentIds
)
;
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$results
[
$key
][
"director_week_performance_num"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
...
...
@@ -405,7 +452,7 @@ class StatementService
$where_
=
[];
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
time
());
$where_
[
"
store_id"
]
=
$value
[
"store_id"
]
;
$where_
[
"
agent_id"
]
=
array
(
"in"
,
$agentIds
)
;
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
3
);
//1表示业绩 2表示实收
...
...
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