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
01229586
Commit
01229586
authored
Nov 13, 2018
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pk
parent
91d56a2e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
11 deletions
+35
-11
RankingList.php
application/index/controller/RankingList.php
+4
-2
RankingListService.php
application/index/service/RankingListService.php
+31
-9
No files found.
application/index/controller/RankingList.php
View file @
01229586
...
...
@@ -22,10 +22,12 @@ class RankingList extends Basic{
public
function
getRandKingList
(){
$params
=
$this
->
params
;
if
(
empty
(
$params
[
"position"
])
||
$params
[
"position"
]
<
0
||
$params
[
"position"
]
>
5
){
$params
[
"position"
]
=
1
;
$this
->
siteId
=
10001
;
if
(
!
isset
(
$params
[
"position"
])
||
$params
[
"position"
]
<
0
||
$params
[
"position"
]
>
5
){
return
$this
->
response
(
"101"
,
"请求参数错误"
);
}
$result
=
$this
->
service_
->
RankingList
(
0
,
"10001"
);
$result
=
$this
->
service_
->
RankingList
(
$params
[
"position"
],
$this
->
siteId
);
if
(
count
(
$result
)
>
0
){
return
$this
->
response
(
"200"
,
"success"
,
$result
);
}
...
...
application/index/service/RankingListService.php
View file @
01229586
...
...
@@ -16,11 +16,15 @@ class RankingListService
{
private
$agentModel
;
private
$agentTotalModel
;
private
$crewNum
;
private
$crewNumMax
;
public
function
__construct
()
{
$this
->
agentModel
=
new
AAgents
();
$this
->
agentTotalModel
=
new
TAgentTotalModel
();
$this
->
crewNum
=
20
;
$this
->
crewNumMax
=
25
;
}
public
function
RankingList
(
$position
,
$siteId
)
...
...
@@ -41,25 +45,40 @@ class RankingListService
}
//分组
$total
=
count
(
$resultArr
);
$total_page
=
floor
(
$total
/
20
);
//加一了的
$residue
=
$total
%
20
;
if
(
$residue
<
19
)
{
$total_page
=
$total_page
-
1
;
$total_page
=
floor
(
$total
/
$this
->
crewNum
);
$residue
=
$total
%
$this
->
crewNum
;
$full
=
$total_page
*
(
$this
->
crewNumMax
-
$this
->
crewNum
);
$x
=
$this
->
crewNum
;
$y
=
$total_page
;
if
(
$full
<
$residue
)
{
$y
=
$y
+
1
;
}
else
{
$x
=
ceil
(
$residue
/
$total_page
)
+
$this
->
crewNum
;
}
$result
=
[];
$i
=
0
;
$k
=
0
;
foreach
(
$resultArr
as
$key
=>
$item
)
{
$result
[
$i
][
$k
++
]
=
$item
;
if
(
$i
>
(
$total_page
-
$residue
)){
if
(
$k
==
21
){
foreach
(
$resultArr
as
$key
=>
$item
)
{
echo
"----"
;
echo
$key
;
dump
(
$item
);
echo
"----"
;
/* if($y == $total_page){
if(($k == $x-1) && $i < (($residue % $total_page)-1) ){
$k = 0;
$i++;
}elseif($k == $x ){
$k = 0;
$i++;
}
}
elseif
(
$k
==
20
){
}else{*/
if
(
$k
==
$x
){
$k
=
0
;
$i
++
;
// }
}
$result
[
$i
][
$k
++
]
=
$item
;
}
//循环分组后的数组,查询出各组本月业绩排行
...
...
@@ -81,6 +100,7 @@ class RankingListService
$sort_arr
=
$this
->
getSort
(
$param_now
);
$result
[
$index
]
=
$sort_arr
;
}
dump
(
$result
);
return
$result
;
...
...
@@ -91,4 +111,5 @@ class RankingListService
return
$this
->
agentModel
->
getAgentsListByPK
(
$fields
,
$params
);
}
}
\ No newline at end of file
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