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
2afbe5b7
Commit
2afbe5b7
authored
Nov 12, 2018
by
zw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pk
parent
611808d4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
15 deletions
+53
-15
RankingList.php
application/index/controller/RankingList.php
+2
-2
RankingListService.php
application/index/service/RankingListService.php
+49
-12
TAgentTotalModel.php
application/model/TAgentTotalModel.php
+2
-1
No files found.
application/index/controller/RankingList.php
View file @
2afbe5b7
...
...
@@ -22,9 +22,9 @@ class RankingList extends Basic{
public
function
getRandKingList
(){
$params
=
$this
->
params
;
if
(
empty
(
$params
[
"position"
])
||
$params
[
"position"
]
<
0
){
/*
if(empty($params["position"]) || $params["position"] < 0){
return $this->response("101","请求参数错误");
}
}
*/
$result
=
$this
->
service_
->
RankingList
(
0
,
"10001"
);
if
(
count
(
$result
[
"list"
])
>
0
){
return
$this
->
response
(
"200"
,
"success"
,
$result
);
...
...
application/index/service/RankingListService.php
View file @
2afbe5b7
...
...
@@ -28,31 +28,67 @@ class RankingListService
//todo 1.查询出此职称的经纪人 获取10月份某个职称的排行 职称 1店长 2经理 3主任 4顾问 0新人
//todo 2.根据上月的业绩排行获取本月业绩排行,
//todo 3.根据此职称的总经纪人数分组
$fields
=
"a.id,a.store_id,a.district_id,SUM(b.performance) as performance"
;
$params
[
"a.site_id"
]
=
$siteId
;
$params
[
"a.position"
]
=
$position
;
$params
[
"a.status"
]
=
array
(
"in"
,
"0,3"
);
$begin_time
=
date
(
'Y-m-01 00:00:00'
,
strtotime
(
'-1 month'
));
$end_time
=
date
(
"Y-m-d 23:59:59"
,
strtotime
(
-
date
(
'd'
)
.
'day'
));
$params
[
"a.site_id"
]
=
$siteId
;
$params
[
"a.position"
]
=
$position
;
$params
[
"a.status"
]
=
array
(
"in"
,
"0,3"
);
$params
[
'b.total_time'
]
=
array
(
'between'
,
array
(
$begin_time
,
$end_time
));
$resultArr
=
$this
->
agentModel
->
getAgentsListByPK
(
$fields
,
$params
);
$resultArr
=
$this
->
getSort
(
$params
);
if
(
count
(
$resultArr
)
<=
0
)
{
return
false
;
}
//分组
$total
=
count
(
$resultArr
);
$total_page
=
ceil
(
$total
/
20
);
//加一了的
$total_page
=
floor
(
$total
/
20
);
//加一了的
$residue
=
$total
%
20
;
if
(
$residue
<
19
)
{
$total_page
=
$total_page
-
1
;
}
$result
[
"list"
]
=
$resultArr
;
$result
[
"total_page"
]
=
$total_page
;
$result
[
"residue"
]
=
$residue
;
return
$result
;
$result
=
[];
$i
=
0
;
$k
=
0
;
foreach
(
$resultArr
as
$key
=>
$item
)
{
$result
[
$i
][
$k
++
]
=
$item
;
if
(
$i
>
(
$total_page
-
$residue
)){
if
(
$k
==
21
){
$k
=
0
;
$i
++
;
}
}
elseif
(
$k
==
20
){
$k
=
0
;
$i
++
;
}
}
//循环分组后的数组,查询出各组本月业绩排行
//本月
$begin_time
=
date
(
'Y-m-01'
,
time
());
$end_time
=
date
(
"Y-m-01"
,
strtotime
(
'+1 month'
));
$param_now
[
"a.site_id"
]
=
$siteId
;
$param_now
[
"a.position"
]
=
$position
;
$param_now
[
"a.status"
]
=
array
(
"in"
,
"0,3"
);
$param_now
[
'b.total_time'
]
=
array
(
'between'
,
array
(
$begin_time
,
$end_time
));
foreach
(
$result
as
$index
=>
$item
){
$ids
=
""
;
foreach
(
$item
as
$key
=>
$value
){
$ids
.=
$value
[
"id"
]
.
","
;
}
$ids
=
rtrim
(
$ids
,
","
);
$param_now
[
"a.id"
]
=
array
(
"in"
,
$ids
);
$sort_arr
=
$this
->
getSort
(
$param_now
);
$result
[
$index
]
=
$sort_arr
;
}
dump
(
$result
);
}
public
function
getSort
(
$params
){
$fields
=
"a.id,a.store_id,a.district_id,SUM(b.performance) as performance"
;
return
$this
->
agentModel
->
getAgentsListByPK
(
$fields
,
$params
);
}
}
\ No newline at end of file
application/model/TAgentTotalModel.php
View file @
2afbe5b7
...
...
@@ -321,7 +321,7 @@ class TAgentTotalModel extends Model
->
group
(
"agent_id"
)
->
order
(
"performance desc"
)
->
select
();
echo
$this
->
getLastSql
();
//
echo $this->getLastSql();
return
$data
;
}
}
\ 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