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
2a0af7e8
Commit
2a0af7e8
authored
Nov 13, 2018
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pk
parent
512474ce
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
22 deletions
+47
-22
RankingList.php
application/index/controller/RankingList.php
+2
-2
RankingListService.php
application/index/service/RankingListService.php
+22
-18
AAgents.php
application/model/AAgents.php
+23
-2
No files found.
application/index/controller/RankingList.php
View file @
2a0af7e8
...
@@ -22,8 +22,8 @@ class RankingList extends Basic{
...
@@ -22,8 +22,8 @@ class RankingList extends Basic{
public
function
getRandKingList
(){
public
function
getRandKingList
(){
$params
=
$this
->
params
;
$params
=
$this
->
params
;
$params
[
"position"
]
=
1
;
/*
$params["position"] = 1;
$this
->
siteId
=
10001
;
$this->siteId = 10001;
*/
if
(
!
isset
(
$params
[
"position"
])
||
$params
[
"position"
]
<
0
||
$params
[
"position"
]
>
5
){
if
(
!
isset
(
$params
[
"position"
])
||
$params
[
"position"
]
<
0
||
$params
[
"position"
]
>
5
){
return
$this
->
response
(
"101"
,
"请求参数错误"
);
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
}
...
...
application/index/service/RankingListService.php
View file @
2a0af7e8
...
@@ -39,10 +39,11 @@ class RankingListService
...
@@ -39,10 +39,11 @@ class RankingListService
$params
[
"a.position"
]
=
$position
;
$params
[
"a.position"
]
=
$position
;
$params
[
"a.status"
]
=
array
(
"in"
,
"0,3"
);
$params
[
"a.status"
]
=
array
(
"in"
,
"0,3"
);
$params
[
'b.total_time'
]
=
array
(
'between'
,
array
(
$begin_time
,
$end_time
));
$params
[
'b.total_time'
]
=
array
(
'between'
,
array
(
$begin_time
,
$end_time
));
$resultArr
=
$this
->
getSort
(
$params
);
$resultArr
=
$this
->
getSort
(
$params
,
$begin_time
,
$end_time
,
""
);
if
(
count
(
$resultArr
)
<=
0
)
{
if
(
count
(
$resultArr
)
<=
0
)
{
return
false
;
return
false
;
}
}
//分组
//分组
$total
=
count
(
$resultArr
);
$total
=
count
(
$resultArr
);
$total_page
=
floor
(
$total
/
$this
->
crewNum
);
$total_page
=
floor
(
$total
/
$this
->
crewNum
);
...
@@ -55,30 +56,28 @@ class RankingListService
...
@@ -55,30 +56,28 @@ class RankingListService
}
else
{
}
else
{
$x
=
ceil
(
$residue
/
$total_page
)
+
$this
->
crewNum
;
$x
=
ceil
(
$residue
/
$total_page
)
+
$this
->
crewNum
;
}
}
$result
=
[];
$result
=
[];
$i
=
0
;
$i
=
0
;
$k
=
0
;
$k
=
0
;
foreach
(
$resultArr
as
$key
=>
$item
)
{
foreach
(
$resultArr
as
$key
=>
$item
)
{
echo
"----"
;
$result
[
$i
][
$k
++
]
=
$item
;
echo
$key
;
if
(
$y
==
$total_page
){
dump
(
$item
);
if
((
$k
==
$x
-
1
)
&&
(
$i
+
1
)
<=
(
$total_page
-
(
$residue
%
$total_page
))
){
echo
"----"
;
/* if($y == $total_page){
if(($k == $x-1) && $i < (($residue % $total_page)-1) ){
$k
=
0
;
$k
=
0
;
$i++
;
++
$i
;
}
elseif
(
$k
==
$x
){
}
elseif
(
$k
==
$x
){
$k
=
0
;
$k
=
0
;
$i++
;
++
$i
;
}
}
}else{
*/
}
else
{
if
(
$k
==
$x
){
if
(
$k
==
$x
){
$k
=
0
;
$k
=
0
;
$i
++
;
++
$i
;
// }
}
}
$result
[
$i
][
$k
++
]
=
$item
;
}
}
}
//循环分组后的数组,查询出各组本月业绩排行
//循环分组后的数组,查询出各组本月业绩排行
...
@@ -97,18 +96,23 @@ class RankingListService
...
@@ -97,18 +96,23 @@ class RankingListService
}
}
$ids
=
rtrim
(
$ids
,
","
);
$ids
=
rtrim
(
$ids
,
","
);
$param_now
[
"a.id"
]
=
array
(
"in"
,
$ids
);
$param_now
[
"a.id"
]
=
array
(
"in"
,
$ids
);
$sort_arr
=
$this
->
getSort
(
$param_now
);
$sort_arr
=
$this
->
getSort
(
$param_now
,
$begin_time
,
$end_time
,
$ids
);
$result
[
$index
]
=
$sort_arr
;
$result
[
$index
]
=
$sort_arr
;
}
}
dump
(
$result
);
return
$result
;
return
$result
;
}
}
public
function
getSort
(
$params
){
public
function
getSort
(
$params
,
$begin_time
,
$end_time
,
$ids
){
$fields
=
"a.id,a.store_id,a.district_id,a.name,a.phone,SUM(b.performance) as performance"
;
$fields
=
"a.id,a.store_id,a.district_id,a.name,a.phone,SUM(b.performance) as performance"
;
return
$this
->
agentModel
->
getAgentsListByPK
(
$fields
,
$params
);
//查询出有业绩的经纪人
$have_performance_arr
=
$this
->
agentModel
->
getAgentsListByPK
(
$fields
,
$params
);
//查询出无业绩的经纪人
$arr
=
$this
->
agentModel
->
getAgentListByPk1
(
$params
[
"a.site_id"
],
$params
[
"a.position"
],
$begin_time
,
$end_time
,
$ids
);
return
array_merge
(
$have_performance_arr
,
$arr
);
}
}
...
...
application/model/AAgents.php
View file @
2a0af7e8
...
@@ -419,8 +419,7 @@ class AAgents extends BaseModel
...
@@ -419,8 +419,7 @@ class AAgents extends BaseModel
*/
*/
public
function
getAgentsListByPK
(
$field
=
"id"
,
$params
)
public
function
getAgentsListByPK
(
$field
=
"id"
,
$params
)
{
{
$params
[
"a.district_id"
]
=
array
(
'not in'
,
array
(
'13'
,
'14'
,
'15'
)
);
$data
=
Db
::
table
(
$this
->
table
)
return
Db
::
table
(
$this
->
table
)
->
field
(
$field
)
->
field
(
$field
)
->
alias
(
"a"
)
->
alias
(
"a"
)
->
join
(
"t_agent_total b"
,
"a.id=b.agent_id"
,
"left"
)
->
join
(
"t_agent_total b"
,
"a.id=b.agent_id"
,
"left"
)
...
@@ -428,6 +427,28 @@ class AAgents extends BaseModel
...
@@ -428,6 +427,28 @@ class AAgents extends BaseModel
->
group
(
"b.agent_id"
)
->
group
(
"b.agent_id"
)
->
order
(
"performance desc"
)
->
order
(
"performance desc"
)
->
select
();
->
select
();
//echo $this->getLastSql();
return
$data
;
}
public
function
getAgentListByPk1
(
$siteId
,
$position
,
$startTime
,
$endTime
,
$ids
){
$str_ids
=
" "
;
$str_ids1
=
" "
;
if
(
$ids
){
$str_ids
=
" and id in (
$ids
)"
;
$str_ids1
=
" and a.id in (
$ids
)"
;
}
$sql
=
"select aa.id,aa.store_id,aa.district_id,aa.name,aa.phone,aa.performance from
(select id,store_id,district_id,name,phone,0 as performance from a_agents
where position=
$position
and site_id=
$siteId
and status in (0,3)
$str_ids
)
as aa left join
(select a.id,a.store_id,a.district_id,a.name,a.phone,0 as performance from a_agents a
left join t_agent_total b on a.id=b.agent_id
where b.total_time BETWEEN '
$startTime
' and '
$endTime
'and a.status in (0,3)
$str_ids1
GROUP BY b.agent_id )
as bb on aa.id = bb.id where bb.id is null"
;
$data
=
Db
::
table
(
$this
->
table
)
->
query
(
$sql
);
//echo $this->getLastSql();
return
$data
;
}
}
/**
/**
...
...
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