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
9645d3c3
Commit
9645d3c3
authored
Jul 20, 2018
by
clone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug
parent
c01db511
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
159 additions
and
157 deletions
+159
-157
OrderLogService.php
application/api_broker/service/OrderLogService.php
+9
-3
StatementService.php
application/api_broker/service/StatementService.php
+149
-152
OBargainModel.php
application/model/OBargainModel.php
+1
-2
No files found.
application/api_broker/service/OrderLogService.php
View file @
9645d3c3
...
...
@@ -1122,13 +1122,19 @@ class OrderLogService
$filed
=
"a.id,a.father_id,a.house_number,a.commission,a.agent_id,a.create_time,b.user_phone,b.user_name,b.user_id,c.id as order_id,
d.id as house_id,d.internal_title,d.internal_address"
;
$result
=
$bargainModel
->
selectBargainList
(
$filed
,
$params
,
$pageNo
,
$pageSize
);
$list
=
[];
foreach
(
$result
as
$k
=>
$v
)
{
if
(
$v
[
"father_id"
]
>
0
){
$father_id
=
$v
[
"father_id"
];
if
(
$father_id
>
0
&&
in_array
(
$father_id
,
$list
)){
unset
(
$result
[
$k
]);
}
else
{
$result
[
$k
][
"create_time"
]
=
date
(
"Y-m-d"
,
strtotime
(
$v
[
"create_time"
]));
$result
[
$k
][
"id"
]
=
$v
[
"father_id"
];
array_push
(
$list
,
$father_id
);
}
$result
[
$k
][
"create_time"
]
=
date
(
"Y-m-d"
,
strtotime
(
$v
[
"create_time"
]));
}
return
$result
;
return
;
}
...
...
application/api_broker/service/StatementService.php
View file @
9645d3c3
...
...
@@ -43,12 +43,13 @@ class StatementService
* @param $agent_id
* @param $time_start
* @param $time_end
* @param $day_or_week
* @return array|null
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
selectStatementByAgentId
(
$agent_id
,
$time_start
,
$time_end
,
$day_or_week
)
public
function
selectStatementByAgentId
(
$agent_id
,
$time_start
,
$time_end
,
$day_or_week
)
{
$field
=
"id,store_id,district_id,level,name,phone,sex,status"
;
...
...
@@ -70,7 +71,7 @@ class StatementService
$conditions
[
"agent_id"
]
=
$agent_id
;
$conditions
[
'create_time'
]
=
array
(
'between'
,
array
(
$time_start
,
$time_end
)
);
//dump($user_type);
return
$this
->
selectStatement
(
$conditions
,
$user_type
,
$store_id
,
$district_id
,
$day_or_week
);
return
$this
->
selectStatement
(
$conditions
,
$user_type
,
$store_id
,
$district_id
,
$day_or_week
);
}
...
...
@@ -82,7 +83,7 @@ class StatementService
* @param $district_id
* @return array
*/
private
function
selectStatement
(
$conditions
,
$user_type
,
$store_id
,
$district_id
,
$day_or_week
)
private
function
selectStatement
(
$conditions
,
$user_type
,
$store_id
,
$district_id
,
$day_or_week
)
{
$result
=
$params
=
[];
...
...
@@ -119,7 +120,7 @@ class StatementService
$conditions
[
"agent_id"
]
=
array
(
"in"
,
$agentIds
);
if
(
$user_type
==
2
)
{
$district_lists
=
$this
->
getDistrictList
(
$conditions
,
$district_id
,
$day_or_week
);
$district_lists
=
$this
->
getDistrictList
(
$conditions
,
$district_id
,
$day_or_week
);
$district_list
=
$district_lists
[
"district_list"
];
$result
[
"last_week_total"
]
=
$district_lists
[
"last_week_total"
];
}
...
...
@@ -127,152 +128,151 @@ class StatementService
}
$result
[
"agent_total"
]
=
$agent_total
;
$result
[
"house_num"
]
=
$this
->
houseModel
->
getAddHouseNumByAgentId
(
$conditions
);
//dump($conditions);
$result
[
"user_num"
]
=
$this
->
userModel
->
getAddUserNumByAgentId
(
$conditions
);
//$result["follow_up_num"] = $this->followUpModel->getAddFollowUpNumByAgentId($conditions);
$result
[
"follow_up_num"
]
=
$this
->
reportModel
->
getAddFollowUpNumByAgentId
(
$conditions
);
//本月业绩
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
if
(
$user_type
==
2
)
{
//如果是总监
$where_
[
"agent_id"
]
=
array
(
"in"
,
$agentIds
);
}
else
{
$where_
[
"district_id"
]
=
$district_id
;
}
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$result
[
"agent_total"
]
=
$agent_total
;
$result
[
"house_num"
]
=
$this
->
houseModel
->
getAddHouseNumByAgentId
(
$conditions
);
//dump($conditions);
$result
[
"user_num"
]
=
$this
->
userModel
->
getAddUserNumByAgentId
(
$conditions
);
//$result["follow_up_num"] = $this->followUpModel->getAddFollowUpNumByAgentId($conditions);
$result
[
"follow_up_num"
]
=
$this
->
reportModel
->
getAddFollowUpNumByAgentId
(
$conditions
);
//本月业绩
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
if
(
$user_type
==
2
){
//如果是总监
$where_
[
"agent_id"
]
=
array
(
"in"
,
$agentIds
);
}
else
{
$where_
[
"district_id"
]
=
$district_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
[
"performance_month"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//本周业绩
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$where_
[
'create_time'
]
=
[
'between'
,
[
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
]];
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$result
[
"performance_week"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
$obargain
=
new
OBargainModel
();
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$result
[
"performance_month"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//本月完成单数
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
if
(
$user_type
==
2
){
//如果是总监
$where_
[
"agent_id"
]
=
array
(
"in"
,
$agentIds
);
}
else
{
$where_
[
"district_id"
]
=
$district_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
[
"bargain_sum"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//本周业绩
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$where_
[
'create_time'
]
=
[
'between'
,
[
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
]
];
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$result
[
"performance_week"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//本月完成单数
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
if
(
$user_type
==
2
)
{
//如果是总监
$where_
[
"agent_id"
]
=
array
(
"in"
,
$agentIds
);
}
else
{
$where_
[
"district_id"
]
=
$district_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
[
"bargain_sum"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//客源
$addUserNum
=
$this
->
userModel
->
getAddUserNum
(
$where_
);
$result
[
"add_user_num"
]
=
isset
(
$addUserNum
[
0
][
"num"
])
?
$addUserNum
[
0
][
"num"
]
:
0
;
//客源
$addUserNum
=
$this
->
userModel
->
getAddUserNum
(
$where_
);
$result
[
"add_user_num"
]
=
isset
(
$addUserNum
[
0
][
"num"
])
?
$addUserNum
[
0
][
"num"
]
:
0
;
//当日业绩
$start_time
=
date
(
"Y-m-d"
,
time
());
$end_time
=
$start_time
;
$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表示实收
$result
[
"performance_day"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//当日业绩
$start_time
=
date
(
"Y-m-d"
,
time
());
$end_time
=
$start_time
;
$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表示实收
$result
[
"performance_day"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//当日客源
$addUserNum
=
$this
->
userModel
->
getAddUserNum
(
$where_
);
$result
[
"add_user_num_day"
]
=
isset
(
$addUserNum
[
0
][
"num"
])
?
$addUserNum
[
0
][
"num"
]
:
0
;
//当日客源
$addUserNum
=
$this
->
userModel
->
getAddUserNum
(
$where_
);
$result
[
"add_user_num_day"
]
=
isset
(
$addUserNum
[
0
][
"num"
])
?
$addUserNum
[
0
][
"num"
]
:
0
;
//店长当日完成单数
$where_
=
[];
$start_time
=
date
(
"Y-m-d"
,
time
());
$end_time
=
$start_time
;
$where_
[
"agent_id"
]
=
$store_id
;
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
//店长当日完成单数
$where_
=
[];
$start_time
=
date
(
"Y-m-d"
,
time
());
$end_time
=
$start_time
;
$where_
[
"agent_id"
]
=
$store_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
[
"bargain_sum_store"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
3
);
//1表示业绩 2表示实收
$result
[
"bargain_sum_store"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//店长当日带看
$where_
=
[];
$start_time
=
date
(
"Y-m-d"
,
time
());
$end_time
=
$start_time
;
$where_
[
"agent_id"
]
=
$store_id
;
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
//店长当日带看
$where_
=
[];
$start_time
=
date
(
"Y-m-d"
,
time
());
$end_time
=
$start_time
;
$where_
[
"agent_id"
]
=
$store_id
;
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$reportNum
=
$this
->
reportModel
->
getAddReportNum
(
$params
);
$result
[
"look_at_num_day_store"
]
=
isset
(
$reportNum
[
0
][
"num"
])
?
$reportNum
[
0
][
"num"
]
:
0
;
$reportNum
=
$this
->
reportModel
->
getAddReportNum
(
$params
);
$result
[
"look_at_num_day_store"
]
=
isset
(
$reportNum
[
0
][
"num"
])
?
$reportNum
[
0
][
"num"
]
:
0
;
//todo
$result
[
"store_list"
]
=
$store_list
;
$result
[
"district_list"
]
=
$district_list
;
//todo
$result
[
"store_list"
]
=
$store_list
;
$result
[
"district_list"
]
=
$district_list
;
if
(
$user_type
==
2
)
{
//如果是总监
if
(
$user_type
==
2
)
{
//如果是总监
//todo 判断是日报还是周报
if
(
$day_or_week
==
'day'
)
{
//日报
if
(
$day_or_week
==
'day'
)
{
//日报
}
else
{
//周报
}
else
{
//周报
//todo 本月业绩
$where_
=
[];
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$where_
[
"district_id"
]
=
$district_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表示实收
$where_
=
[];
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$where_
[
"district_id"
]
=
$district_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-d"
,
strtotime
(
"-14 day"
));
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$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_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$obargain
=
new
OBargainModel
();
$obargain
=
new
OBargainModel
();
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$result
[
"director_last_week_performance_num"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//todo 本周周业绩
$where_
=
[];
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$end_time
=
date
(
"Y-m-d"
,
time
());
$where_
=
[];
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$end_time
=
date
(
"Y-m-d"
,
time
());
$where_
[
"district_id"
]
=
$district_id
;
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$obargain
=
new
OBargainModel
();
$obargain
=
new
OBargainModel
();
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$result
[
"director_week_performance_num"
]
=
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_
=
[];
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
time
());
$where_
[
"district_id"
]
=
$district_id
;
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
3
);
//1表示业绩 2表示实收
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
3
);
//1表示业绩 2表示实收
$result
[
"director_bargain_sum_store"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//todo 上周人数
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-14 day"
));
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-14 day"
));
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$params
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$agentsCount
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
$agentsCount
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
$result
[
"director_last_week_employee_num"
]
=
isset
(
$agentsCount
)
?
$agentsCount
:
0
;
//todo 本周人数
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$end_time
=
date
(
"Y-m-d"
,
time
());
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$end_time
=
date
(
"Y-m-d"
,
time
());
$params
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$agentsCount
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
$agentsCount
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
$result
[
"director_week_employee_num"
]
=
isset
(
$agentsCount
)
?
$agentsCount
:
0
;
...
...
@@ -280,9 +280,6 @@ class StatementService
}
return
$result
;
}
...
...
@@ -299,25 +296,25 @@ class StatementService
$conditions_
=
$conditions
;
$conditions_
[
"agent_id"
]
=
$agent_id
;
//是门店 统计个人业绩
$store_list
[
"agent_id"
]
=
$agent_id
;
$store_list
[
"agent_name"
]
=
$agent_name
;
$store_list
[
"house_num"
]
=
$this
->
houseModel
->
getAddHouseNumByAgentId
(
$conditions_
);
$store_list
[
"user_num"
]
=
$this
->
userModel
->
getAddUserNumByAgentId
(
$conditions_
);
$store_list
[
"agent_id"
]
=
$agent_id
;
$store_list
[
"agent_name"
]
=
$agent_name
;
$store_list
[
"house_num"
]
=
$this
->
houseModel
->
getAddHouseNumByAgentId
(
$conditions_
);
$store_list
[
"user_num"
]
=
$this
->
userModel
->
getAddUserNumByAgentId
(
$conditions_
);
//$store_list["follow_up_num"] = $this->followUpModel->getAddFollowUpNumByAgentId($conditions_);
$store_list
[
"follow_up_num"
]
=
$this
->
reportModel
->
getAddFollowUpNumByAgentId
(
$conditions_
);
//本周业绩
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));
$where_
[
"agent_id"
]
=
$agent_id
;
$where_
[
'create_time'
]
=
[
'between'
,
[
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
]
];
$obargain
=
new
OBargainModel
();
$where_
[
'create_time'
]
=
[
'between'
,
[
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
]
];
$obargain
=
new
OBargainModel
();
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$store_list
[
"performance_week"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//客源
$addUserNum
=
$this
->
userModel
->
getAddUserNum
(
$where_
);
$addUserNum
=
$this
->
userModel
->
getAddUserNum
(
$where_
);
$store_list
[
"add_user_num"
]
=
isset
(
$addUserNum
[
0
][
"num"
])
?
$addUserNum
[
0
][
"num"
]
:
0
;
return
$store_list
;
...
...
@@ -329,7 +326,7 @@ class StatementService
* @param $district_id
* @return mixed
*/
private
function
getDistrictList
(
$conditions
,
$district_id
,
$day_or_week
)
private
function
getDistrictList
(
$conditions
,
$district_id
,
$day_or_week
)
{
//根据门店统计本周人数和上周人数
$time_start
=
$conditions
[
'time_start'
];
...
...
@@ -346,10 +343,10 @@ class StatementService
$last_week_total
=
0
;
foreach
(
$results
as
$key
=>
$value
)
{
// dump($value);
$last_week_total
+=
$value
[
"agent_num"
];
$paramArr
[
"store_id"
]
=
$value
[
"store_id"
];
$paramArr
[
"level"
]
=
array
(
"in"
,
[
20
,
40
]
);
$agentsResult
=
$this
->
agentModel
->
getAgentsByStoreId
(
$paramArr
);
$last_week_total
+=
$value
[
"agent_num"
];
$paramArr
[
"store_id"
]
=
$value
[
"store_id"
];
$paramArr
[
"level"
]
=
array
(
"in"
,
[
20
,
40
]
);
$agentsResult
=
$this
->
agentModel
->
getAgentsByStoreId
(
$paramArr
);
//dump($agentsResult);
$results
[
$key
][
"name"
]
=
count
(
$agentsResult
)
>
0
?
$agentsResult
[
0
][
"name"
]
:
null
;
foreach
(
$result
as
$i
=>
$item
)
{
...
...
@@ -358,55 +355,55 @@ class StatementService
}
}
if
(
$day_or_week
==
'week'
)
{
if
(
$day_or_week
==
'week'
)
{
//todo 本月业绩
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));;
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-1 day"
));;
$where_
[
"store_id"
]
=
$value
[
"store_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表示实收
$obargain
=
new
OBargainModel
();
$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_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$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_
[
'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
;
//todo 本周周业绩
$where_
=
[];
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$end_time
=
date
(
"Y-m-d"
,
time
());
$where_
[
"store_id"
]
=
$value
[
"store_id"
];
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
1
);
//1表示业绩 2表示实收
$where_
=
[];
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$end_time
=
date
(
"Y-m-d"
,
time
());
$where_
[
"store_id"
]
=
$value
[
"store_id"
];
$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
;
// 本月业绩
//todo 本月完成单数
$where_
=
[];
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
time
());
$where_
=
[];
$start_time
=
date
(
"Y-m-01"
,
time
());
$end_time
=
date
(
"Y-m-d"
,
time
());
$where_
[
"store_id"
]
=
$value
[
"store_id"
];
$where_
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
3
);
//1表示业绩 2表示实收
$performanceSum
=
$obargain
->
getAddBargainNum
(
$where_
,
3
);
//1表示业绩 2表示实收
$results
[
$key
][
"director_bargain_sum_store"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
//todo 上周人数
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-14 day"
));
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$params
[
"store_id"
]
=
$value
[
"store_id"
];
$params
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$agentsCount
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-14 day"
));
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$params
[
"store_id"
]
=
$value
[
"store_id"
];
$params
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$agentsCount
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
$results
[
$key
][
"director_last_week_employee_num"
]
=
isset
(
$agentsCount
)
?
$agentsCount
:
0
;
//todo 本周人数
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$end_time
=
date
(
"Y-m-d"
,
time
());
$params
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$agentsCount
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$end_time
=
date
(
"Y-m-d"
,
time
());
$params
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$agentsCount
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
$results
[
$key
][
"director_week_employee_num"
]
=
isset
(
$agentsCount
)
?
$agentsCount
:
0
;
}
...
...
application/model/OBargainModel.php
View file @
9645d3c3
...
...
@@ -221,12 +221,11 @@ class OBargainModel extends Model
->
join
(
"o_order c"
,
"a.order_id = c.id"
,
"left"
)
->
join
(
"g_houses d"
,
"c.house_id = d.id"
,
"left"
)
->
where
(
$where_
)
->
group
(
"a.father_id"
)
->
order
(
"a.create_time desc"
)
->
limit
(
$pageSize
)
->
page
(
$pageNo
)
->
select
();
//
echo $this->db_->getLastSql();
//
echo $this->db_->getLastSql();
return
$result
;
}
...
...
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