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
c8024fc2
Commit
c8024fc2
authored
Nov 28, 2018
by
zhuwei
Committed by
zw
Nov 29, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
0698f89c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
46 deletions
+56
-46
StatementService.php
application/api_broker/service/StatementService.php
+56
-46
No files found.
application/api_broker/service/StatementService.php
View file @
c8024fc2
...
@@ -836,57 +836,67 @@ class StatementService
...
@@ -836,57 +836,67 @@ class StatementService
$agent_result
=
$this
->
agentModel
->
getAgentsByStoreIdV2
(
$conditions_
);
$agent_result
=
$this
->
agentModel
->
getAgentsByStoreIdV2
(
$conditions_
);
foreach
(
$agent_result
as
$k
=>
$v
)
{
foreach
(
$agent_result
as
$k
=>
$v
)
{
$district_list_
[]
=
$this
->
selectStatementForDistrictWithWeek_
(
$v
);
}
$district_list
[
'store_id'
]
=
$v
[
'store_id'
]
;
$result
[
"district_list"
]
=
$district_list_
;
$district_list
[
'name'
]
=
$v
[
'name'
]
;
return
$result
;
$district_list
[
'store_name'
]
=
$v
[
'store_name'
];
}
$agent_res
=
$this
->
getAgentIDsByDistrictId
(
$v
[
'store_id'
],
1
);
/**
$conditions
[
'agent_id'
]
=
array
(
"in"
,
$agent_res
[
'agent_ids'
]
);
* 总监周报获取总监旗下门店报告
* @param $store_info
* @return mixed
*/
public
function
selectStatementForDistrictWithWeek_
(
$store_info
)
{
$district_list
[
'store_id'
]
=
$store_info
[
'store_id'
];
$district_list
[
'name'
]
=
$store_info
[
'name'
];
$district_list
[
'store_name'
]
=
$store_info
[
'store_name'
];
/*上周时间*/
$agent_res
=
$this
->
getAgentIDsByDistrictId
(
$store_info
[
'store_id'
],
1
);
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-14 day"
));
$conditions
[
'agent_id'
]
=
array
(
"in"
,
$agent_res
[
'agent_ids'
]
);
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$conditions
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
// 上周业绩
/*上周时间*/
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$conditions
,
1
);
//1表示业绩 2表示实收
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-14 day"
));
$district_list
[
"performance_for_last_week"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
$end_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
// 上周人数
$conditions
[
'create_time'
]
=
array
(
'between'
,
array
(
$start_time
.
" 00:00:00"
,
$end_time
.
" 23:59:59"
)
);
$params
[
'id'
]
=
array
(
"in"
,
$agent_res
[
'agent_ids'
]
);
$params
[
'create_time'
]
=
$conditions
[
'create_time'
]
;
$agentsCount
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
$district_list
[
"team_num_for_last_week"
]
=
isset
(
$agentsCount
)
?
$agentsCount
:
0
;
/*本周时间*/
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$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表示实收
$district_list
[
"performance_for_week"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
// 本周人数
$params
[
'id'
]
=
array
(
"in"
,
$agent_res
[
'agent_ids'
]
);
$params
[
'create_time'
]
=
$conditions
[
'create_time'
]
;
$agentsCount
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
$district_list
[
"team_num_for_week"
]
=
isset
(
$agentsCount
)
?
$agentsCount
:
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"
)
);
// 本月业绩
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$conditions
,
1
);
//1表示业绩 2表示实收
$district_list
[
"performance_for_month"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
// 本月完成单数
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNumV2
(
$conditions
,
3
);
//1表示业绩 2表示实收
$district_list
[
"bargain_sum_for_month"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
$district_list_
[]
=
$district_list
;
// 上周业绩
}
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$conditions
,
1
);
//1表示业绩 2表示实收
$result
[
"district_list"
]
=
$district_list_
;
$district_list
[
"performance_for_last_week"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
return
$result
;
// 上周人数
$params
[
'id'
]
=
array
(
"in"
,
$agent_res
[
'agent_ids'
]
);
$params
[
'create_time'
]
=
$conditions
[
'create_time'
]
;
$agentsCount
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
$district_list
[
"team_num_for_last_week"
]
=
isset
(
$agentsCount
)
?
$agentsCount
:
0
;
/*本周时间*/
$start_time
=
date
(
"Y-m-d"
,
strtotime
(
"-7 day"
));
$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表示实收
$district_list
[
"performance_for_week"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
// 本周人数
$params
[
'id'
]
=
array
(
"in"
,
$agent_res
[
'agent_ids'
]
);
$params
[
'create_time'
]
=
$conditions
[
'create_time'
]
;
$agentsCount
=
$this
->
agentModel
->
getAgentsCountByStoreId
(
$params
);
$district_list
[
"team_num_for_week"
]
=
isset
(
$agentsCount
)
?
$agentsCount
:
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"
)
);
// 本月业绩
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNum
(
$conditions
,
1
);
//1表示业绩 2表示实收
$district_list
[
"performance_for_month"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
// 本月完成单数
$performanceSum
=
$this
->
bargainModel
->
getAddBargainNumV2
(
$conditions
,
3
);
//1表示业绩 2表示实收
$district_list
[
"bargain_sum_for_month"
]
=
isset
(
$performanceSum
[
0
][
"num"
])
?
$performanceSum
[
0
][
"num"
]
:
0
;
return
$district_list
;
}
}
/**
/**
...
...
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